]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
beastie
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 22 Jan 2009 03:42:22 +0000 (03:42 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 22 Jan 2009 03:42:22 +0000 (03:42 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11352 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_utils.h
src/switch_caller.c
src/switch_channel.c

index 9cc5418fd19ece343d385d74ba583377d553d523..09707a0e90c9e9eda690343885d3d1ad22d76a2e 100644 (file)
@@ -305,6 +305,31 @@ static inline switch_bool_t switch_string_var_check(char *s, switch_bool_t disab
 }
 
 
+static inline switch_bool_t switch_string_var_check_const(const char *s)
+{
+    const char *p;
+       int dol = 0;
+
+    for (p = s; p && *p; p++) {
+        if (*p == '$') {
+            dol = 1;
+        } else if (dol) {
+            if (*p == '{') {
+                                       return SWITCH_TRUE;
+            } else if (*p != '\\') {
+                dol = 0;
+            }
+        }
+    }
+    return SWITCH_FALSE;
+}
+
+static inline char *switch_var_clean_string(char *s)
+{
+       switch_string_var_check(s, SWITCH_TRUE);
+       return s;
+}
+
 static inline char *switch_clean_string(char *s)
 {
        char *p;
index cf8704e173fe166ab88238380e16933ff0896999..855f1521085a118509dff328590f8efd3330dcf6 100644 (file)
@@ -34,7 +34,7 @@
 #include <switch_caller.h>
 
 #define profile_dup(a,b,p) if (!switch_strlen_zero(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
-#define profile_dup_clean(a,b,p) if (!switch_strlen_zero(a)) { b = switch_clean_string(switch_core_strdup(p, a)); switch_string_var_check( (char *) b , SWITCH_TRUE);} else { b = SWITCH_BLANK_STRING; }
+#define profile_dup_clean(a,b,p) if (!switch_strlen_zero(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
 
 SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
                                                                                                                                        const char *username,
index e2432ec0b537a27f8436386f8605fed8112692c4..cd7800d36609007cbda5f186b21ff6e73958f2c1 100644 (file)
@@ -584,9 +584,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_cha
                switch_event_del_header(channel->variables, varname);
                if (!switch_strlen_zero(value)) {
                        int ok = 1;
-
+                       
                        if (var_check) {
-                               ok = !switch_string_var_check((char *)value, SWITCH_FALSE);
+                               ok = !switch_string_var_check_const(value);
                        }
                        if (ok) {
                                switch_event_add_header_string(channel->variables, SWITCH_STACK_BOTTOM, varname, value);