[Freeswitch-svn] [commit] r13015 - in freeswitch/trunk/src: . include

FreeSWITCH SVN anthm at freeswitch.org
Tue Apr 14 08:24:30 PDT 2009


Author: anthm
Date: Tue Apr 14 10:24:30 2009
New Revision: 13015

Log:
run expand_vars if input contains a special escaped character not just when it contains a variable to eat up back slashes

Modified:
   freeswitch/trunk/src/include/switch_utils.h
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_event.c
   freeswitch/trunk/src/switch_ivr_play_say.c
   freeswitch/trunk/src/switch_utils.c

Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h	(original)
+++ freeswitch/trunk/src/include/switch_utils.h	Tue Apr 14 10:24:30 2009
@@ -87,7 +87,20 @@
 }
 
 
+static inline int switch_string_has_escaped_data(const char *in)
+{
+	const char *i = strchr(in, '\\');
 
+	while (i && *i == '\\') {
+		i++;
+		if (*i == '\\' || *i == 'n' || *i == 's' || *i == 't') {
+			return 1;
+		}
+		i = strchr(i, '\\');
+	}
+	
+	return 0;
+}
 
 SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Tue Apr 14 10:24:30 2009
@@ -1916,7 +1916,7 @@
 		return (char *) in;
 	}
 
-	nv = switch_string_var_check_const(in);
+	nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
 	if (!nv) {
 		return (char *) in;

Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c	(original)
+++ freeswitch/trunk/src/switch_event.c	Tue Apr 14 10:24:30 2009
@@ -1331,7 +1331,7 @@
 	char *func_val = NULL;
 	int nv = 0;
 
-	nv = switch_string_var_check_const(in);
+	nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
 	if (!nv) {
 		return (char *) in;

Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c	(original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c	Tue Apr 14 10:24:30 2009
@@ -1559,6 +1559,7 @@
 				if (switch_strlen_zero(digits_regex)) {
 					return SWITCH_STATUS_SUCCESS;
 				}
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
 				if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
 					return SWITCH_STATUS_SUCCESS;
 				} else {

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Tue Apr 14 10:24:30 2009
@@ -61,7 +61,6 @@
 }
 #endif
 
-
 SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size)
 {
 	switch_frame_t *new_frame;



More information about the Freeswitch-svn mailing list