Ignore:
Timestamp:
Mar 19, 2008 11:00:30 PM (16 years ago)
Author:
bennylp
Message:

Related to ticket #485: huge changeset to update STUN relating to managing authentication. See the ticket for the details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/ice_session.c

    r1731 r1877  
    121121                                      const pj_uint8_t *pkt, 
    122122                                      unsigned pkt_len, 
    123                                       const pj_stun_msg *msg, 
     123                                      const pj_stun_rx_data *rdata, 
    124124                                      const pj_sockaddr_t *src_addr, 
    125125                                      unsigned src_addr_len); 
     
    148148                                      pj_str_t *username, 
    149149                                      pj_str_t *nonce, 
    150                                       int *data_type, 
     150                                      pj_stun_passwd_type *data_type, 
    151151                                      pj_str_t *data); 
    152152static pj_status_t stun_auth_get_password(const pj_stun_msg *msg, 
     
    155155                                          const pj_str_t *username, 
    156156                                          pj_pool_t *pool, 
    157                                           int *data_type, 
     157                                          pj_stun_passwd_type *data_type, 
    158158                                          pj_str_t *data); 
    159159 
     
    233233    auth_cred.data.dyn_cred.get_password = &stun_auth_get_password; 
    234234    auth_cred.data.dyn_cred.user_data = comp->stun_sess; 
    235     pj_stun_session_set_credential(comp->stun_sess, &auth_cred); 
     235    pj_stun_session_set_credential(comp->stun_sess, PJ_STUN_AUTH_SHORT_TERM, 
     236                                   &auth_cred); 
    236237 
    237238    return PJ_SUCCESS; 
     
    447448                                      pj_str_t *username, 
    448449                                      pj_str_t *nonce, 
    449                                       int *data_type, 
     450                                      pj_stun_passwd_type *data_type, 
    450451                                      pj_str_t *data) 
    451452{ 
     
    462463         */ 
    463464        *username = ice->rx_uname; 
    464         *data_type = 0; 
     465        *data_type = PJ_STUN_PASSWD_PLAIN; 
    465466        *data = ice->rx_pass; 
    466467    } 
    467468    else { 
    468469        *username = ice->tx_uname; 
    469         *data_type = 0; 
     470        *data_type = PJ_STUN_PASSWD_PLAIN; 
    470471        *data = ice->tx_pass; 
    471472    } 
     
    480481                                          const pj_str_t *username, 
    481482                                          pj_pool_t *pool, 
    482                                           int *data_type, 
     483                                          pj_stun_passwd_type *data_type, 
    483484                                          pj_str_t *data) 
    484485{ 
     
    497498        if (pj_strcmp(username, &ice->tx_uname) != 0) 
    498499            return PJ_STATUS_FROM_STUN_CODE(PJ_STUN_SC_UNAUTHORIZED); 
    499         *data_type = 0; 
     500        *data_type = PJ_STUN_PASSWD_PLAIN; 
    500501        *data = ice->tx_pass; 
    501502 
     
    522523            return PJ_STATUS_FROM_STUN_CODE(PJ_STUN_SC_UNAUTHORIZED); 
    523524 
    524         *data_type = 0; 
     525        *data_type = PJ_STUN_PASSWD_PLAIN; 
    525526        *data = ice->rx_pass; 
    526527 
     
    19041905                                      const pj_uint8_t *pkt, 
    19051906                                      unsigned pkt_len, 
    1906                                       const pj_stun_msg *msg, 
     1907                                      const pj_stun_rx_data *rdata, 
    19071908                                      const pj_sockaddr_t *src_addr, 
    19081909                                      unsigned src_addr_len) 
    19091910{ 
    19101911    stun_data *sd; 
     1912    const pj_stun_msg *msg = rdata->msg; 
    19111913    pj_ice_sess *ice; 
    19121914    pj_stun_priority_attr *prio_attr; 
     
    19221924    /* Reject any requests except Binding request */ 
    19231925    if (msg->hdr.type != PJ_STUN_BINDING_REQUEST) { 
    1924         status = pj_stun_session_create_res(sess, msg,  
     1926        status = pj_stun_session_create_res(sess, rdata,  
    19251927                                            PJ_STUN_SC_BAD_REQUEST, 
    19261928                                            NULL, &tdata); 
     
    19931995        } else { 
    19941996            /* Generate 487 response */ 
    1995             status = pj_stun_session_create_res(sess, msg,  
     1997            status = pj_stun_session_create_res(sess, rdata,  
    19961998                                                PJ_STUN_SC_ROLE_CONFLICT, 
    19971999                                                NULL, &tdata); 
     
    20092011        if (pj_cmp_timestamp(&ice->tie_breaker, &role_attr->value) < 0) { 
    20102012            /* Generate 487 response */ 
    2011             status = pj_stun_session_create_res(sess, msg,  
     2013            status = pj_stun_session_create_res(sess, rdata,  
    20122014                                                PJ_STUN_SC_ROLE_CONFLICT, 
    20132015                                                NULL, &tdata); 
     
    20292031     * First send response to this request  
    20302032     */ 
    2031     status = pj_stun_session_create_res(sess, msg, 0, NULL, &tdata); 
     2033    status = pj_stun_session_create_res(sess, rdata, 0, NULL, &tdata); 
    20322034    if (status != PJ_SUCCESS) { 
    20332035        pj_mutex_unlock(ice->mutex); 
Note: See TracChangeset for help on using the changeset viewer.