mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-10 20:08:16 +00:00
Merged revisions 177664 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r177664 | tilghman | 2009-02-20 11:29:51 -0600 (Fri, 20 Feb 2009) | 8 lines Allow semicolons to be escaped, when passing arguments to the System command. (closes issue #14231) Reported by: jcovert Patches: 20090113__bug14231__2.diff.txt uploaded by Corydon76 (license 14) corrected_20090113__bug14231__2.diff.txt uploaded by jcovert (license 551) Tested by: jcovert ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@177761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -33,6 +33,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/app.h"
|
||||
#include "asterisk/channel.h" /* autoservice */
|
||||
#include "asterisk/strings.h"
|
||||
#include "asterisk/threadstorage.h"
|
||||
|
||||
AST_THREADSTORAGE(buf_buf);
|
||||
|
||||
static char *app = "System";
|
||||
|
||||
@@ -62,6 +66,7 @@ static char *descrip2 =
|
||||
static int system_exec_helper(struct ast_channel *chan, void *data, int failmode)
|
||||
{
|
||||
int res = 0;
|
||||
struct ast_str *buf = ast_str_thread_get(&buf_buf, 16);
|
||||
|
||||
if (ast_strlen_zero(data)) {
|
||||
ast_log(LOG_WARNING, "System requires an argument(command)\n");
|
||||
@@ -72,7 +77,9 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode
|
||||
ast_autoservice_start(chan);
|
||||
|
||||
/* Do our thing here */
|
||||
res = ast_safe_system((char *)data);
|
||||
ast_str_get_encoded_str(&buf, 0, (char *) data);
|
||||
res = ast_safe_system(ast_str_buffer(buf));
|
||||
|
||||
if ((res < 0) && (errno != ECHILD)) {
|
||||
ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data);
|
||||
pbx_builtin_setvar_helper(chan, chanvar, "FAILURE");
|
||||
|
||||
Reference in New Issue
Block a user