Ticket #410: Endless authentication retries when 401/407 response contains no challenge
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1539 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
parent
e083fd5786
commit
860be56153
|
@ -391,7 +391,10 @@ PJ_BEGIN_DECL
|
|||
* Invalid AKA credential.
|
||||
*/
|
||||
#define PJSIP_EAUTHINAKACRED (PJSIP_ERRNO_START_PJSIP + 113) /* 171113 */
|
||||
|
||||
/**
|
||||
* No challenge is found in the challenge.
|
||||
*/
|
||||
#define PJSIP_EAUTHNOCHAL (PJSIP_ERRNO_START_PJSIP + 114) /* 171114 */
|
||||
|
||||
/************************************************************
|
||||
* UA AND DIALOG ERRORS
|
||||
|
|
|
@ -901,6 +901,7 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
|
|||
{
|
||||
pjsip_tx_data *tdata;
|
||||
const pjsip_hdr *hdr;
|
||||
unsigned chal_cnt;
|
||||
pjsip_via_hdr *via;
|
||||
pj_status_t status;
|
||||
|
||||
|
@ -921,6 +922,7 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
|
|||
* Respond to each authentication challenge.
|
||||
*/
|
||||
hdr = rdata->msg_info.msg->hdr.next;
|
||||
chal_cnt = 0;
|
||||
while (hdr != &rdata->msg_info.msg->hdr) {
|
||||
pjsip_cached_auth *cached_auth;
|
||||
const pjsip_www_authenticate_hdr *hchal;
|
||||
|
@ -937,6 +939,7 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
|
|||
break;
|
||||
|
||||
hchal = (const pjsip_www_authenticate_hdr*) hdr;
|
||||
++chal_cnt;
|
||||
|
||||
/* Find authentication session for this realm, create a new one
|
||||
* if not present.
|
||||
|
@ -969,6 +972,9 @@ PJ_DEF(pj_status_t) pjsip_auth_clt_reinit_req( pjsip_auth_clt_sess *sess,
|
|||
hdr = hdr->next;
|
||||
}
|
||||
|
||||
/* Check if challenge is present */
|
||||
if (chal_cnt == 0)
|
||||
return PJSIP_EAUTHNOCHAL;
|
||||
|
||||
/* Remove branch param in Via header. */
|
||||
via = (pjsip_via_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
|
||||
|
|
|
@ -104,6 +104,7 @@ static const struct
|
|||
PJ_BUILD_ERR( PJSIP_EAUTHSTALECOUNT, "Maximum number of stale retries exceeded"),
|
||||
PJ_BUILD_ERR( PJSIP_EAUTHINNONCE, "Invalid nonce value in authentication challenge"),
|
||||
PJ_BUILD_ERR( PJSIP_EAUTHINAKACRED, "Invalid AKA credential"),
|
||||
PJ_BUILD_ERR( PJSIP_EAUTHNOCHAL, "No challenge is found"),
|
||||
|
||||
/* UA/dialog layer. */
|
||||
PJ_BUILD_ERR( PJSIP_EMISSINGTAG, "Missing From/To tag parameter" ),
|
||||
|
|
Loading…
Reference in New Issue