diff options
author | Benny Prijono <bennylp@teluu.com> | 2008-07-07 20:00:10 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2008-07-07 20:00:10 +0000 |
commit | a7c65d1eaeec40ce135ba5b1c1d14a0255bb99f2 (patch) | |
tree | f1b04060be2cdff51493b6eb794751e9a5239246 | |
parent | 9d2bd3abeba38f4bc466257c4598f0f6a11d76d2 (diff) |
Related to ticket 554: handle the case where server rejects Authorization because of incorrect nonce but fails to set stale parameter to true. In this case we will retry the authentication as long as the nonce in the challenge is different than current nonce. This seems to have fixed ticket 554 too (to be confirmed)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2109 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip/sip_auth_client.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c index 6e924d75..5ce5cdca 100644 --- a/pjsip/src/pjsip/sip_auth_client.c +++ b/pjsip/src/pjsip/sip_auth_client.c @@ -941,7 +941,20 @@ static pj_status_t process_auth( pj_pool_t *req_pool, * other causes. */ if (hdr != &tdata->msg->hdr) { - if (hchal->challenge.digest.stale == 0) { + pj_bool_t stale; + + /* Detect "stale" state */ + stale = hchal->challenge.digest.stale; + if (!stale) { + /* If stale is false, check is nonce has changed. Some servers + * (broken ones!) want to change nonce but they fail to set + * stale to true. + */ + stale = pj_strcmp(&hchal->challenge.digest.nonce, + &sent_auth->credential.digest.nonce); + } + + if (stale == PJ_FALSE) { /* Our credential is rejected. No point in trying to re-supply * the same credential. */ |