dect
/
asterisk
Archived
13
0
Fork 0

In compat14 mode, don't translate pipes inside expressions, as they aren't

argument delimiters, but rather 'or' symbols.
(Closes issue #12723)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@118300 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
tilghman 2008-05-27 13:13:17 +00:00
parent 0fc5cd015e
commit 6705ac3b96
1 changed files with 10 additions and 1 deletions

View File

@ -181,17 +181,26 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
else if (!strcasecmp(v->name, "appdata")) { else if (!strcasecmp(v->name, "appdata")) {
if (!compat16) { if (!compat16) {
char *ptr; char *ptr;
int in = 0;
tmp = alloca(strlen(v->value) * 2 + 1); tmp = alloca(strlen(v->value) * 2 + 1);
for (ptr = tmp; *v->value; v->value++) { for (ptr = tmp; *v->value; v->value++) {
if (*v->value == ',') { if (*v->value == ',') {
*ptr++ = '\\'; *ptr++ = '\\';
*ptr++ = ','; *ptr++ = ',';
} else if (*v->value == '|') { } else if (*v->value == '|' && !in) {
*ptr++ = ','; *ptr++ = ',';
} else { } else {
*ptr++ = *v->value; *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 { } else {
tmp = ast_strdupa(v->value); tmp = ast_strdupa(v->value);
} }