[asterisk-commits] tilghman: trunk r118300 - /trunk/pbx/pbx_realtime.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 27 08:13:19 CDT 2008


Author: tilghman
Date: Tue May 27 08:13:17 2008
New Revision: 118300

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118300
Log:
In compat14 mode, don't translate pipes inside expressions, as they aren't
argument delimiters, but rather 'or' symbols.
(Closes issue #12723)

Modified:
    trunk/pbx/pbx_realtime.c

Modified: trunk/pbx/pbx_realtime.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_realtime.c?view=diff&rev=118300&r1=118299&r2=118300
==============================================================================
--- trunk/pbx/pbx_realtime.c (original)
+++ trunk/pbx/pbx_realtime.c Tue May 27 08:13:17 2008
@@ -181,17 +181,26 @@
 			else if (!strcasecmp(v->name, "appdata")) {
 				if (!compat16) {
 					char *ptr;
+					int in = 0;
 					tmp = alloca(strlen(v->value) * 2 + 1);
 					for (ptr = tmp; *v->value; v->value++) {
 						if (*v->value == ',') {
 							*ptr++ = '\\';
 							*ptr++ = ',';
-						} else if (*v->value == '|') {
+						} else if (*v->value == '|' && !in) {
 							*ptr++ = ',';
 						} else {
 							*ptr++ = *v->value;
 						}
+
+						/* Don't escape '|', meaning 'or', inside expressions ($[ ]) */
+						if (v->value[0] == '[' && v->value[-1] == '$') {
+							in++;
+						} else if (v->value[0] == ']' && in) {
+							in--;
+						}
 					}
+					*ptr = '\0';
 				} else {
 					tmp = ast_strdupa(v->value);
 				}




More information about the asterisk-commits mailing list