[asterisk-commits] dvossel: branch dvossel/sip_uri_encode_decode r243159 - /team/dvossel/sip_uri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 26 10:11:32 CST 2010


Author: dvossel
Date: Tue Jan 26 10:11:28 2010
New Revision: 243159

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=243159
Log:
addition of check for addr-spec in get_calleridname

Modified:
    team/dvossel/sip_uri_encode_decode/channels/chan_sip.c

Modified: team/dvossel/sip_uri_encode_decode/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_uri_encode_decode/channels/chan_sip.c?view=diff&rev=243159&r1=243158&r2=243159
==============================================================================
--- team/dvossel/sip_uri_encode_decode/channels/chan_sip.c (original)
+++ team/dvossel/sip_uri_encode_decode/channels/chan_sip.c Tue Jan 26 10:11:28 2010
@@ -14599,7 +14599,7 @@
 
 		/* if this is successful, input should be at the ending quote */
 		if (!input || *input != '"') {
-			ast_log(LOG_WARNING, "No ending quote for display-name was found");
+			ast_log(LOG_WARNING, "No ending quote for display-name was found\n");
 			*orig_output = '\0';
 			return orig_input;
 		}
@@ -14622,7 +14622,11 @@
 			} else if (*input == '<') {   /* end of tokenLWS-combo */
 				/* we could assert that the previous char is LWS, but we don't care */
 				break;
-			} else {         /* else, invalid */
+			} else if (*input == ':') {
+				/* This invalid character which indicates this is addr-spec rather than display-name. */
+				*orig_output = '\0';
+				return orig_input;
+			} else {         /* else, invalid character we can skip. */
 				continue;    /* skip this character */
 			}
 		}
@@ -14643,6 +14647,7 @@
 	const char *in2 = " token text with no quotes <stuff>";
 	const char *overflow1 = " \"quoted-text overflow 1234567890123456789012345678901234567890\" <stuff>";
 	const char *noendquote = " \"quoted-text no end <stuff>";
+	const char *addrspec = " \"sip:blah at blah <stuff>";
 	const char *after_dname;
 	char dname[40];
 
@@ -14662,7 +14667,7 @@
 	ast_test_status_update(&args->status_update, "display-name1: %s\nafter: %s\n", dname, after_dname);
 	if (strcmp(dname, " quoted-text internal \" quote ")) {
 		ast_test_status_update(&args->status_update, "display-name1 test failed\n");
-		ast_str_append(&args->ast_test_error_str, 0, "quoted-text with internal backslash decode failed: \n");
+		ast_str_append(&args->ast_test_error_str, 0, "quoted-text with internal backslash decode failed. \n");
 		res = AST_TEST_FAIL;
 	}
 
@@ -14671,7 +14676,7 @@
 	ast_test_status_update(&args->status_update, "display-name2: %s\nafter: %s\n", dname, after_dname);
 	if (strcmp(dname, "token text with no quotes")) {
 		ast_test_status_update(&args->status_update, "display-name2 test failed\n");
-		ast_str_append(&args->ast_test_error_str, 0, "token text with decode failed: \n");
+		ast_str_append(&args->ast_test_error_str, 0, "token text with decode failed. \n");
 		res = AST_TEST_FAIL;
 	}
 
@@ -14680,7 +14685,7 @@
 	ast_test_status_update(&args->status_update, "overflow display-name1: %s\nafter: %s\n", dname, after_dname);
 	if (*dname != '\0' && after_dname != overflow1) {
 		ast_test_status_update(&args->status_update, "overflow display-name1 test failed\n");
-		ast_str_append(&args->ast_test_error_str, 0, "quoted-text buffer overflow check failed: \n");
+		ast_str_append(&args->ast_test_error_str, 0, "quoted-text buffer overflow check failed. \n");
 		res = AST_TEST_FAIL;
 	}
 
@@ -14692,6 +14697,17 @@
 		ast_str_append(&args->ast_test_error_str, 0, "quoted-text buffer check no terminating end quote failed. \n");
 		res = AST_TEST_FAIL;
 	}
+
+	/* addr-spec rather than display-name. */
+	after_dname = get_calleridname(addrspec, dname, sizeof(dname));
+	ast_test_status_update(&args->status_update, "noendquote display-name1: %s\nafter: %s\n", dname, after_dname);
+	if (*dname != '\0' && after_dname != addrspec) {
+		ast_test_status_update(&args->status_update, "detection of addr-spec failed\n");
+		ast_str_append(&args->ast_test_error_str, 0, "detection of addr-spec failed. \n");
+		res = AST_TEST_FAIL;
+	}
+
+
 	return res;
 }
 




More information about the asterisk-commits mailing list