mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 03:48:02 +00:00
remove almost all of the checks of the result from ast_strdupa() or alloca().
As it turns out, all of these checks were useless, because alloca will never return NULL. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -140,12 +140,7 @@ static void isAnsweringMachine(struct ast_channel *chan, void *data)
|
||||
ast_log(LOG_NOTICE, "AMD using the default parameters.\n");
|
||||
} else {
|
||||
/* Some arguments have been passed. Lets parse them and overwrite the defaults. */
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
ast_log(LOG_WARNING, "Memory allocation failure\n");
|
||||
pbx_builtin_setvar_helper(chan , "AMDSTATUS" , "" );
|
||||
pbx_builtin_setvar_helper(chan , "AMDCAUSE" , "" );
|
||||
return;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -123,10 +123,7 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!(argcopy = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
argcopy = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(arglist,argcopy);
|
||||
|
||||
|
||||
@@ -71,10 +71,7 @@ static int deltree_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(argv = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return 0;
|
||||
}
|
||||
argv = ast_strdupa(data);
|
||||
|
||||
if (strchr(argv, '/')) {
|
||||
family = strsep(&argv, "/");
|
||||
@@ -115,10 +112,7 @@ static int del_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(argv = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return 0;
|
||||
}
|
||||
argv = ast_strdupa(data);
|
||||
|
||||
if (strchr(argv, '/')) {
|
||||
family = strsep(&argv, "/");
|
||||
|
||||
@@ -787,8 +787,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
goto done;
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
@@ -1596,8 +1595,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(announce = ast_strdupa(data)))
|
||||
goto done;
|
||||
announce = ast_strdupa(data);
|
||||
|
||||
memset(&peerflags, 0, sizeof(peerflags));
|
||||
|
||||
|
||||
@@ -107,8 +107,7 @@ static int dictate_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
|
||||
if (!ast_strlen_zero(data)) {
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
return -1;
|
||||
parse = ast_strdupa(data);
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
} else
|
||||
args.argc = 0;
|
||||
|
||||
@@ -411,10 +411,7 @@ static int directory_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -158,10 +158,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
|
||||
ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout);
|
||||
ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
|
||||
|
||||
@@ -80,8 +80,7 @@ static char *tryexec_descrip =
|
||||
"The channel variable TRYSTATUS will be set to:\n"
|
||||
" SUCCESS if the application returned zero\n"
|
||||
" FAILED if the application returned non-zero\n"
|
||||
" NOAPP if the application was not found or was not specified\n"
|
||||
" NOMEMORY if there was not enough memory to execute.\n";
|
||||
" NOAPP if the application was not found or was not specified\n";
|
||||
|
||||
static char *app_execif = "ExecIf";
|
||||
static char *execif_synopsis = "Executes dialplan application, conditionally";
|
||||
@@ -104,25 +103,23 @@ static int exec_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
/* Check and parse arguments */
|
||||
if (data) {
|
||||
if ((s = ast_strdupa(data))) {
|
||||
appname = strsep(&s, "(");
|
||||
if (s) {
|
||||
endargs = strrchr(s, ')');
|
||||
if (endargs)
|
||||
*endargs = '\0';
|
||||
pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
|
||||
s = ast_strdupa(data);
|
||||
appname = strsep(&s, "(");
|
||||
if (s) {
|
||||
endargs = strrchr(s, ')');
|
||||
if (endargs)
|
||||
*endargs = '\0';
|
||||
pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
|
||||
}
|
||||
if (appname) {
|
||||
app = pbx_findapp(appname);
|
||||
if (app) {
|
||||
res = pbx_exec(chan, app, args);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
|
||||
res = -1;
|
||||
}
|
||||
if (appname) {
|
||||
app = pbx_findapp(appname);
|
||||
if (app) {
|
||||
res = pbx_exec(chan, app, args);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
|
||||
res = -1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
res = -1;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL_USER_REMOVE(u);
|
||||
@@ -140,27 +137,23 @@ static int tryexec_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
/* Check and parse arguments */
|
||||
if (data) {
|
||||
if ((s = ast_strdupa(data))) {
|
||||
appname = strsep(&s, "(");
|
||||
if (s) {
|
||||
endargs = strrchr(s, ')');
|
||||
if (endargs)
|
||||
*endargs = '\0';
|
||||
pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
|
||||
s = ast_strdupa(data);
|
||||
appname = strsep(&s, "(");
|
||||
if (s) {
|
||||
endargs = strrchr(s, ')');
|
||||
if (endargs)
|
||||
*endargs = '\0';
|
||||
pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
|
||||
}
|
||||
if (appname) {
|
||||
app = pbx_findapp(appname);
|
||||
if (app) {
|
||||
res = pbx_exec(chan, app, args);
|
||||
pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
|
||||
pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
|
||||
}
|
||||
if (appname) {
|
||||
app = pbx_findapp(appname);
|
||||
if (app) {
|
||||
res = pbx_exec(chan, app, args);
|
||||
pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
|
||||
pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOMEMORY");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,10 +171,7 @@ static int execif_exec(struct ast_channel *chan, void *data) {
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(expr = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
expr = ast_strdupa(data);
|
||||
|
||||
if ((myapp = strchr(expr,'|'))) {
|
||||
*myapp = '\0';
|
||||
|
||||
@@ -275,10 +275,7 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(buf = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(lu);
|
||||
return -1;
|
||||
}
|
||||
buf = ast_strdupa(data);
|
||||
|
||||
argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
|
||||
|
||||
@@ -356,11 +356,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
||||
festivalcommand = newfestivalcommand;
|
||||
}
|
||||
|
||||
if (!(data = ast_strdupa(vdata))) {
|
||||
ast_config_destroy(cfg);
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
data = ast_strdupa(vdata);
|
||||
|
||||
intstr = strchr(data, '|');
|
||||
if (intstr) {
|
||||
|
||||
@@ -126,10 +126,7 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(input = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
input = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, input);
|
||||
|
||||
|
||||
@@ -76,10 +76,7 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -338,10 +338,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -137,11 +137,7 @@ static int ospauth_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return(-1);
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
|
||||
@@ -232,11 +228,7 @@ static int osplookup_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return(-1);
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
|
||||
@@ -382,11 +374,7 @@ static int ospnext_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return(-1);
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
|
||||
@@ -506,11 +494,7 @@ static int ospfinished_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return(-1);
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
|
||||
|
||||
@@ -167,10 +167,7 @@ static int page_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
};
|
||||
|
||||
if (!(options = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
options = ast_strdupa(data);
|
||||
|
||||
ast_copy_string(originator, chan->name, sizeof(originator));
|
||||
if ((tmp = strchr(originator, '-')))
|
||||
|
||||
@@ -167,8 +167,6 @@ static int do_say(say_args_t *a, const char *s, const char *options, int depth)
|
||||
a->language = "en"; /* default */
|
||||
ast_log(LOG_WARNING, "try <%s> in <%s>\n", s, a->language);
|
||||
lang = ast_strdupa(a->language);
|
||||
if (!lang) /* no memory! */
|
||||
return -1;
|
||||
for (;;) {
|
||||
for (v = ast_variable_browse(say_cfg, lang); v ; v = v->next) {
|
||||
if (ast_extension_match(v->name, s)) {
|
||||
@@ -401,8 +399,7 @@ static int playback_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(tmp = ast_strdupa(data)))
|
||||
return -1;
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
|
||||
@@ -113,10 +113,7 @@ static int privacy_exec (struct ast_channel *chan, void *data)
|
||||
|
||||
if (!ast_strlen_zero((char *)data))
|
||||
{
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -2769,8 +2769,7 @@ static int pqm_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
return -1;
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
@@ -2822,8 +2821,7 @@ static int upqm_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
return -1;
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
@@ -2877,8 +2875,7 @@ static int rqm_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
return -1;
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
@@ -2942,8 +2939,7 @@ static int aqm_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
return -1;
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
@@ -3029,10 +3025,6 @@ static int queue_exec(struct ast_channel *chan, void *data)
|
||||
}
|
||||
|
||||
parse = ast_strdupa(data);
|
||||
if (!parse) {
|
||||
ast_log(LOG_ERROR, "Out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
LOCAL_USER_ADD(lu);
|
||||
|
||||
@@ -71,10 +71,7 @@ static int random_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(s = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
s = ast_strdupa(data);
|
||||
|
||||
prob = strsep(&s,":");
|
||||
if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
|
||||
|
||||
@@ -115,10 +115,7 @@ static int read_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(argcopy = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
argcopy = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(arglist, argcopy);
|
||||
|
||||
|
||||
@@ -70,10 +70,7 @@ static int readfile_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(s = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
s = ast_strdupa(data);
|
||||
|
||||
varname = strsep(&s, "=");
|
||||
file = strsep(&s, "|");
|
||||
|
||||
@@ -149,16 +149,15 @@ static int realtime_update_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if ((family = ast_strdupa(data))) {
|
||||
if ((colmatch = strchr(family,'|'))) {
|
||||
crop_data(colmatch);
|
||||
if ((value = strchr(colmatch,'|'))) {
|
||||
crop_data(value);
|
||||
if ((newcol = strchr(value,'|'))) {
|
||||
crop_data(newcol);
|
||||
if ((newval = strchr(newcol,'|')))
|
||||
crop_data(newval);
|
||||
}
|
||||
family = ast_strdupa(data);
|
||||
if ((colmatch = strchr(family,'|'))) {
|
||||
crop_data(colmatch);
|
||||
if ((value = strchr(colmatch,'|'))) {
|
||||
crop_data(value);
|
||||
if ((newcol = strchr(value,'|'))) {
|
||||
crop_data(newcol);
|
||||
if ((newval = strchr(newcol,'|')))
|
||||
crop_data(newval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,14 +195,13 @@ static int realtime_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if ((family = ast_strdupa(data))) {
|
||||
if ((colmatch = strchr(family,'|'))) {
|
||||
crop_data(colmatch);
|
||||
if ((value = strchr(colmatch,'|'))) {
|
||||
crop_data(value);
|
||||
if ((prefix = strchr(value,'|')))
|
||||
crop_data(prefix);
|
||||
}
|
||||
family = ast_strdupa(data);
|
||||
if ((colmatch = strchr(family,'|'))) {
|
||||
crop_data(colmatch);
|
||||
if ((value = strchr(colmatch,'|'))) {
|
||||
crop_data(value);
|
||||
if ((prefix = strchr(value,'|')))
|
||||
crop_data(prefix);
|
||||
}
|
||||
}
|
||||
if (! (family && value && colmatch) ) {
|
||||
|
||||
@@ -113,10 +113,7 @@ static int record_exec(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
/* Yay for strsep being easy */
|
||||
if (!(vdata = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
vdata = ast_strdupa(data);
|
||||
|
||||
p = vdata;
|
||||
filename = strsep(&p, "|");
|
||||
|
||||
@@ -84,8 +84,7 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
|
||||
if (!data)
|
||||
return 0;
|
||||
|
||||
if (!(parse = ast_strdupa(data)))
|
||||
return -1;
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
|
||||
@@ -73,10 +73,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(digits = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
digits = ast_strdupa(data);
|
||||
|
||||
if ((to = strchr(digits,'|'))) {
|
||||
*to = '\0';
|
||||
|
||||
@@ -83,12 +83,8 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
|
||||
ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
} else {
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -115,10 +115,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
opt = strchr(tmp, '|');
|
||||
if (opt) {
|
||||
|
||||
@@ -95,10 +95,7 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||
/* Do our thing here */
|
||||
|
||||
/* We need to make a copy of the input string if we are going to modify it! */
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -327,8 +327,7 @@ static int speech_load(struct ast_channel *chan, void *data)
|
||||
struct ast_speech *speech = find_speech(chan);
|
||||
char *argv[2], *args = NULL, *name = NULL, *path = NULL;
|
||||
|
||||
if (!(args = ast_strdupa(data)))
|
||||
return -1;
|
||||
args = ast_strdupa(data);
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
@@ -504,8 +503,7 @@ static int speech_background(struct ast_channel *chan, void *data)
|
||||
struct ast_datastore *datastore = NULL;
|
||||
char *argv[2], *args = NULL, *filename = NULL, tmp[2] = "";
|
||||
|
||||
if (!(args = ast_strdupa(data)))
|
||||
return -1;
|
||||
args = ast_strdupa(data);
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
|
||||
@@ -130,8 +130,7 @@ static int gosubif_exec(struct ast_channel *chan, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(args = ast_strdupa(data)))
|
||||
return -1;
|
||||
args = ast_strdupa(data);
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
|
||||
@@ -86,10 +86,7 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
stringp=tmp;
|
||||
strsep(&stringp, "|");
|
||||
|
||||
@@ -89,12 +89,8 @@ static int transfer_exec(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_REMOVE(u);
|
||||
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
|
||||
return 0;
|
||||
} else {
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
|
||||
@@ -92,10 +92,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(tmp = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
|
||||
stringp=tmp;
|
||||
strsep(&stringp, "|");
|
||||
|
||||
@@ -72,10 +72,7 @@ static int userevent_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(info = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
info = ast_strdupa(data);
|
||||
|
||||
snprintf(eventname, sizeof(eventname), "UserEvent%s", info);
|
||||
eventbody = strchr(eventname, '|');
|
||||
|
||||
@@ -65,34 +65,34 @@ static int verbose_exec(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (data) {
|
||||
if ((vtext = ast_strdupa(data))) {
|
||||
char *tmp = strsep(&vtext, "|");
|
||||
if (vtext) {
|
||||
if (sscanf(tmp, "%d", &vsize) != 1) {
|
||||
vsize = 0;
|
||||
ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
|
||||
}
|
||||
} else {
|
||||
vtext = tmp;
|
||||
char *tmp;
|
||||
vtext = ast_strdupa(data);
|
||||
tmp = strsep(&vtext, "|");
|
||||
if (vtext) {
|
||||
if (sscanf(tmp, "%d", &vsize) != 1) {
|
||||
vsize = 0;
|
||||
ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
|
||||
}
|
||||
if (option_verbose >= vsize) {
|
||||
switch (vsize) {
|
||||
case 0:
|
||||
ast_verbose("%s\n", vtext);
|
||||
break;
|
||||
case 1:
|
||||
ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
|
||||
break;
|
||||
case 2:
|
||||
ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
|
||||
break;
|
||||
case 3:
|
||||
ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
|
||||
break;
|
||||
default:
|
||||
ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
|
||||
}
|
||||
} else {
|
||||
vtext = tmp;
|
||||
vsize = 0;
|
||||
}
|
||||
if (option_verbose >= vsize) {
|
||||
switch (vsize) {
|
||||
case 0:
|
||||
ast_verbose("%s\n", vtext);
|
||||
break;
|
||||
case 1:
|
||||
ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
|
||||
break;
|
||||
case 2:
|
||||
ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
|
||||
break;
|
||||
case 3:
|
||||
ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
|
||||
break;
|
||||
default:
|
||||
ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,10 +115,7 @@ static int log_exec(struct ast_channel *chan, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(ltext = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return 0;
|
||||
}
|
||||
ltext = ast_strdupa(data);
|
||||
|
||||
level = strsep(<ext, "|");
|
||||
|
||||
|
||||
@@ -3368,25 +3368,24 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
||||
}
|
||||
|
||||
/* Attach only the first format */
|
||||
if ((fmt = ast_strdupa(fmt))) {
|
||||
stringp = fmt;
|
||||
strsep(&stringp, "|");
|
||||
fmt = ast_strdupa(fmt);
|
||||
stringp = fmt;
|
||||
strsep(&stringp, "|");
|
||||
|
||||
if (!ast_strlen_zero(vmu->email)) {
|
||||
int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
|
||||
char *myserveremail = serveremail;
|
||||
attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
|
||||
if (!ast_strlen_zero(vmu->serveremail))
|
||||
myserveremail = vmu->serveremail;
|
||||
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
|
||||
}
|
||||
if (!ast_strlen_zero(vmu->email)) {
|
||||
int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
|
||||
char *myserveremail = serveremail;
|
||||
attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
|
||||
if (!ast_strlen_zero(vmu->serveremail))
|
||||
myserveremail = vmu->serveremail;
|
||||
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
|
||||
}
|
||||
|
||||
if (!ast_strlen_zero(vmu->pager)) {
|
||||
char *myserveremail = serveremail;
|
||||
if (!ast_strlen_zero(vmu->serveremail))
|
||||
myserveremail = vmu->serveremail;
|
||||
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
|
||||
}
|
||||
if (!ast_strlen_zero(vmu->pager)) {
|
||||
char *myserveremail = serveremail;
|
||||
if (!ast_strlen_zero(vmu->serveremail))
|
||||
myserveremail = vmu->serveremail;
|
||||
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
|
||||
}
|
||||
|
||||
if (ast_test_flag(vmu, VM_DELETE)) {
|
||||
@@ -5356,10 +5355,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
AST_APP_ARG(argv1);
|
||||
);
|
||||
|
||||
if (!(parse = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
parse = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, parse);
|
||||
|
||||
@@ -5826,12 +5822,7 @@ static int vm_exec(struct ast_channel *chan, void *data)
|
||||
ast_answer(chan);
|
||||
|
||||
if (!ast_strlen_zero(data)) {
|
||||
tmp = ast_strdupa((char *)data);
|
||||
if (!tmp) {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
tmp = ast_strdupa(data);
|
||||
AST_STANDARD_APP_ARGS(args, tmp);
|
||||
if (args.argc == 2) {
|
||||
if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) {
|
||||
@@ -5958,10 +5949,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(box = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
box = ast_strdupa(data);
|
||||
|
||||
AST_STANDARD_APP_ARGS(args, box);
|
||||
|
||||
@@ -5998,8 +5986,7 @@ static int vmauthenticate(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (s) {
|
||||
if (!(s = ast_strdupa(s)))
|
||||
return -1;
|
||||
s = ast_strdupa(s);
|
||||
user = strsep(&s, "|");
|
||||
options = strsep(&s, "|");
|
||||
if (user) {
|
||||
@@ -6471,24 +6458,21 @@ static int load_config(void)
|
||||
struct vm_zone *z;
|
||||
if ((z = ast_malloc(sizeof(*z)))) {
|
||||
char *msg_format, *timezone;
|
||||
if ((msg_format = ast_strdupa(var->value))) {
|
||||
timezone = strsep(&msg_format, "|");
|
||||
if (msg_format) {
|
||||
ast_copy_string(z->name, var->name, sizeof(z->name));
|
||||
ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
|
||||
ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
|
||||
AST_LIST_LOCK(&zones);
|
||||
AST_LIST_INSERT_HEAD(&zones, z, list);
|
||||
AST_LIST_UNLOCK(&zones);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
|
||||
free(z);
|
||||
}
|
||||
msg_format = ast_strdupa(var->value);
|
||||
timezone = strsep(&msg_format, "|");
|
||||
if (msg_format) {
|
||||
ast_copy_string(z->name, var->name, sizeof(z->name));
|
||||
ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
|
||||
ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
|
||||
AST_LIST_LOCK(&zones);
|
||||
AST_LIST_INSERT_HEAD(&zones, z, list);
|
||||
AST_LIST_UNLOCK(&zones);
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
|
||||
free(z);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
free(z);
|
||||
return -1;
|
||||
}
|
||||
var = var->next;
|
||||
|
||||
@@ -202,9 +202,8 @@ static int _while_exec(struct ast_channel *chan, void *data, int end)
|
||||
snprintf(used_index, VAR_SIZE, "%d", used_index_i);
|
||||
snprintf(new_index, VAR_SIZE, "%d", used_index_i + 1);
|
||||
|
||||
if (!end) {
|
||||
condition = ast_strdupa((char *) data);
|
||||
}
|
||||
if (!end)
|
||||
condition = ast_strdupa(data);
|
||||
|
||||
size = strlen(chan->context) + strlen(chan->exten) + 32;
|
||||
my_name = alloca(size);
|
||||
|
||||
@@ -215,10 +215,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
if (!(args = ast_strdupa(data))) {
|
||||
LOCAL_USER_REMOVE(u);
|
||||
return -1;
|
||||
}
|
||||
args = ast_strdupa(data);
|
||||
|
||||
/* Answer the channel if it's not up */
|
||||
if (chan->_state != AST_STATE_UP)
|
||||
|
||||
@@ -307,7 +307,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
||||
if (chan->_state != AST_STATE_UP)
|
||||
ast_answer(chan);
|
||||
|
||||
desired_group = ast_strdupa((char *) data);
|
||||
desired_group = ast_strdupa(data);
|
||||
if(!ast_strlen_zero(desired_group)) {
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Scanning for group %s\n", desired_group);
|
||||
search_group = 1;
|
||||
|
||||
Reference in New Issue
Block a user