]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Couple of minor fixes
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Dec 2017 18:35:44 +0000 (18:35 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 Dec 2017 18:35:44 +0000 (18:35 +0000)
src/lua/lua_config.c
src/plugins/surbl.c

index c1e31eb4441e8479073ecb336707046b3c2a3d40..c667e1510b99ab903568f2d86e4a020daa4ba2cb 100644 (file)
@@ -1995,7 +1995,7 @@ lua_config_newindex (lua_State *L)
 
        name = luaL_checkstring (L, 2);
 
-       if (cfg != NULL && name != NULL && lua_gettop (L) > 2) {
+       if (cfg != NULL && name != NULL && lua_gettop (L) == 3) {
                if (lua_type (L, 3) == LUA_TFUNCTION) {
                        /* Normal symbol from just a function */
                        lua_pushvalue (L, 3);
@@ -2070,7 +2070,6 @@ lua_config_newindex (lua_State *L)
                        if (lua_type (L, -1) == LUA_TSTRING) {
                                type_str = lua_tostring (L, -1);
                                type = lua_parse_symbol_type (type_str);
-
                        }
                        lua_pop (L, 1);
 
index 4a8dc9654a5b321289c691ab29033ee2acb0c1d1..7d93c31e31be60d524ef8b7aecd10bbf167f8a06 100644 (file)
@@ -791,13 +791,17 @@ surbl_module_config (struct rspamd_config *cfg)
        gint nrules = 0;
        lua_State *L;
 
+       if (!rspamd_config_is_module_enabled (cfg, "surbl")) {
+               return TRUE;
+       }
+
        /* Register global methods */
        L = cfg->lua_state;
        lua_getglobal (L, "rspamd_plugins");
 
        if (lua_type (L, -1) == LUA_TTABLE) {
                lua_pushstring (L, "surbl");
-               lua_createtable (L, 0, 2);
+               lua_createtable (L, 0, 3);
                /* Set methods */
                lua_pushstring (L, "register_redirect");
                lua_pushcfunction (L, surbl_register_redirect_handler);
@@ -808,16 +812,12 @@ surbl_module_config (struct rspamd_config *cfg)
                lua_pushstring (L, "is_redirector");
                lua_pushcfunction (L, surbl_is_redirector_handler);
                lua_settable (L, -3);
-               /* Finish fuzzy_check key */
+               /* Finish surbl key */
                lua_settable (L, -3);
        }
 
        lua_pop (L, 1); /* Remove global function */
 
-       if (!rspamd_config_is_module_enabled (cfg, "surbl")) {
-               return TRUE;
-       }
-
        (void)rspamd_symbols_cache_add_symbol (cfg->cache, SURBL_REDIRECTOR_CALLBACK,
                        0, surbl_test_redirector, NULL,
                        SYMBOL_TYPE_CALLBACK, -1);