mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Fix checking for CONFIG_STATUS_FILEINVALID so that modules don't crash upon trying to parse an invalid config
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -6477,7 +6477,7 @@ static struct ast_channel *skinny_request(const char *type, int format, void *da
|
||||
cfg = ast_config_load(config, config_flags);
|
||||
|
||||
/* We *must* have a config file otherwise stop immediately */
|
||||
if (!cfg) {
|
||||
if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
|
||||
ast_log(LOG_NOTICE, "Unable to load config %s, Skinny disabled.\n", config);
|
||||
return -1;
|
||||
}
|
||||
|
@@ -3510,7 +3510,7 @@ static struct chan_usbradio_pvt *store_config(struct ast_config *cfg, char *ctg)
|
||||
o->txctcssadj = 200;
|
||||
o->rxsquelchadj = 500;
|
||||
o->devstr[0] = 0;
|
||||
if (cfg1) {
|
||||
if (cfg1 && cfg1 != CONFIG_STATUS_FILEINVALID) {
|
||||
for (v = ast_variable_browse(cfg1, o->name); v; v = v->next) {
|
||||
|
||||
M_START((char *)v->name, (char *)v->value);
|
||||
@@ -3942,9 +3942,9 @@ static int load_module(void)
|
||||
|
||||
/* load config file */
|
||||
#ifdef NEW_ASTERISK
|
||||
if (!(cfg = ast_config_load(config,zeroflag))) {
|
||||
if (!(cfg = ast_config_load(config,zeroflag)) || cfg == CONFIG_STATUS_FILEINVALID) {
|
||||
#else
|
||||
if (!(cfg = ast_config_load(config))) {
|
||||
if (!(cfg = ast_config_load(config))) || cfg == CONFIG_STATUS_FILEINVALID {
|
||||
#endif
|
||||
ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
|
@@ -2714,7 +2714,7 @@ static enum ast_module_load_result load_module()
|
||||
cfg = ast_config_load(config, config_flags);
|
||||
|
||||
/* We *must* have a config file otherwise stop immediately */
|
||||
if (!cfg) {
|
||||
if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
|
||||
ast_log(LOG_ERROR, "Unable to load config %s\n", config);
|
||||
return AST_MODULE_LOAD_DECLINE;
|
||||
}
|
||||
|
@@ -493,7 +493,7 @@ int iax_provision_reload(int reload)
|
||||
iax_provision_init();
|
||||
|
||||
cfg = ast_config_load2("iaxprov.conf", "chan_iax2", config_flags);
|
||||
if (cfg != NULL && cfg != CONFIG_STATUS_FILEUNCHANGED) {
|
||||
if (cfg != NULL && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID) {
|
||||
/* Mark all as dead. No need for locking */
|
||||
cur = templates;
|
||||
while(cur) {
|
||||
|
@@ -1101,8 +1101,8 @@ int misdn_cfg_init(int this_max_ports, int reload)
|
||||
struct ast_variable *v;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
|
||||
if (!(cfg = ast_config_load2(config, "chan_misdn", config_flags))) {
|
||||
ast_log(LOG_WARNING, "missing file: misdn.conf\n");
|
||||
if (!(cfg = ast_config_load2(config, "chan_misdn", config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) {
|
||||
ast_log(LOG_WARNING, "missing or invalid file: misdn.conf\n");
|
||||
return -1;
|
||||
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user