diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-28 12:33:34 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-28 12:33:34 +0100 |
commit | a109540436f05ea4e67c50b4a2517023bd6b144b (patch) | |
tree | f0bd21091660b6da1621199cb1c4888d6f44cc31 /src | |
parent | 8a1e8bbfdf47102bb9f25cf58d4f171b54124b2c (diff) | |
download | rspamd-a109540436f05ea4e67c50b4a2517023bd6b144b.tar.gz rspamd-a109540436f05ea4e67c50b4a2517023bd6b144b.zip |
[Feature] Add execution of lua global functions script
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/lua/global_functions.lua | 0 | ||||
-rw-r--r-- | src/lua/lua_common.c | 6 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt index 544fbac3a..fefd074d5 100644 --- a/src/lua/CMakeLists.txt +++ b/src/lua/CMakeLists.txt @@ -30,7 +30,7 @@ SET(LUASRC ${CMAKE_CURRENT_SOURCE_DIR}/lua_common.c ${CMAKE_CURRENT_SOURCE_DIR}/lua_map.c) SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE) -SET(RSPAMDMLUASRC "") +SET(RSPAMDMLUASRC "${CMAKE_CURRENT_SOURCE_DIR}/global_functions.lua") ADD_CUSTOM_TARGET(rspamd_lua_preprocess ${PERL_EXECUTABLE} "${CMAKE_SOURCE_DIR}/lua_preprocess.pl" diff --git a/src/lua/global_functions.lua b/src/lua/global_functions.lua new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/src/lua/global_functions.lua diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 4563d9f84..ad77b0602 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -14,6 +14,7 @@ * limitations under the License. */ #include "lua_common.h" +#include "lua/global_functions.lua.h" /* Lua module init function */ #define MODULE_INIT_FUNC "module_init" @@ -244,6 +245,11 @@ rspamd_lua_init () 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)); + } + return L; } |