diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-16 10:59:28 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-05-16 10:59:28 +0000 |
commit | 358dfae0cfd1eafb28b9b6e7c85b62669819f9a2 (patch) | |
tree | 355922ba49b5f94e3919fc3ebc9ff054de302134 /channels/chan_sip.c | |
parent | c29018c3159f8677ca28a59e1a39f44ffba6438b (diff) |
Fix auth on BYE. (Different patch than for 1.2)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@64605 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index fd6edc73d..34bccdee0 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12311,16 +12311,18 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ handle_response_refer(p, resp, rest, req, seqno); else if (p->registry && sipmethod == SIP_REGISTER) res = handle_response_register(p, resp, rest, req, ignore, seqno); - else if (sipmethod == SIP_BYE) - if (ast_strlen_zero(p->authname)) + else if (sipmethod == SIP_BYE) { + if (ast_strlen_zero(p->authname)) { ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n", msg, ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port)); ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); - if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, "WWW-Authenticate", "Authorization", sipmethod, 0)) { + } else if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, "WWW-Authenticate", "Authorization", sipmethod, 0)) { ast_log(LOG_NOTICE, "Failed to authenticate on %s to '%s'\n", msg, get_header(&p->initreq, "From")); ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); + /* We fail to auth bye on our own call, but still needs to tear down the call. + Life, they call it. */ } - else { + } else { ast_log(LOG_WARNING, "Got authentication request (401) on unknown %s to '%s'\n", sip_methods[sipmethod].text, get_header(req, "To")); ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); } @@ -12351,11 +12353,11 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ else if (p->registry && sipmethod == SIP_REGISTER) res = handle_response_register(p, resp, rest, req, ignore, seqno); else if (sipmethod == SIP_BYE) { - if (ast_strlen_zero(p->authname)) + if (ast_strlen_zero(p->authname)) { ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n", msg, ast_inet_ntoa(p->recv.sin_addr), ntohs(p->recv.sin_port)); ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); - if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, "Proxy-Authenticate", "Proxy-Authorization", sipmethod, 0)) { + } else if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, "Proxy-Authenticate", "Proxy-Authorization", sipmethod, 0)) { ast_log(LOG_NOTICE, "Failed to authenticate on %s to '%s'\n", msg, get_header(&p->initreq, "From")); ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); } |