From 4c252ed720d21dec1ac6cd088e50d65f8d8014fd Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 17 Apr 2015 16:38:19 +0100 Subject: Fix modules initialization. --- src/libserver/cfg_utils.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/libserver/cfg_utils.c') 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); } -- cgit v1.2.3