aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/cfg_rcl.c2
-rw-r--r--src/lua/lua_common.c7
-rw-r--r--src/lua/lua_common.h3
3 files changed, 11 insertions, 1 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 4ea7c17ed..6c309d4dd 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -664,6 +664,8 @@ rspamd_rcl_set_lua_globals (struct rspamd_config *cfg, lua_State *L)
/* Clear stack from globals */
lua_pop (L, 4);
+
+ rspamd_lua_set_path (L, cfg);
}
static gboolean
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index cb5f07712..ffba71754 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -281,7 +281,7 @@ lua_add_actions_global (lua_State *L)
lua_setglobal (L, "rspamd_actions");
}
-static void
+void
rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg)
{
const gchar *old_path, *additional_path = NULL;
@@ -292,6 +292,11 @@ rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg)
lua_getfield (L, -1, "path");
old_path = luaL_checkstring (L, -1);
+ if (strstr (old_path, RSPAMD_PLUGINSDIR) != NULL) {
+ /* Path has been already set, do not touch it */
+ return;
+ }
+
opts = ucl_object_find_key (cfg->rcl_obj, "options");
if (opts != NULL) {
opts = ucl_object_find_key (opts, "lua_path");
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 521a25580..7c532df4e 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -218,6 +218,9 @@ gboolean rspamd_lua_check_condition (struct rspamd_config *cfg,
const gchar *condition);
void rspamd_lua_dumpstack (lua_State *L);
+/* Set lua path according to the configuration */
+void rspamd_lua_set_path (lua_State *L, struct rspamd_config *cfg);
+
struct memory_pool_s * rspamd_lua_check_mempool (lua_State * L);