[asterisk-commits] mmichelson: trunk r255701 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 31 17:35:24 CDT 2010


Author: mmichelson
Date: Wed Mar 31 17:35:20 2010
New Revision: 255701

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=255701
Log:
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 at 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.


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=255701&r1=255700&r2=255701
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Mar 31 17:35:20 2010
@@ -12172,7 +12172,7 @@
 	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 @@
 
 	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 at anonymous.invalid", 27)) {
+	if (!strncasecmp(uri, "anonymous at anonymous.invalid", 27)) {
 		callingpres = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
 		/*XXX Assume no change in cid_num. Perhaps it should be
 		 * blanked?




More information about the asterisk-commits mailing list