From c067e892c5cfaf5faa1882e785bbb6780f4ee468 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 14 Mar 2014 12:25:43 -0500 Subject: [PATCH] FS-6287 --resolve When a broken registrar sends a 401 unauth then replies with a subsequent 401 unauth without the stale=true attribute, sofia tries to invalidate the auth handle and get stuck in a state where it cannot recover until the reg handle is destroyed. In this case, the provider in question has a bug on thier end when the nonce count rolls from nc=000000ff to nc=00000100 they start sending several consecitive 401 rather than a 401 with stale=true or a 403. This change will allow it to reset properly and try again with nc=00000001 on the next try. --- libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c index c5400dd4ca..467235cd8b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c @@ -1197,13 +1197,9 @@ int nua_base_client_check_restart(nua_client_request_t *cr, cr->cr_challenged = 1; - if (invalid) { - /* Bad username/password */ - SU_DEBUG_7(("nua(%p): bad credentials, clearing them\n", (void *)nh)); - auc_clear_credentials(&nh->nh_auth, NULL, NULL); - } - else if (auc_has_authorization(&nh->nh_auth)) - return nua_client_restart(cr, 100, "Request Authorized by Cache"); + if (!invalid && auc_has_authorization(&nh->nh_auth)) { + return nua_client_restart(cr, 100, "Request Authorized by Cache"); + } orq = cr->cr_orq, cr->cr_orq = NULL; @@ -1213,7 +1209,7 @@ int nua_base_client_check_restart(nua_client_request_t *cr, cr->cr_status = 0, cr->cr_phrase = NULL; nua_client_request_unref(cr); - return 1; + return 0; } } /* GriGiu : RFC-3261 status supported Retry-After */