Ignore:
Timestamp:
Nov 6, 2009 4:16:36 AM (14 years ago)
Author:
bennylp
Message:

Fixed ticket #986: Assertion when authorization PJSIP_AUTH_AUTO_SEND_NEXT is enabled (thanks Zhefeng Du for the report)

  • also added SIPp scenario for testing
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_auth_client.c

    r2394 r2988  
    323323                                   const pjsip_www_authenticate_hdr *hdr ) 
    324324{ 
    325     if (hdr->challenge.digest.qop.slen == 0) 
     325    if (hdr->challenge.digest.qop.slen == 0) { 
     326#if PJSIP_AUTH_AUTO_SEND_NEXT!=0 
     327        if (!cached_auth->last_chal || pj_stricmp2(&hdr->scheme, "digest")) { 
     328            cached_auth->last_chal = (pjsip_www_authenticate_hdr*) 
     329                                     pjsip_hdr_clone(ses_pool, hdr); 
     330        } else { 
     331            /* Only update if the new challenge is "significantly different" 
     332             * than the one in the cache, to reduce memory usage. 
     333             */ 
     334            const pjsip_digest_challenge *d1 =  
     335                        &cached_auth->last_chal->challenge.digest; 
     336            const pjsip_digest_challenge *d2 = &hdr->challenge.digest; 
     337 
     338            if (pj_strcmp(&d1->domain, &d2->domain) || 
     339                pj_strcmp(&d1->realm, &d2->realm) || 
     340                pj_strcmp(&d1->nonce, &d2->nonce) || 
     341                pj_strcmp(&d1->opaque, &d2->opaque) || 
     342                pj_strcmp(&d1->algorithm, &d2->algorithm) || 
     343                pj_strcmp(&d1->qop, &d2->qop)) 
     344            { 
     345                cached_auth->last_chal = (pjsip_www_authenticate_hdr*) 
     346                                         pjsip_hdr_clone(ses_pool, hdr); 
     347            } 
     348        } 
     349#endif 
    326350        return; 
     351    } 
    327352 
    328353    /* Initialize cnonce and qop if not present. */ 
Note: See TracChangeset for help on using the changeset viewer.