diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-13 00:11:09 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-13 00:11:09 +0000 |
commit | 64ef304ee2343cad2b43e0aee1776d4c2f1b80bd (patch) | |
tree | c18634611681d34b6996aa6270603e5a304c5ad3 /channels/chan_iax2.c | |
parent | 38e7d7b10602ea2f90836a1a1cd063a50f3ae40a (diff) |
If a typo is found in a config file, we previous continued on with what was already loaded.
We do not want to do this (see bug below for details).
This makes it so that if a [ is found without a ], the entire config will fail, and nothing in it will be loaded.
Isue #10690.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@92696 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 39f3f6d87..63b358fd5 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -9534,6 +9534,20 @@ static void set_timing(void) #endif } +static void set_config_destroy(void) +{ + strcpy(accountcode, ""); + strcpy(language, ""); + strcpy(mohinterpret, "default"); + strcpy(mohsuggest, ""); + amaflags = 0; + delayreject = 0; + ast_clear_flag((&globalflags), IAX_NOTRANSFER); + ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA); + ast_clear_flag((&globalflags), IAX_USEJITTERBUF); + ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF); + delete_users(); +} /*! \brief Load configuration */ static int set_config(char *config_file, int reload) @@ -9561,6 +9575,10 @@ static int set_config(char *config_file, int reload) return -1; } + if (reload) { + set_config_destroy(); + } + /* Reset global codec prefs */ memset(&prefs, 0 , sizeof(struct ast_codec_pref)); @@ -9886,7 +9904,7 @@ static int set_config(char *config_file, int reload) } ast_config_destroy(cfg); set_timing(); - return capability; + return 1; } static void poke_all_peers(void) @@ -9905,26 +9923,16 @@ static int reload_config(void) char *config = "iax.conf"; struct iax2_registry *reg; - strcpy(accountcode, ""); - strcpy(language, ""); - strcpy(mohinterpret, "default"); - strcpy(mohsuggest, ""); - amaflags = 0; - delayreject = 0; - ast_clear_flag((&globalflags), IAX_NOTRANSFER); - ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA); - ast_clear_flag((&globalflags), IAX_USEJITTERBUF); - ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF); - delete_users(); - set_config(config, 1); - prune_peers(); - prune_users(); - AST_LIST_LOCK(®istrations); - AST_LIST_TRAVERSE(®istrations, reg, entry) - iax2_do_register(reg); - AST_LIST_UNLOCK(®istrations); - /* Qualify hosts, too */ - poke_all_peers(); + if (set_config(config, 1) > 0) { + prune_peers(); + prune_users(); + AST_LIST_LOCK(®istrations); + AST_LIST_TRAVERSE(®istrations, reg, entry) + iax2_do_register(reg); + AST_LIST_UNLOCK(®istrations); + /* Qualify hosts, too */ + poke_all_peers(); + } reload_firmware(0); iax_provision_reload(); |