summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2010-03-31 22:35:20 +0000
committerMark Michelson <mmichelson@digium.com>2010-03-31 22:35:20 +0000
commit284ac3a4d975e8637a0cdb90d343fdd7f0060644 (patch)
tree879df3da5e904dc12e539348a572e11e05d71ca1 /channels/chan_sip.c
parent0511d3c79879fd9c9710e7ecd3652706228c67f4 (diff)
Fix improper comaparison of anonymous URI when getting P-Asserted-Identity.
There was a bug where we split the URI on the @ sign and then attempted to compare to "anonymous@anonymous.invalid" afterwards. This comparison could never evaluate true. So now we keep a copy of the URI prior to the split so that the comparison is valid. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@255701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 9cd0608d9..59ba5dce2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -12172,7 +12172,7 @@ static int get_pai(struct sip_pvt *p, struct sip_request *req)
char *cid_num = "";
char *cid_name = "";
int callingpres = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
- char *start = NULL, *end = NULL;
+ char *start = NULL, *end = NULL, *uri = NULL;
ast_copy_string(pai, get_header(req, "P-Asserted-Identity"), sizeof(pai));
@@ -12193,12 +12193,17 @@ static int get_pai(struct sip_pvt *p, struct sip_request *req)
if (*start != '<')
return 0;
+ /* At this point, 'start' points to the URI in brackets.
+ * We need a copy so that our comparison to the anonymous
+ * URI is valid.
+ */
+ uri = ast_strdupa(start);
*start++ = '\0';
end = strchr(start, '@');
if (!end)
return 0;
*end++ = '\0';
- if (!strncasecmp(start, "anonymous@anonymous.invalid", 27)) {
+ if (!strncasecmp(uri, "anonymous@anonymous.invalid", 27)) {
callingpres = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
/*XXX Assume no change in cid_num. Perhaps it should be
* blanked?