diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 16:38:19 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-04-17 16:38:19 +0100 |
commit | 4c252ed720d21dec1ac6cd088e50d65f8d8014fd (patch) | |
tree | d6e1d389186ca7e4e9fbb890abc02e7c8cde7753 /src/libserver/cfg_utils.c | |
parent | d111e5e161f9bc3ae388e8e874651d6b5656ba1a (diff) | |
download | rspamd-4c252ed720d21dec1ac6cd088e50d65f8d8014fd.tar.gz rspamd-4c252ed720d21dec1ac6cd088e50d65f8d8014fd.zip |
Fix modules initialization.
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r-- | src/libserver/cfg_utils.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 444ad9a11..0094907a7 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -838,6 +838,7 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig) g_hash_table_insert (cfg->c_modules, (gpointer) mod->name, mod_ctx); + mod_ctx->mod = mod; } } @@ -845,23 +846,23 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig) while (cur) { /* Perform modules configuring */ - mod = NULL; - for (pmod = modules; *pmod != NULL; pmod ++) { - if ((*pmod)->name && g_ascii_strcasecmp ((*pmod)->name, - cur->data) == 0) { - mod = *pmod; - - if (reconfig) { - (void)mod->module_reconfig_func (cfg); - msg_debug ("reconfig of %s", mod->name); - } - else { - (void)mod->module_config_func (cfg); - } + mod_ctx = NULL; + mod_ctx = g_hash_table_lookup (cfg->c_modules, cur->data); + + if (mod_ctx) { + mod = mod_ctx->mod; + mod_ctx->enabled = TRUE; + + if (reconfig) { + (void)mod->module_reconfig_func (cfg); + msg_debug ("reconfig of %s", mod->name); + } + else { + (void)mod->module_config_func (cfg); } } - if (mod == NULL) { + if (mod_ctx == NULL) { msg_warn ("requested unknown module %s", cur->data); } |