summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2006-10-13 11:11:19 +0000
committerLuigi Rizzo <rizzo@icir.org>2006-10-13 11:11:19 +0000
commit1fe21371a358670e0df084aa0bdcc8d8b52df5ab (patch)
treec4d6678f5ae9ea29fb7d42d9749dae24e9bf9db4 /channels
parentd8ab613fdf3dca6162de8966291c3e8db6f28e6d (diff)
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
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ee285a92d..f4de10bba 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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