[asterisk-commits] tilghman: trunk r219061 - in /trunk: ./ configs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 16 18:42:17 CDT 2009


Author: tilghman
Date: Wed Sep 16 18:42:12 2009
New Revision: 219061

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

........
  r219023 | tilghman | 2009-09-16 18:21:53 -0500 (Wed, 16 Sep 2009) | 8 lines
  
  Properly deal with quotes in the arguments of '#exec' includes.
  (closes issue #15583)
   Reported by: pkempgen
   Patches: 
         20090726__issue15583.diff.txt uploaded by tilghman (license 14)
         20090726__issue15583-1.4-4.diff.txt uploaded by pkempgen (license 169)
   Tested by: pkempgen
........

Modified:
    trunk/   (props changed)
    trunk/configs/extensions.conf.sample
    trunk/main/config.c

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

Modified: trunk/configs/extensions.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configs/extensions.conf.sample?view=diff&rev=219061&r1=219060&r2=219061
==============================================================================
--- trunk/configs/extensions.conf.sample (original)
+++ trunk/configs/extensions.conf.sample Wed Sep 16 18:42:12 2009
@@ -106,6 +106,8 @@
 ; that includes contexts within other contexts. The #include command works
 ; in all asterisk configuration files.
 ;#include "filename.conf"
+;#include <filename.conf>
+;#include filename.conf
 ;
 ; You can execute a program or script that produces config files, and they
 ; will be inserted where you insert the #exec command. The #exec command
@@ -113,6 +115,9 @@
 ; activate them within asterisk.conf with the "execincludes" option.  They
 ; are otherwise considered a security risk.
 ;#exec /opt/bin/build-extra-contexts.sh
+;#exec /opt/bin/build-extra-contexts.sh --foo="bar"
+;#exec </opt/bin/build-extra-contexts.sh --foo="bar">
+;#exec "/opt/bin/build-extra-contexts.sh --foo=\"bar\""
 ;
 
 ; The "Globals" category contains global variables that can be referenced

Modified: trunk/main/config.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/config.c?view=diff&rev=219061&r1=219060&r2=219061
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Wed Sep 16 18:42:12 2009
@@ -1062,18 +1062,28 @@
 			return 0;	/* XXX is this correct ? or we should return -1 ? */
 		}
 
+		cur = c;
 		/* Strip off leading and trailing "'s and <>'s */
-		while ((*c == '<') || (*c == '>') || (*c == '\"')) c++;
-		/* Get rid of leading mess */
-		cur = c;
+		if (*c == '"') {
+			/* Dequote */
+			while (*c) {
+				if (*c == '"') {
+					strcpy(c, c + 1); /* SAFE */
+					c--;
+				} else if (*c == '\\') {
+					strcpy(c, c + 1); /* SAFE */
+				}
+				c++;
+			}
+		} else if (*c == '<') {
+			/* C-style include */
+			if (*(c + strlen(c) - 1) == '>') {
+				cur++;
+				*(c + strlen(c) - 1) = '\0';
+			}
+		}
 		cur2 = cur;
-		while (!ast_strlen_zero(cur)) {
-			c = cur + strlen(cur) - 1;
-			if ((*c == '>') || (*c == '<') || (*c == '\"'))
-				*c = '\0';
-			else
-				break;
-		}
+
 		/* #exec </path/to/executable>
 		   We create a tmp file, then we #include it, then we delete it. */
 		if (!do_include) {




More information about the asterisk-commits mailing list