arguments to auth_headers() needed to be swapped here.
To avoid the same mistake in the future (due to slightly confusing variable names), add a comment. On passing, remove a redundant initialization. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45009 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
d8ab613fdf
commit
1fe21371a3
1 changed files with 10 additions and 3 deletions
|
@ -7737,7 +7737,7 @@ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *
|
||||||
const char *secret, const char *md5secret, int sipmethod,
|
const char *secret, const char *md5secret, int sipmethod,
|
||||||
char *uri, enum xmittype reliable, int ignore)
|
char *uri, enum xmittype reliable, int ignore)
|
||||||
{
|
{
|
||||||
const char *response = "407 Proxy Authentication Required";
|
const char *response;
|
||||||
char *reqheader, *respheader;
|
char *reqheader, *respheader;
|
||||||
const char *authtoken;
|
const char *authtoken;
|
||||||
char a1_hash[256];
|
char a1_hash[256];
|
||||||
|
@ -7746,6 +7746,7 @@ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *
|
||||||
char *c;
|
char *c;
|
||||||
int wrongnonce = FALSE;
|
int wrongnonce = FALSE;
|
||||||
int good_response;
|
int good_response;
|
||||||
|
int code;
|
||||||
const char *usednonce = p->randdata;
|
const char *usednonce = p->randdata;
|
||||||
|
|
||||||
/* table of recognised keywords, and their value in the digest */
|
/* table of recognised keywords, and their value in the digest */
|
||||||
|
@ -7768,12 +7769,18 @@ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *
|
||||||
/* On a REGISTER, we have to use 401 and its family of headers
|
/* On a REGISTER, we have to use 401 and its family of headers
|
||||||
* instead of 407 and its family of headers.
|
* instead of 407 and its family of headers.
|
||||||
*/
|
*/
|
||||||
|
code = WWW_AUTH;
|
||||||
response = "401 Unauthorized";
|
response = "401 Unauthorized";
|
||||||
auth_headers(WWW_AUTH, &reqheader, &respheader);
|
|
||||||
} else {
|
} else {
|
||||||
|
code = PROXY_AUTH;
|
||||||
response = "407 Proxy Authentication Required";
|
response = "407 Proxy Authentication Required";
|
||||||
auth_headers(PROXY_AUTH, &reqheader, &respheader);
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Note the apparent swap of arguments below, compared to other
|
||||||
|
* usages of auth_headers().
|
||||||
|
*/
|
||||||
|
auth_headers(code, &respheader, &reqheader);
|
||||||
|
|
||||||
authtoken = get_header(req, reqheader);
|
authtoken = get_header(req, reqheader);
|
||||||
if (ignore && !ast_strlen_zero(p->randdata) && ast_strlen_zero(authtoken)) {
|
if (ignore && !ast_strlen_zero(p->randdata) && ast_strlen_zero(authtoken)) {
|
||||||
/* This is a retransmitted invite/register/etc, don't reconstruct authentication
|
/* This is a retransmitted invite/register/etc, don't reconstruct authentication
|
||||||
|
|
Loading…
Reference in a new issue