diff options
-rw-r--r-- | cdr/cdr_adaptive_odbc.c | 2 | ||||
-rw-r--r-- | cdr/cdr_csv.c | 2 | ||||
-rw-r--r-- | cdr/cdr_custom.c | 5 | ||||
-rw-r--r-- | cdr/cdr_manager.c | 5 | ||||
-rw-r--r-- | cdr/cdr_odbc.c | 4 | ||||
-rw-r--r-- | cdr/cdr_pgsql.c | 2 | ||||
-rw-r--r-- | cdr/cdr_radius.c | 2 | ||||
-rw-r--r-- | cdr/cdr_sqlite3_custom.c | 2 | ||||
-rw-r--r-- | cdr/cdr_tds.c | 2 | ||||
-rw-r--r-- | channels/chan_skinny.c | 2 | ||||
-rw-r--r-- | channels/chan_usbradio.c | 6 | ||||
-rw-r--r-- | channels/chan_vpb.cc | 2 | ||||
-rw-r--r-- | channels/iax2-provision.c | 2 | ||||
-rw-r--r-- | channels/misdn_config.c | 4 | ||||
-rw-r--r-- | main/logger.c | 2 | ||||
-rw-r--r-- | main/xmldoc.c | 2 | ||||
-rw-r--r-- | pbx/pbx_dundi.c | 2 | ||||
-rw-r--r-- | res/ais/evt.c | 2 | ||||
-rw-r--r-- | res/res_clialiases.c | 2 |
19 files changed, 31 insertions, 21 deletions
diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index 17e70fada..85b54e52c 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -97,7 +97,7 @@ static int load_config(void) struct ast_flags config_flags = { 0 }; /* Part of our config comes from the database */ cfg = ast_config_load(CONFIG, config_flags); - if (!cfg) { + if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "Unable to load " CONFIG ". No adaptive ODBC CDRs.\n"); return -1; } diff --git a/cdr/cdr_csv.c b/cdr/cdr_csv.c index 10fa0c1ac..eb0619b7d 100644 --- a/cdr/cdr_csv.c +++ b/cdr/cdr_csv.c @@ -100,7 +100,7 @@ static int load_config(int reload) loguniqueid = 0; loguserfield = 0; - if (!(cfg = ast_config_load(config, config_flags))) { + if (!(cfg = ast_config_load(config, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "unable to load config: %s\n", config); return 0; } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) diff --git a/cdr/cdr_custom.c b/cdr/cdr_custom.c index 6ecef8af4..45207750a 100644 --- a/cdr/cdr_custom.c +++ b/cdr/cdr_custom.c @@ -67,6 +67,11 @@ static int load_config(int reload) if ((cfg = ast_config_load("cdr_custom.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) return 0; + if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Invalid config file\n"); + return 1; + } + strcpy(format, ""); strcpy(master, ""); ast_mutex_lock(&lock); diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 8b2ab215d..4dad2306f 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -62,6 +62,11 @@ static int load_config(int reload) if (cfg == CONFIG_STATUS_FILEUNCHANGED) return 0; + if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file '%s' could not be parsed\n", CONF_FILE); + return 1; + } + if (reload && customfields) { ast_free(customfields); } diff --git a/cdr/cdr_odbc.c b/cdr/cdr_odbc.c index d4db02b52..3c2cfb2ec 100644 --- a/cdr/cdr_odbc.c +++ b/cdr/cdr_odbc.c @@ -161,7 +161,7 @@ static int odbc_load_module(int reload) do { cfg = ast_config_load(config_file, config_flags); - if (!cfg) { + if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "cdr_odbc: Unable to load config for ODBC CDR's: %s\n", config_file); res = AST_MODULE_LOAD_DECLINE; break; @@ -228,7 +228,7 @@ static int odbc_load_module(int reload) } } while (0); - if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED) + if (cfg && cfg != CONFIG_STATUS_FILEUNCHANGED && cfg != CONFIG_STATUS_FILEINVALID) ast_config_destroy(cfg); return res; } diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c index c6e17381f..c56bf97f1 100644 --- a/cdr/cdr_pgsql.c +++ b/cdr/cdr_pgsql.c @@ -370,7 +370,7 @@ static int config_module(int reload) struct ast_config *cfg; struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; - if ((cfg = ast_config_load(config, config_flags)) == NULL) { + if ((cfg = ast_config_load(config, config_flags)) == NULL || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "Unable to load config for PostgreSQL CDR's: %s\n", config); return -1; } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c index d326eba64..2251f149d 100644 --- a/cdr/cdr_radius.c +++ b/cdr/cdr_radius.c @@ -228,7 +228,7 @@ static int load_module(void) int res; const char *tmp; - if ((cfg = ast_config_load(cdr_config, config_flags))) { + if ((cfg = ast_config_load(cdr_config, config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) { ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "usegmtime")), RADIUS_FLAG_USEGMTIME); ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguniqueid")), RADIUS_FLAG_LOGUNIQUEID); ast_set2_flag(&global_flags, ast_true(ast_variable_retrieve(cfg, "radius", "loguserfield")), RADIUS_FLAG_LOGUSERFIELD); diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c index b617ab579..898e415ae 100644 --- a/cdr/cdr_sqlite3_custom.c +++ b/cdr/cdr_sqlite3_custom.c @@ -158,7 +158,7 @@ static int load_config(int reload) struct ast_variable *mappingvar; const char *tmp; - if (!(cfg = ast_config_load(config_file, config_flags))) { + if (!(cfg = ast_config_load(config_file, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) { if (reload) ast_log(LOG_WARNING, "Failed to reload configuration file.\n"); else diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c index fd3f32864..e05f21453 100644 --- a/cdr/cdr_tds.c +++ b/cdr/cdr_tds.c @@ -426,7 +426,7 @@ static int tds_load_module(int reload) struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; cfg = ast_config_load(config, config_flags); - if (!cfg) { + if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_NOTICE, "Unable to load TDS config for CDRs: %s\n", config); return 0; } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index a72345cfe..04c700559 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -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; } diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index bc1dbb3c2..df5bad541 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -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; diff --git a/channels/chan_vpb.cc b/channels/chan_vpb.cc index b8ca24011..f72231276 100644 --- a/channels/chan_vpb.cc +++ b/channels/chan_vpb.cc @@ -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; } diff --git a/channels/iax2-provision.c b/channels/iax2-provision.c index 8bdfdbfb7..7278819b7 100644 --- a/channels/iax2-provision.c +++ b/channels/iax2-provision.c @@ -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) { diff --git a/channels/misdn_config.c b/channels/misdn_config.c index fb0739356..12a742cf3 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -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; diff --git a/main/logger.c b/main/logger.c index b4f4c4dd0..2c312eecc 100644 --- a/main/logger.c +++ b/main/logger.c @@ -326,7 +326,7 @@ static void init_logger_chain(int locked) const char *s; struct ast_flags config_flags = { 0 }; - if (!(cfg = ast_config_load2("logger.conf", "logger", config_flags))) + if (!(cfg = ast_config_load2("logger.conf", "logger", config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) return; /* delete our list of log channels */ diff --git a/main/xmldoc.c b/main/xmldoc.c index c3c9e80c1..273ddc6ca 100644 --- a/main/xmldoc.c +++ b/main/xmldoc.c @@ -1721,7 +1721,7 @@ int ast_xmldoc_load_documentation(void) /* setup default XML documentation language */ snprintf(documentation_language, sizeof(documentation_language), default_documentation_language); - if ((cfg = ast_config_load2("asterisk.conf", "" /* core can't reload */, cnfflags))) { + if ((cfg = ast_config_load2("asterisk.conf", "" /* core can't reload */, cnfflags)) && cfg != CONFIG_STATUS_FILEINVALID) { for (var = ast_variable_browse(cfg, "options"); var; var = var->next) { if (!strcasecmp(var->name, "documentation_language")) { if (!ast_strlen_zero(var->value)) { diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 2b2ff6ef8..08177723f 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -4558,7 +4558,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin, int reload) int globalpcmodel = 0; dundi_eid testeid; - if (!(cfg = ast_config_load(config_file, config_flags))) { + if (!(cfg = ast_config_load(config_file, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_ERROR, "Unable to load config %s\n", config_file); return -1; } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) diff --git a/res/ais/evt.c b/res/ais/evt.c index 2965df0e3..5de26e39c 100644 --- a/res/ais/evt.c +++ b/res/ais/evt.c @@ -475,7 +475,7 @@ static void load_config(void) const char *cat = NULL; struct ast_flags config_flags = { 0 }; - if (!(cfg = ast_config_load(filename, config_flags))) + if (!(cfg = ast_config_load(filename, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) return; while ((cat = ast_category_browse(cfg, cat))) { diff --git a/res/res_clialiases.c b/res/res_clialiases.c index a20947bb1..2d9a396a7 100644 --- a/res/res_clialiases.c +++ b/res/res_clialiases.c @@ -190,7 +190,7 @@ static void load_config(int reload) struct cli_alias *alias; struct ast_variable *v, *v1; - if (!(cfg = ast_config_load(config_file, config_flags))) { + if (!(cfg = ast_config_load(config_file, config_flags)) || cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_ERROR, "res_clialiases configuration file '%s' not found\n", config_file); return; } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { |