aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-04 10:10:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-12-04 10:10:14 +0000
commit253067d2b539cadb507ba43530f593f0a187ad91 (patch)
tree5e23b037f613a3899dfe6b1664ffe94b2a33eef7 /src/lua
parent35de6fb5501aa829cd2b327ff6c9893bbc75a8a2 (diff)
downloadrspamd-253067d2b539cadb507ba43530f593f0a187ad91.tar.gz
rspamd-253067d2b539cadb507ba43530f593f0a187ad91.zip
[Minor] Allow to disable virtual symbols permanently
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_config.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index b50949bdd..266dbd111 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -431,9 +431,10 @@ LUA_FUNCTION_DEF (config, add_condition);
LUA_FUNCTION_DEF (config, enable_symbol);
/***
- * @method rspamd_config:disable_symbol(symbol)
+ * @method rspamd_config:disable_symbol(symbol, [disable_parent=true])
* Disables execution for the specified symbol
* @param {string} symbol symbol's name
+ * @param {boolean} disable_parent if true then disable parent execution in case of a virtual symbol
*/
LUA_FUNCTION_DEF (config, disable_symbol);
@@ -2898,9 +2899,14 @@ lua_config_disable_symbol (lua_State *L)
LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
const gchar *sym = luaL_checkstring (L, 2);
+ gboolean disable_parent = TRUE;
if (cfg && sym) {
- rspamd_symcache_disable_symbol_perm (cfg->cache, sym);
+ if (lua_isboolean (L, 3)) {
+ disable_parent = lua_toboolean (L, 3);
+ }
+
+ rspamd_symcache_disable_symbol_perm (cfg->cache, sym, disable_parent);
}
else {
return luaL_error (L, "invalid arguments");