]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Stop hardcoding of lua in C
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Jan 2017 14:06:18 +0000 (14:06 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 11 Jan 2017 14:06:18 +0000 (14:06 +0000)
rules/global_functions.lua [moved from src/lua/global_functions.lua with 100% similarity]
rules/rspamd.lua
src/CMakeLists.txt
src/lua/CMakeLists.txt
src/lua/lua_common.c

index a9ead440d251b7ede4297f2dc1774c956e8f351b..a89f0a002a70eeb7bc9d6f6c325dd2ca23938697 100644 (file)
@@ -21,6 +21,7 @@ config['regexp'] = {}
 local local_conf = rspamd_paths['CONFDIR']
 local local_rules = rspamd_paths['RULESDIR']
 
+dofile(local_rules .. '/global_functions.lua')
 dofile(local_rules .. '/regexp/headers.lua')
 dofile(local_rules .. '/regexp/lotto.lua')
 dofile(local_rules .. '/regexp/fraud.lua')
index 36ab66f7395c622dbc35507304f261516478de52..33bc454065af129732118c1d24507b972f0fd060 100644 (file)
@@ -170,7 +170,6 @@ TARGET_LINK_LIBRARIES(rspamd-server rspamd-zstd)
 IF (ENABLE_CLANG_PLUGIN MATCHES "ON")
        ADD_DEPENDENCIES(rspamd-server rspamd-clang)
 ENDIF()
-ADD_DEPENDENCIES(rspamd-server rspamd_lua_preprocess)
 
 ADD_EXECUTABLE(rspamd ${RSPAMDSRC} ${CMAKE_CURRENT_BINARY_DIR}/workers.c)
 SET_TARGET_PROPERTIES(rspamd PROPERTIES LINKER_LANGUAGE C)
index ba1a7c16a754cf8107e80ed07f517e570cdc8442..9c561c0e43c6e72b488f3c9620660c7f543390b4 100644 (file)
@@ -27,11 +27,4 @@ SET(LUASRC                     ${CMAKE_CURRENT_SOURCE_DIR}/lua_common.c
                                          ${CMAKE_CURRENT_SOURCE_DIR}/lua_cryptobox.c
                                          ${CMAKE_CURRENT_SOURCE_DIR}/lua_map.c)
 
-SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE)
-SET(RSPAMDMLUASRC "${CMAKE_CURRENT_SOURCE_DIR}/global_functions.lua")
-ADD_CUSTOM_TARGET(rspamd_lua_preprocess
-        ${PERL_EXECUTABLE}
-            "${CMAKE_SOURCE_DIR}/lua_preprocess.pl"
-            "${CMAKE_CURRENT_SOURCE_DIR}"
-            "${CMAKE_CURRENT_BINARY_DIR}"
-        SOURCES ${RSPAMDMLUASRC} ${CMAKE_SOURCE_DIR}/lua_preprocess.pl)
\ No newline at end of file
+SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE)
\ No newline at end of file
index 3dc02991b3d439b420a8a3a0ddf288066b7f758f..b9eabe7903d874c160b27c04d2afae73f1030f20 100644 (file)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 #include "lua_common.h"
-#include "lua/global_functions.lua.h"
 #include "lptree.h"
 #include "utlist.h"
 #include <math.h>
@@ -302,11 +301,6 @@ rspamd_lua_init ()
        rspamd_lua_new_class (L, "rspamd{worker}", worker_reg);
        rspamd_lua_add_preload (L, "ucl", luaopen_ucl);
 
-       if (luaL_dostring (L, rspamadm_script_global_functions) != 0) {
-               msg_err ("cannot execute lua global script: %s",
-                               lua_tostring (L, -1));
-       }
-
        /* Add plugins global */
        lua_newtable (L);
        lua_setglobal (L, "rspamd_plugins");