diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-23 13:03:33 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-03-23 13:03:33 +0000 |
commit | 7ad0e93ce61d00b9b044cd2ee9cde0d51a5d7bd1 (patch) | |
tree | 146b34377c2762d6a8e7e5069de3caa7f2447d77 | |
parent | 69624d818569c70e721f0293e8bfdcca061a9e71 (diff) | |
download | rspamd-7ad0e93ce61d00b9b044cd2ee9cde0d51a5d7bd1.tar.gz rspamd-7ad0e93ce61d00b9b044cd2ee9cde0d51a5d7bd1.zip |
[Fix] Fix disabling of squeezed symbols
Issue: #2106
-rw-r--r-- | lualib/lua_squeeze_rules.lua | 3 | ||||
-rw-r--r-- | src/libserver/symbols_cache.c | 12 |
2 files changed, 10 insertions, 5 deletions
diff --git a/lualib/lua_squeeze_rules.lua b/lualib/lua_squeeze_rules.lua index b2560ddba..ef098a2d3 100644 --- a/lualib/lua_squeeze_rules.lua +++ b/lualib/lua_squeeze_rules.lua @@ -31,7 +31,6 @@ local function gen_lua_squeeze_function(order) return function(task) local symbols_disabled = task:cache_get('squeezed_disable') for _,data in ipairs(squeezed_rules[order]) do - if not symbols_disabled or not symbols_disabled[data[2]] then local ret = {data[1](task)} @@ -90,6 +89,7 @@ exports.squeeze_rule = function(s, func) if not squeeze_function_ids[1] then squeeze_function_ids[1] = rspamd_config:register_symbol{ type = 'callback', + flags = 'squeezed', callback = gen_lua_squeeze_function(1), name = squeeze_sym, description = 'Meta rule for Lua rules that can be squeezed', @@ -137,6 +137,7 @@ local function register_topology_symbol(order) squeeze_function_ids[order] = rspamd_config:register_symbol{ type = 'callback', + flags = 'squeezed', callback = gen_lua_squeeze_function(order), name = ord_sym, description = 'Meta rule for Lua rules that can be squeezed, order ' .. tostring(order), diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index d86a2b6f4..dd29f4db1 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -1271,7 +1271,6 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task, setbit (checkpoint->processed_bits, item->id * 2); if (!item->enabled || - (item->type & SYMBOL_TYPE_SQUEEZED) || (RSPAMD_TASK_IS_EMPTY (task) && !(item->type & SYMBOL_TYPE_EMPTY))) { check = FALSE; } @@ -2334,10 +2333,15 @@ rspamd_symbols_cache_disable_symbol_checkpoint (struct rspamd_task *task, /* Set executed and finished flags */ item = g_ptr_array_index (cache->items_by_id, id); - setbit (checkpoint->processed_bits, item->id * 2); - setbit (checkpoint->processed_bits, item->id * 2 + 1); + if (!(item->type & SYMBOL_TYPE_SQUEEZED)) { + setbit (checkpoint->processed_bits, item->id * 2); + setbit (checkpoint->processed_bits, item->id * 2 + 1); - msg_debug_task ("disable execution of %s", symbol); + msg_debug_task ("disable execution of %s", symbol); + } + else { + msg_debug_task ("skip squeezed symbol %s", symbol); + } } else { msg_info_task ("cannot disable %s: not found", symbol); |