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:
Luigi Rizzo 2006-10-13 11:11:19 +00:00
parent d8ab613fdf
commit 1fe21371a3
1 changed files with 10 additions and 3 deletions

View File

@ -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,
char *uri, enum xmittype reliable, int ignore)
{
const char *response = "407 Proxy Authentication Required";
const char *response;
char *reqheader, *respheader;
const char *authtoken;
char a1_hash[256];
@ -7746,6 +7746,7 @@ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *
char *c;
int wrongnonce = FALSE;
int good_response;
int code;
const char *usednonce = p->randdata;
/* 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
* instead of 407 and its family of headers.
*/
code = WWW_AUTH;
response = "401 Unauthorized";
auth_headers(WWW_AUTH, &reqheader, &respheader);
} else {
code = PROXY_AUTH;
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);
if (ignore && !ast_strlen_zero(p->randdata) && ast_strlen_zero(authtoken)) {
/* This is a retransmitted invite/register/etc, don't reconstruct authentication