Ignore:
Timestamp:
Aug 28, 2019 2:13:32 PM (5 years ago)
Author:
riza
Message:

Close #2222: Introduce a new compiler setting to allow to use cnonce for SIP authentication without hyphen character

File:
1 edited

Legend:

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

    r5883 r6055  
    397397        /* Create cnonce */ 
    398398        pj_create_unique_string( cached_auth->pool, &cached_auth->cnonce ); 
     399#if defined(PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY) && \ 
     400    PJSIP_AUTH_CNONCE_USE_DIGITS_ONLY!=0 
     401        if (pj_strchr(&cached_auth->cnonce, '-')) { 
     402            /* remove hyphen character. */ 
     403            int w, r, len = pj_strlen(&cached_auth->cnonce); 
     404            char *s = cached_auth->cnonce.ptr; 
     405 
     406            w = r = 0; 
     407            for (; r < len; r++) { 
     408                if (s[r] != '-') 
     409                    s[w++] = s[r]; 
     410            } 
     411            s[w] = '\0'; 
     412            cached_auth->cnonce.slen = w; 
     413        } 
     414#endif 
    399415 
    400416        /* Initialize nonce-count */ 
Note: See TracChangeset for help on using the changeset viewer.