]> source.dussan.org Git - rspamd.git/commitdiff
Fix initialization order
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Nov 2015 13:53:48 +0000 (13:53 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Nov 2015 13:53:48 +0000 (13:53 +0000)
src/libserver/cfg_utils.c
src/rspamadm/configdump.c
src/rspamadm/configtest.c
src/rspamd.c

index b2e97564f50c891dc6e0796ff411c8f2c9fc3d38..4fdc78526797c56ee350988815831aa2bfe1ff71 100644 (file)
@@ -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);
index e40f2f34afe37e8dea93731ebe9c80b8234651d4..1e169f791a8ff90e75d0ef219e7ac3ccd14f8abf 100644 (file)
@@ -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) {
index 7f2d1737fa62409af5411bf630a0d00fb512d5fb..9c8353312d881eb0b5ab58577e90f5c7177d04c3 100644 (file)
@@ -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) {
index c9d5904d82811cccc1fe9973af7c00efd5da54c6..f198a6eebd50646ea6056eac8ef991c2e7e393e2 100644 (file)
@@ -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);
        }