diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2008-09-12 23:30:03 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2008-09-12 23:30:03 +0000 |
commit | 08af5bb31222c39739b8ec216b403756fb250924 (patch) | |
tree | 790035cc6aca2440080bd357a68a09fdbbb2624c /apps/app_meetme.c | |
parent | 5d39c767c12477610cf13f5c2e00e7eed7839352 (diff) |
Create a new config file status, CONFIG_STATUS_FILEINVALID for differentiating
when a file is invalid from when a file is missing. This is most important when
we have two configuration files. Consider the following example:
Old system:
sip.conf users.conf Old result New result
======== ========== ========== ==========
Missing Missing SIP doesn't load SIP doesn't load
Missing OK SIP doesn't load SIP doesn't load
Missing Invalid SIP doesn't load SIP doesn't load
OK Missing SIP loads SIP loads
OK OK SIP loads SIP loads
OK Invalid SIP loads incompletely SIP doesn't load
Invalid Missing SIP doesn't load SIP doesn't load
Invalid OK SIP doesn't load SIP doesn't load
Invalid Invalid SIP doesn't load SIP doesn't load
So in the case when users.conf doesn't load because there's a typo that
disrupts the syntax, we may only partially load users, instead of failing with
an error, which may cause some calls not to get processed. Worse yet, the old
system would do this with no indication that anything was even wrong.
(closes issue #10690)
Reported by: dtyoo
Patches:
20080716__bug10690.diff.txt uploaded by Corydon76 (license 14)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@142992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_meetme.c')
-rw-r--r-- | apps/app_meetme.c | 19 |
1 files changed, 15 insertions, 4 deletions
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); |