aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-31 19:16:52 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-31 19:16:52 +0000
commitf07800e50e429d0d0ec88eeaad920c8d32d6974b (patch)
treeff01c5df43b2e734994ebe51a329b49d3a7b59fd /funcs
parent11da624772129e0c69296e98daca06547c35e7a6 (diff)
The IF() function was not allowing true values that had embedded colons (closes issue #10613)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@81415 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_logic.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/funcs/func_logic.c b/funcs/func_logic.c
index daf50142f..0463f8e73 100644
--- a/funcs/func_logic.c
+++ b/funcs/func_logic.c
@@ -91,27 +91,30 @@ static int iftime(struct ast_channel *chan, char *cmd, char *data, char *buf,
static int acf_if(struct ast_channel *chan, char *cmd, char *data, char *buf,
size_t len)
{
- char *expr;
- char *iftrue;
- char *iffalse;
-
- data = ast_strip_quoted(data, "\"", "\"");
- expr = strsep(&data, "?");
- iftrue = strsep(&data, ":");
- iffalse = data;
-
- if (ast_strlen_zero(expr) || !(iftrue || iffalse)) {
+ AST_DECLARE_APP_ARGS(args1,
+ AST_APP_ARG(expr);
+ AST_APP_ARG(remainder);
+ );
+ AST_DECLARE_APP_ARGS(args2,
+ AST_APP_ARG(iftrue);
+ AST_APP_ARG(iffalse);
+ );
+
+ AST_NONSTANDARD_APP_ARGS(args1, data, '?');
+ AST_NONSTANDARD_APP_ARGS(args2, args1.remainder, ':');
+
+ if (ast_strlen_zero(args1.expr) || !(args2.iftrue || args2.iffalse)) {
ast_log(LOG_WARNING, "Syntax IF(<expr>?[<true>][:<false>])\n");
return -1;
}
- expr = ast_strip(expr);
- if (iftrue)
- iftrue = ast_strip_quoted(iftrue, "\"", "\"");
- if (iffalse)
- iffalse = ast_strip_quoted(iffalse, "\"", "\"");
+ args1.expr = ast_strip(args1.expr);
+ if (args2.iftrue)
+ args2.iftrue = ast_strip(args2.iftrue);
+ if (args2.iffalse)
+ args2.iffalse = ast_strip(args2.iffalse);
- ast_copy_string(buf, pbx_checkcondition(expr) ? (S_OR(iftrue, "")) : (S_OR(iffalse, "")), len);
+ ast_copy_string(buf, pbx_checkcondition(args1.expr) ? (S_OR(args2.iftrue, "")) : (S_OR(args2.iffalse, "")), len);
return 0;
}