diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_alarmreceiver.c | 3 | ||||
-rw-r--r-- | apps/app_amd.c | 6 | ||||
-rw-r--r-- | apps/app_directory.c | 8 | ||||
-rw-r--r-- | apps/app_festival.c | 7 | ||||
-rw-r--r-- | apps/app_followme.c | 6 | ||||
-rw-r--r-- | apps/app_meetme.c | 19 | ||||
-rw-r--r-- | apps/app_minivm.c | 6 | ||||
-rw-r--r-- | apps/app_osplookup.c | 6 | ||||
-rw-r--r-- | apps/app_playback.c | 8 | ||||
-rw-r--r-- | apps/app_queue.c | 9 | ||||
-rw-r--r-- | apps/app_rpt.c | 6 | ||||
-rw-r--r-- | apps/app_voicemail.c | 32 |
12 files changed, 92 insertions, 24 deletions
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index 37d817742..db76bbdb7 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -639,6 +639,9 @@ static int load_config(void) if (!cfg) { ast_verb(4, "AlarmReceiver: No config file\n"); return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file %s is in an invalid format. Aborting.\n", ALMRCV_CONFIG); + return 0; } else { p = ast_variable_retrieve(cfg, "general", "eventcmd"); if (p) { diff --git a/apps/app_amd.c b/apps/app_amd.c index 131cd01fd..81298f400 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -376,8 +376,12 @@ static int load_config(int reload) if (!(cfg = ast_config_load("amd.conf", config_flags))) { ast_log(LOG_ERROR, "Configuration file amd.conf missing.\n"); return -1; - } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file amd.conf is in an invalid format. Aborting.\n"); + return -1; + } cat = ast_category_browse(cfg, NULL); diff --git a/apps/app_directory.c b/apps/app_directory.c index 59a82a238..69523ec65 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -362,6 +362,9 @@ static struct ast_config *realtime_directory(char *context) /* Loading config failed. */ ast_log(LOG_WARNING, "Loading config failed.\n"); return NULL; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file %s is in an invalid format. Aborting.\n", VOICEMAIL_CONFIG); + return NULL; } /* Get realtime entries, categorized by their mailbox number @@ -670,7 +673,10 @@ static int directory_exec(struct ast_channel *chan, void *data) return -1; } - ucfg = ast_config_load("users.conf", config_flags); + if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file users.conf is in an invalid format. Aborting.\n"); + ucfg = NULL; + } dirintro = ast_variable_retrieve(cfg, args.vmcontext, "directoryintro"); if (ast_strlen_zero(dirintro)) diff --git a/apps/app_festival.c b/apps/app_festival.c index d9659ebef..4a929a3e5 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -300,7 +300,11 @@ static int festival_exec(struct ast_channel *chan, void *vdata) if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG); return -1; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n"); + return -1; } + if (!(host = ast_variable_retrieve(cfg, "general", "host"))) { host = "localhost"; } @@ -517,6 +521,9 @@ static int load_module(void) if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG); return AST_MODULE_LOAD_DECLINE; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " FESTIVAL_CONFIG " is in an invalid format. Aborting.\n"); + return AST_MODULE_LOAD_DECLINE; } ast_config_destroy(cfg); return ast_register_application(app, festival_exec, synopsis, descrip); diff --git a/apps/app_followme.c b/apps/app_followme.c index 0e23acbff..7a4b1fdc3 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -293,8 +293,12 @@ static int reload_followme(int reload) if (!(cfg = ast_config_load("followme.conf", config_flags))) { ast_log(LOG_WARNING, "No follow me config file (followme.conf), so no follow me\n"); return 0; - } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file followme.conf is in an invalid format. Aborting.\n"); + return 0; + } AST_RWLIST_WRLOCK(&followmes); diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 823b74efc..9ca81eb08 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2921,6 +2921,9 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, if (!cfg) { ast_log(LOG_WARNING, "No %s file :(\n", CONFIG_FILE_NAME); return NULL; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " CONFIG_FILE_NAME " is in an invalid format. Aborting.\n"); + return NULL; } for (var = ast_variable_browse(cfg, "rooms"); var; var = var->next) { if (strcasecmp(var->name, "conf")) @@ -3083,7 +3086,7 @@ static int conf_exec(struct ast_channel *chan, void *data) /* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */ if ((empty_no_pin) || (!dynamic)) { cfg = ast_config_load(CONFIG_FILE_NAME, config_flags); - if (cfg) { + if (cfg && cfg != CONFIG_STATUS_FILEINVALID) { var = ast_variable_browse(cfg, "rooms"); while (var) { if (!strcasecmp(var->name, "conf")) { @@ -3729,8 +3732,12 @@ static void load_config_meetme(void) struct ast_flags config_flags = { 0 }; const char *val; - if (!(cfg = ast_config_load(CONFIG_FILE_NAME, config_flags))) + if (!(cfg = ast_config_load(CONFIG_FILE_NAME, config_flags))) { + return; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " CONFIG_FILE_NAME " is in an invalid format. Aborting.\n"); return; + } audio_buffers = DEFAULT_AUDIO_BUFFERS; @@ -5558,10 +5565,14 @@ static int sla_load_config(int reload) ast_cond_init(&sla.cond, NULL); } - if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags))) + if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags))) { return 0; /* Treat no config as normal */ - else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " SLA_CONFIG_FILE " is in an invalid format. Aborting.\n"); + return 0; + } if ((val = ast_variable_retrieve(cfg, "general", "attemptcallerid"))) sla.attempt_callerid = ast_true(val); diff --git a/apps/app_minivm.c b/apps/app_minivm.c index 4aed1528e..c151068df 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -2363,8 +2363,12 @@ static int load_config(int reload) struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags); - if (cfg == CONFIG_STATUS_FILEUNCHANGED) + if (cfg == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " VOICEMAIL_CONFIG " is in an invalid format. Aborting.\n"); + return 0; + } ast_mutex_lock(&minivmlock); diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 93968ccee..34ddc05a8 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -1776,8 +1776,12 @@ static int osp_load(int reload) struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; int error = OSPC_ERR_NO_ERROR; - if ((cfg = ast_config_load(OSP_CONFIG_FILE, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + if ((cfg = ast_config_load(OSP_CONFIG_FILE, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " OSP_CONFIG_FILE " is in an invalid format. Aborting.\n"); + return 0; + } if (cfg) { if (reload) diff --git a/apps/app_playback.c b/apps/app_playback.c index 356d325b4..b905a9335 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -461,8 +461,12 @@ static int reload(void) struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED }; struct ast_config *newcfg; - if ((newcfg = ast_config_load("say.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + if ((newcfg = ast_config_load("say.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (newcfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file say.conf is in an invalid format. Aborting.\n"); + return 0; + } if (say_cfg) { ast_config_destroy(say_cfg); @@ -506,7 +510,7 @@ static int load_module(void) struct ast_flags config_flags = { 0 }; say_cfg = ast_config_load("say.conf", config_flags); - if (say_cfg) { + if (say_cfg && say_cfg != CONFIG_STATUS_FILEINVALID) { for (v = ast_variable_browse(say_cfg, "general"); v ; v = v->next) { if (ast_extension_match(v->name, "mode")) { say_init_mode(v->value); diff --git a/apps/app_queue.c b/apps/app_queue.c index 3f9c9c625..4f6d160ea 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -5135,6 +5135,9 @@ static int reload_queue_rules(int reload) } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { ast_log(LOG_NOTICE, "queuerules.conf has not changed since it was last loaded. Not taking any action.\n"); return AST_MODULE_LOAD_SUCCESS; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file queuerules.conf is in an invalid format. Aborting.\n"); + return AST_MODULE_LOAD_SUCCESS; } else { AST_LIST_LOCK(&rule_lists); while ((rl_iter = AST_LIST_REMOVE_HEAD(&rule_lists, list))) { @@ -5196,8 +5199,12 @@ static int reload_queues(int reload) if (!(cfg = ast_config_load("queues.conf", config_flags))) { ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n"); return 0; - } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { + return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file queues.conf is in an invalid format. Aborting.\n"); return 0; + } ao2_lock(queues); use_weight=0; /* Mark all queues as dead for the moment */ diff --git a/apps/app_rpt.c b/apps/app_rpt.c index be52773ac..b3a26dd7b 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -2008,7 +2008,7 @@ struct ast_variable *vp; ourcfg = ast_config_load(myrpt->p.extnodefile); #endif /* if file not there, just bail */ - if (!ourcfg) + if (!ourcfg || ourcfg == CONFIG_STATUS_FILEINVALID) { ast_mutex_unlock(&nodelookuplock); return(NULL); @@ -2234,7 +2234,7 @@ static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis #else cfg = ast_config_load("rpt.conf"); #endif - if (!cfg) { + if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { ast_mutex_unlock(&rpt_vars[n].lock); ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n"); pthread_exit(NULL); @@ -12923,7 +12923,7 @@ char *this,*val; rpt_vars[n].cfg = ast_config_load("rpt.conf"); #endif cfg = rpt_vars[n].cfg; - if (!cfg) { + if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n"); pthread_exit(NULL); } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 66df94968..90e0795b7 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1157,7 +1157,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword) return; /* check voicemail.conf */ - if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags))) { + if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) { while ((category = ast_category_browse(cfg, category))) { if (!strcasecmp(category, vmu->context)) { if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) { @@ -1187,7 +1187,7 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword) var = NULL; /* check users.conf and update the password stored for the mailbox*/ /* if no vmsecret entry exists create one. */ - if ((cfg = ast_config_load("users.conf", config_flags))) { + if ((cfg = ast_config_load("users.conf", config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) { ast_debug(4, "we are looking for %s\n", vmu->mailbox); while ((category = ast_category_browse(cfg, category))) { ast_debug(4, "users.conf: %s\n", category); @@ -3181,7 +3181,7 @@ static int store_file(char *dir, char *mailboxuser, char *mailboxcontext, int ms res = -1; break; } - if (cfg) { + if (cfg && cfg != CONFIG_STATUS_FILEINVALID) { if (!(idata.context = ast_variable_retrieve(cfg, "message", "context"))) { idata.context = ""; } @@ -5756,7 +5756,7 @@ static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, strncat(textfile, ".txt", sizeof(textfile) - strlen(textfile) - 1); strncat(backup, "-bak", sizeof(backup) - strlen(backup) - 1); - if ((msg_cfg = ast_config_load(textfile, config_flags)) && (duration_str = ast_variable_retrieve(msg_cfg, "message", "duration"))) { + if ((msg_cfg = ast_config_load(textfile, config_flags)) && msg_cfg != CONFIG_STATUS_FILEINVALID && (duration_str = ast_variable_retrieve(msg_cfg, "message", "duration"))) { *duration = atoi(duration_str); } else { *duration = 0; @@ -6456,7 +6456,7 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc snprintf(filename, sizeof(filename), "%s.txt", vms->fn); RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context); msg_cfg = ast_config_load(filename, config_flags); - if (!msg_cfg) { + if (!msg_cfg || msg_cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "No message attribute file?!! (%s)\n", filename); return 0; } @@ -9954,13 +9954,27 @@ static int load_config(int reload) ast_unload_realtime("voicemail_data"); if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEUNCHANGED) { - if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) { return 0; + } else if (ucfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file users.conf is in an invalid format. Avoiding.\n"); + ucfg = NULL; + } ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED); - cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags); + if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) == CONFIG_STATUS_FILEINVALID) { + ast_config_destroy(ucfg); + ast_log(LOG_ERROR, "Config file " VOICEMAIL_CONFIG " is in an invalid format. Aborting.\n"); + return 0; + } + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file " VOICEMAIL_CONFIG " is in an invalid format. Aborting.\n"); + return 0; } else { ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED); - ucfg = ast_config_load("users.conf", config_flags); + if ((ucfg = ast_config_load("users.conf", config_flags)) == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file users.conf is in an invalid format. Avoiding.\n"); + ucfg = NULL; + } } #ifdef IMAP_STORAGE ast_copy_string(imapparentfolder, "\0", sizeof(imapparentfolder)); @@ -10772,7 +10786,7 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s RETRIEVE(vms->curdir, vms->curmsg, vmu->mailbox, vmu->context); msg_cfg = ast_config_load(filename, config_flags); DISPOSE(vms->curdir, vms->curmsg); - if (!msg_cfg) { + if (!msg_cfg || msg_cfg == CONFIG_STATUS_FILEINVALID) { ast_log(AST_LOG_WARNING, "No message attribute file?!! (%s)\n", filename); return 0; } |