Ignore:
Timestamp:
Mar 19, 2008 11:00:30 PM (17 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-test/stun.c

    r1869 r1877  
    270270 
    271271        /* Try to encode message */ 
    272         pj_stun_create_key(pool, &key, NULL, &USERNAME, &PASSWORD); 
     272        pj_stun_create_key(pool, &key, NULL, &USERNAME, PJ_STUN_PASSWD_PLAIN, &PASSWORD); 
    273273        status = pj_stun_msg_encode(msg, buf, sizeof(buf), 0, &key, &len); 
    274274        if (status != PJ_SUCCESS) { 
     
    406406{ 
    407407    /* Decode all attribute types */ 
    408     return 0; 
    409 } 
    410  
    411 static int auth_test(void) 
    412 { 
    413     /* REALM and USERNAME is present, but MESSAGE-INTEGRITY is not present. 
    414      * For short term, must with reply 401 without REALM. 
    415      * For long term, must reply with 401 with REALM. 
    416      */ 
    417  
    418     /* USERNAME is not present, server must respond with 432 (Missing 
    419      * Username). 
    420      */ 
    421  
    422     /* If long term credential is wanted and REALM is not present, server  
    423      * must respond with 434 (Missing Realm)  
    424      */ 
    425  
    426     /* If REALM doesn't match, server must respond with 434 (Missing Realm) 
    427      * too, containing REALM and NONCE attribute. 
    428      */ 
    429  
    430     /* When long term authentication is wanted and NONCE is NOT present, 
    431      * server must respond with 435 (Missing Nonce), containing REALM and 
    432      * NONCE attribute. 
    433      */ 
    434  
    435     /* Simulate 438 (Stale Nonce) */ 
    436      
    437     /* Simulate 436 (Unknown Username) */ 
    438  
    439     /* When server wants to use short term credential, but request has 
    440      * REALM, reject with .... ??? 
    441      */ 
    442  
    443     /* Invalid HMAC */ 
    444  
    445     /* Valid static short term, without NONCE */ 
    446  
    447     /* Valid static short term, WITH NONCE */ 
    448  
    449     /* Valid static long term (with NONCE */ 
    450  
    451     /* Valid dynamic short term (without NONCE) */ 
    452  
    453     /* Valid dynamic short term (with NONCE) */ 
    454  
    455     /* Valid dynamic long term (with NONCE) */ 
    456  
    457408    return 0; 
    458409} 
     
    615566 
    616567            pj_stun_create_key(pool, &key, NULL, pj_cstr(&s1, v->username),  
    617                                pj_cstr(&s2, v->password)); 
     568                               PJ_STUN_PASSWD_PLAIN, pj_cstr(&s2, v->password)); 
    618569            pj_stun_msg_encode(msg, buf, sizeof(buf), 0, &key, &len); 
    619570 
     
    752703        goto on_return; 
    753704 
    754     rc = auth_test(); 
    755     if (rc != 0) 
    756         goto on_return; 
    757  
    758705    rc = fingerprint_test_vector(); 
    759706    if (rc != 0) 
Note: See TracChangeset for help on using the changeset viewer.