From 253067d2b539cadb507ba43530f593f0a187ad91 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 4 Dec 2019 10:10:14 +0000 Subject: [Minor] Allow to disable virtual symbols permanently --- src/lua/lua_config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/lua') 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"); -- cgit v1.2.3