aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libserver/rspamd_symcache.c17
-rw-r--r--src/libserver/rspamd_symcache.h3
-rw-r--r--src/lua/lua_config.c10
3 files changed, 19 insertions, 11 deletions
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c
index 4e9967945..6a4a9f7df 100644
--- a/src/libserver/rspamd_symcache.c
+++ b/src/libserver/rspamd_symcache.c
@@ -1598,14 +1598,18 @@ rspamd_symcache_is_item_allowed (struct rspamd_task *task,
{
const gchar *what = "execution";
+ if (!exec_only) {
+ what = "symbol insertion";
+ }
+
/* Static checks */
if (!item->enabled ||
(RSPAMD_TASK_IS_EMPTY (task) && !(item->type & SYMBOL_TYPE_EMPTY)) ||
(item->type & SYMBOL_TYPE_MIME_ONLY && !RSPAMD_TASK_IS_MIME(task))) {
if (!item->enabled) {
- msg_debug_cache_task ("skipping check of %s as it is permanently disabled",
- item->symbol);
+ msg_debug_cache_task ("skipping %s of %s as it is permanently disabled",
+ what, item->symbol);
return FALSE;
}
@@ -1623,10 +1627,6 @@ rspamd_symcache_is_item_allowed (struct rspamd_task *task,
}
}
- if (!exec_only) {
- what = "symbol insertion";
- }
-
/* Settings checks */
if (task->settings_elt != 0) {
guint32 id = task->settings_elt->id;
@@ -2760,14 +2760,15 @@ rspamd_symcache_is_checked (struct rspamd_task *task,
void
rspamd_symcache_disable_symbol_perm (struct rspamd_symcache *cache,
- const gchar *symbol)
+ const gchar *symbol,
+ gboolean resolve_parent)
{
struct rspamd_symcache_item *item;
g_assert (cache != NULL);
g_assert (symbol != NULL);
- item = rspamd_symcache_find_filter (cache, symbol, true);
+ item = rspamd_symcache_find_filter (cache, symbol, resolve_parent);
if (item) {
item->enabled = FALSE;
diff --git a/src/libserver/rspamd_symcache.h b/src/libserver/rspamd_symcache.h
index 6542e76ce..23d1a72ab 100644
--- a/src/libserver/rspamd_symcache.h
+++ b/src/libserver/rspamd_symcache.h
@@ -242,7 +242,8 @@ void rspamd_symcache_add_delayed_dependency (struct rspamd_symcache *cache,
* @param symbol
*/
void rspamd_symcache_disable_symbol_perm (struct rspamd_symcache *cache,
- const gchar *symbol);
+ const gchar *symbol,
+ gboolean resolve_parent);
/**
* Enable specific symbol in the cache
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");