diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-27 13:53:48 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-11-27 13:53:48 +0000 |
commit | 65965fabad7969eb1d87df659679b73437415f52 (patch) | |
tree | 523adb3e5085bb90dcd8c434b8d73db0bc45b324 | |
parent | 085b3707cbddc9601b3dd8f5953c74d299cac2d4 (diff) | |
download | rspamd-65965fabad7969eb1d87df659679b73437415f52.tar.gz rspamd-65965fabad7969eb1d87df659679b73437415f52.zip |
Fix initialization order
-rw-r--r-- | src/libserver/cfg_utils.c | 2 | ||||
-rw-r--r-- | src/rspamadm/configdump.c | 11 | ||||
-rw-r--r-- | src/rspamadm/configtest.c | 9 | ||||
-rw-r--r-- | src/rspamd.c | 6 |
4 files changed, 18 insertions, 10 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index b2e97564f..4fdc78526 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -653,8 +653,6 @@ rspamd_config_post_load (struct rspamd_config *cfg, gboolean validate_cache) g_string_free (fpath, TRUE); } - /* Lua options */ - (void)rspamd_lua_post_load_config (cfg); init_dynamic_config (cfg); rspamd_url_init (cfg->tld_file); diff --git a/src/rspamadm/configdump.c b/src/rspamadm/configdump.c index e40f2f34a..1e169f791 100644 --- a/src/rspamadm/configdump.c +++ b/src/rspamadm/configdump.c @@ -28,6 +28,7 @@ #include "cfg_rcl.h" #include "utlist.h" #include "rspamd.h" +#include "lua/lua_common.h" static gboolean json = FALSE; static gboolean compact = FALSE; @@ -173,15 +174,15 @@ rspamadm_configdump (gint argc, gchar **argv) } else { /* Do post-load actions */ - rspamd_config_post_load (cfg, FALSE); - ret = TRUE; - } - - if (ret) { + rspamd_lua_post_load_config (cfg); if (!rspamd_init_filters (rspamd_main->cfg, FALSE)) { ret = FALSE; } + + if (ret) { + ret = rspamd_config_post_load (cfg, FALSE); + } } if (ret) { diff --git a/src/rspamadm/configtest.c b/src/rspamadm/configtest.c index 7f2d1737f..9c8353312 100644 --- a/src/rspamadm/configtest.c +++ b/src/rspamadm/configtest.c @@ -27,6 +27,7 @@ #include "cfg_file.h" #include "cfg_rcl.h" #include "rspamd.h" +#include "lua/lua_common.h" static gboolean quiet = FALSE; static gchar *config = NULL; @@ -150,10 +151,8 @@ rspamadm_configtest (gint argc, gchar **argv) } else { /* Do post-load actions */ - ret = rspamd_config_post_load (cfg, FALSE); - } + rspamd_lua_post_load_config (cfg); - if (ret) { if (!rspamd_init_filters (rspamd_main->cfg, FALSE)) { ret = FALSE; } @@ -162,6 +161,10 @@ rspamadm_configtest (gint argc, gchar **argv) FALSE)) { ret = FALSE; } + + if (ret) { + ret = rspamd_config_post_load (cfg, FALSE); + } } if (strict && ret) { diff --git a/src/rspamd.c b/src/rspamd.c index c9d5904d8..f198a6eeb 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -598,6 +598,12 @@ load_rspamd_config (struct rspamd_main *rspamd_main, } } + /* + * As some rules are defined in lua, we need to process them, then init + * modules and merely afterwards to init modules + */ + rspamd_lua_post_load_config (cfg); + if (init_modules) { rspamd_init_filters (cfg, FALSE); } |