summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-07 20:00:10 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-07 20:00:10 +0000
commita7c65d1eaeec40ce135ba5b1c1d14a0255bb99f2 (patch)
treef1b04060be2cdff51493b6eb794751e9a5239246 /pjsip
parent9d2bd3abeba38f4bc466257c4598f0f6a11d76d2 (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
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/src/pjsip/sip_auth_client.c15
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.
*/