{
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;
}
}
}
- if (!exec_only) {
- what = "symbol insertion";
- }
-
/* Settings checks */
if (task->settings_elt != 0) {
guint32 id = task->settings_elt->id;
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;
* @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
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);
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");