diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-12-03 12:48:04 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-12-03 16:55:30 +0000 |
commit | 71e991f97940818ae4ba3b9acf62e7533de49f3a (patch) | |
tree | ddf9334214a3a6e8fc7b84e090e2fd40375dec80 /src/libserver | |
parent | 2c89aaa9c94211f6fdb4f7afd1f0cdcf51f9ea2d (diff) | |
download | rspamd-71e991f97940818ae4ba3b9acf62e7533de49f3a.tar.gz rspamd-71e991f97940818ae4ba3b9acf62e7533de49f3a.zip |
[Minor] Rework initialization order to handle C modules
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/cfg_utils.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 597d661ae..25ef943b9 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -1522,7 +1522,7 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, const ucl_object_t *conf, *enabled; GList *cur; struct rspamd_symbols_group *gr; - + lua_State *L = cfg->lua_state; if (g_hash_table_lookup (cfg->c_modules, module_name)) { is_c = TRUE; @@ -1530,6 +1530,10 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, if (g_hash_table_lookup (cfg->explicit_modules, module_name) != NULL) { /* Always load module */ + rspamd_table_push_global_elt (L, + rspamd_modules_state_global, + "enabled", module_name); + return TRUE; } @@ -1550,6 +1554,9 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, if (!found) { msg_info_config ("internal module %s is disable in `filters` line", module_name); + rspamd_table_push_global_elt (L, + rspamd_modules_state_global, + "disabled_explicitly", module_name); return FALSE; } @@ -1558,6 +1565,10 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, conf = ucl_object_lookup (cfg->rcl_obj, module_name); if (conf == NULL) { + rspamd_table_push_global_elt (L, + rspamd_modules_state_global, + "disabled_unconfigured", module_name); + msg_info_config ("%s module %s is enabled but has not been configured", is_c ? "internal" : "lua", module_name); @@ -1571,6 +1582,10 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, if (enabled && ucl_object_type (enabled) == UCL_BOOLEAN) { if (!ucl_object_toboolean (enabled)) { + rspamd_table_push_global_elt (L, + rspamd_modules_state_global, + "disabled_explicitly", module_name); + msg_info_config ("%s module %s is disabled in the configuration", is_c ? "internal" : "lua", module_name); return FALSE; @@ -1583,9 +1598,13 @@ rspamd_config_is_module_enabled (struct rspamd_config *cfg, if (gr) { if (gr->disabled) { + rspamd_table_push_global_elt (L, + rspamd_modules_state_global, + "disabled_explicitly", module_name); msg_info_config ("%s module %s is disabled in the configuration as " "its group has been disabled", is_c ? "internal" : "lua", module_name); + return FALSE; } } |