[asterisk-commits] oej: branch oej/sip_request_size_8556 r64654 - in
/team/oej/sip_request_size_...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed May 16 08:00:35 MST 2007
Author: oej
Date: Wed May 16 10:00:34 2007
New Revision: 64654
URL: http://svn.digium.com/view/asterisk?view=rev&rev=64654
Log:
Merging
Modified:
team/oej/sip_request_size_8556/ (props changed)
team/oej/sip_request_size_8556/channels/chan_sip.c
Propchange: team/oej/sip_request_size_8556/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/sip_request_size_8556/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/sip_request_size_8556/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed May 16 10:00:34 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-64518
+/branches/1.4:1-64653
Modified: team/oej/sip_request_size_8556/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sip_request_size_8556/channels/chan_sip.c?view=diff&rev=64654&r1=64653&r2=64654
==============================================================================
--- team/oej/sip_request_size_8556/channels/chan_sip.c (original)
+++ team/oej/sip_request_size_8556/channels/chan_sip.c Wed May 16 10:00:34 2007
@@ -5561,9 +5561,9 @@
++h;
else {
h = uri;
- if (strncmp(h, "sip:", 4) == 0)
+ if (strncasecmp(h, "sip:", 4) == 0)
h += 4;
- else if (strncmp(h, "sips:", 5) == 0)
+ else if (strncasecmp(h, "sips:", 5) == 0)
h += 5;
}
hn = strcspn(h, ":;>") + 1;
@@ -7013,7 +7013,7 @@
ast_copy_string(from, get_header(&p->initreq, "From"), sizeof(from));
c = get_in_brackets(from);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", c);
return -1;
}
@@ -7021,7 +7021,7 @@
ast_copy_string(to, get_header(&p->initreq, "To"), sizeof(to));
c = get_in_brackets(to);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", c);
return -1;
}
@@ -7524,7 +7524,7 @@
ast_copy_string(from, of, sizeof(from));
of = get_in_brackets(from);
ast_string_field_set(p, from, of);
- if (strncmp(of, "sip:", 4))
+ if (strncasecmp(of, "sip:", 4))
ast_log(LOG_NOTICE, "From address missing 'sip:', using it anyway\n");
else
of += 4;
@@ -7787,7 +7787,6 @@
/* Work on a copy */
contact = ast_strdupa(pvt->fullcontact);
- /* XXX this code is repeated all over */
/* Make sure it's a SIP URL */
if (strncasecmp(contact, "sip:", 4)) {
ast_log(LOG_NOTICE, "'%s' is not a valid SIP contact (missing sip:) trying to use anyway\n", contact);
@@ -7796,7 +7795,6 @@
/* Ditch arguments */
/* XXX this code is replicated also shortly below */
- contact = strsep(&contact, ";"); /* trim ; and beyond */
/* Grab host */
host = strchr(contact, '@');
@@ -7812,6 +7810,9 @@
port = atoi(pt);
} else
port = STANDARD_SIP_PORT;
+
+ contact = strsep(&contact, ";"); /* trim ; and beyond in username part */
+ host = strsep(&host, ";"); /* trim ; and beyond in host/domain part */
/* XXX This could block for a long time XXX */
/* We should only do this if it's a name, not an IP */
@@ -8358,7 +8359,7 @@
c = get_in_brackets(tmp);
c = strsep(&c, ";"); /* Ditch ;user=phone */
- if (!strncmp(c, "sip:", 4)) {
+ if (!strncasecmp(c, "sip:", 4)) {
name = c + 4;
} else {
name = c;
@@ -8510,7 +8511,7 @@
if (ast_strlen_zero(tmp))
return 0;
c = get_in_brackets(tmp);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not an RDNIS SIP header (%s)?\n", c);
return -1;
}
@@ -8547,7 +8548,7 @@
uri = get_in_brackets(tmp);
- if (strncmp(uri, "sip:", 4)) {
+ if (strncasecmp(uri, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", uri);
return -1;
}
@@ -8564,7 +8565,7 @@
}
if (!ast_strlen_zero(from)) {
- if (strncmp(from, "sip:", 4)) {
+ if (strncasecmp(from, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header (%s)?\n", from);
return -1;
}
@@ -8866,7 +8867,7 @@
if (pedanticsipchecking)
ast_uri_decode(c);
- if (strncmp(c, "sip:", 4)) {
+ if (strncasecmp(c, "sip:", 4)) {
ast_log(LOG_WARNING, "Huh? Not a SIP header in Also: transfer (%s)?\n", c);
return -1;
}
@@ -9079,7 +9080,7 @@
of = get_in_brackets(from);
if (ast_strlen_zero(p->exten)) {
t = uri2;
- if (!strncmp(t, "sip:", 4))
+ if (!strncasecmp(t, "sip:", 4))
t+= 4;
ast_string_field_set(p, exten, t);
t = strchr(p->exten, '@');
@@ -9090,7 +9091,7 @@
}
/* save the URI part of the From header */
ast_string_field_set(p, from, of);
- if (strncmp(of, "sip:", 4)) {
+ if (strncasecmp(of, "sip:", 4)) {
ast_log(LOG_NOTICE, "From address missing 'sip:', using it anyway\n");
} else
of += 4;
@@ -12352,7 +12353,18 @@
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 {
+ 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);
+ } 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 {
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);
}
@@ -12383,11 +12395,11 @@
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);
}
@@ -17226,7 +17238,7 @@
ast_log(LOG_ERROR, "Cannot retrieve the 'To' header from the original SIP request!\n");
return 0;
}
- if ((localtmp = strstr(tmp, "sip:")) && (localtmp = strchr(localtmp, '@'))) {
+ if ((localtmp = strcasestr(tmp, "sip:")) && (localtmp = strchr(localtmp, '@'))) {
char lhost[80], lport[80];
memset(lhost, 0, sizeof(lhost));
memset(lport, 0, sizeof(lport));
@@ -17248,7 +17260,7 @@
transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq);
sip_scheddestroy(p, 32000); /* Make sure we stop send this reply. */
-
+ sip_alreadygone(p);
return 0;
}
More information about the asterisk-commits
mailing list