]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Allow application arguments to be quoted, allowing '|' characters inside arguments
authorTilghman Lesher <tilghman@meg.abyt.es>
Sun, 15 Jan 2006 18:02:46 +0000 (18:02 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Sun, 15 Jan 2006 18:02:46 +0000 (18:02 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8079 65c4cc65-6c06-0410-ace0-fbb531ad65f3

app.c

diff --git a/app.c b/app.c
index 18c2ab0434d614995e59cfc31c51cc5aea26bc23..88d698f53ce69d618e0414e1e2397e753035e939 100644 (file)
--- a/app.c
+++ b/app.c
@@ -1109,7 +1109,7 @@ unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arra
 {
        int argc;
        char *scan;
-       int paren = 0;
+       int paren = 0, quote = 0;
 
        if (!buf || !array || !arraylen)
                return 0;
@@ -1126,7 +1126,15 @@ unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arra
                        else if (*scan == ')') {
                                if (paren)
                                        paren--;
-                       } else if ((*scan == delim) && !paren) {
+                       } else if (*scan == '"') {
+                               quote = quote ? 0 : 1;
+                               /* Remove quote character from argument */
+                               memmove(scan, scan + 1, strlen(scan));
+                               scan--;
+                       } else if (*scan == '\\') {
+                               /* Literal character, don't parse */
+                               memmove(scan, scan + 1, strlen(scan));
+                       } else if ((*scan == delim) && !paren && !quote) {
                                *scan++ = '\0';
                                break;
                        }