[asterisk-commits] russell: trunk r101694 - in /trunk: ./ channels/chan_iax2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 31 18:34:12 CST 2008


Author: russell
Date: Thu Jan 31 18:34:11 2008
New Revision: 101694

URL: http://svn.digium.com/view/asterisk?view=rev&rev=101694
Log:
Merged revisions 101693 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r101693 | russell | 2008-01-31 18:32:49 -0600 (Thu, 31 Jan 2008) | 8 lines

Add some more sanity checking on IAX2 dial strings for the case that no peer
or hostname was provided, which is the one part of the dial string that is
absolutely required.  If it's not there, bail out.

(closes issue #11897)
Reported by sokhapkin
Patch by me

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_iax2.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=101694&r1=101693&r2=101694
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Thu Jan 31 18:34:11 2008
@@ -3368,6 +3368,11 @@
 	memset(&pds, 0, sizeof(pds));
 	tmpstr = ast_strdupa(dest);
 	parse_dial_string(tmpstr, &pds);
+
+	if (ast_strlen_zero(pds.peer)) {
+		ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", dest);
+		return -1;
+	}
 
 	if (!pds.exten)
 		pds.exten = defaultrdest;
@@ -9503,16 +9508,15 @@
 	tmpstr = ast_strdupa(data);
 	parse_dial_string(tmpstr, &pds);
 
+	if (ast_strlen_zero(pds.peer)) {
+		ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data);
+		return NULL;
+	}
+	       
 	memset(&cai, 0, sizeof(cai));
 	cai.capability = iax2_capability;
 
 	ast_copy_flags(&cai, &globalflags, IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);
-
-	if (!pds.peer) {
-		ast_log(LOG_WARNING, "No peer given\n");
-		return NULL;
-	}
-	       
 	
 	/* Populate our address from the given */
 	if (create_addr(pds.peer, NULL, &sin, &cai)) {
@@ -10881,6 +10885,11 @@
 	tmpstr = ast_strdupa(data);
 	parse_dial_string(tmpstr, &pds);
 
+	if (ast_strlen_zero(pds.peer)) {
+		ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", data);
+		return -1;
+	}
+
 	/* Populate our address from the given */
 	if (create_addr(pds.peer, NULL, &sin, &cai))
 		return -1;
@@ -11319,8 +11328,11 @@
 
 	memset(&pds, 0, sizeof(pds));
 	parse_dial_string(tmp, &pds);
-	if (ast_strlen_zero(pds.peer))
+
+	if (ast_strlen_zero(pds.peer)) {
+		ast_log(LOG_WARNING, "No peer provided in the IAX2 dial string '%s'\n", (char *) data);
 		return res;
+	}
 	
 	ast_debug(3, "Checking device state for device %s\n", pds.peer);
 




More information about the asterisk-commits mailing list