FS-5449: --resolve add a mod_commands function to use the shell escape function and update the existing function to use correct escaping

adds a pool based implementation of the switch_util_quote_shell_arg function and changes existing function to be a wrapper around the pool based one
This commit is contained in:
Nathan Neulinger
2013-05-31 16:25:08 -05:00
parent 5a8c753b9e
commit 634a507546
3 changed files with 58 additions and 14 deletions
+10 -1
View File
@@ -910,10 +910,19 @@ SWITCH_DECLARE(int) switch_strcasecmp_any(const char *str, ...);
/*!
\brief Quote shell argument
\param string the string to quote (example: a ' b"' c)
\return the quoted string (gives: 'a '\'' b"'\'' c' for unices, "a ' b ' c" for MS Windows)
\return the quoted string (gives: 'a '\'' b"'\'' c' for unices, "a ' b ' c" for MS Windows), should be freed
*/
SWITCH_DECLARE(char *) switch_util_quote_shell_arg(const char *string);
/*!
\brief Quote shell argument, allocating from pool if provided
\param string the string to quote (example: a ' b"' c)
\param pool a memory pool to use
\return the quoted string (gives: 'a '\'' b"'\'' c' for unices, "a ' b ' c" for MS Windows), if pool not provided, returned value should be freed
*/
SWITCH_DECLARE(char *) switch_util_quote_shell_arg_pool(const char *string, switch_memory_pool_t *pool);
#define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK)
SWITCH_DECLARE(char *) switch_url_encode(const char *url, char *buf, size_t len);
SWITCH_DECLARE(char *) switch_url_decode(char *s);