aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-11-09 17:06:17 +0000
committerGitHub <noreply@github.com>2021-11-09 17:06:17 +0000
commit711dca480131632fa2f352c44264fa8d65496fd3 (patch)
treeebf7b570ffa7cc2ab846f7bdef806cbbdeeb4fd3 /lualib
parent00e3b544777073664b7355dac1283d96c57756ca (diff)
parent7a8885d67262d8029742479f9360d8f282747d4e (diff)
downloadrspamd-711dca480131632fa2f352c44264fa8d65496fd3.tar.gz
rspamd-711dca480131632fa2f352c44264fa8d65496fd3.zip
Merge pull request #3969 from HeinleinSupport/fix/lua_cfg_transform
[Fix] lua_cfg_transform - silly break breaks actions
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_cfg_transform.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/lualib/lua_cfg_transform.lua b/lualib/lua_cfg_transform.lua
index 6fec243e9..050686df2 100644
--- a/lualib/lua_cfg_transform.lua
+++ b/lualib/lua_cfg_transform.lua
@@ -374,11 +374,17 @@ return function(cfg)
not cfg.actions['accept'] then
for _,d in ipairs(actions_defs) do
if cfg.actions[d] then
- if type(cfg.actions[d]) ~= 'table' then
- break
- elseif type(cfg.actions[d]) ~= 'number' then
+
+ local action_score = nil
+ if type(cfg.actions[d]) == 'number' then
+ action_score = cfg.actions[d]
+ elseif type(cfg.actions[d]) == 'table' and cfg.actions[d]['score'] then
+ action_score = cfg.actions[d]['score']
+ end
+
+ if type(cfg.actions[d]) ~= 'table' and not action_score then
cfg.actions[d] = nil
- elseif cfg.actions[d] < 0 then
+ elseif type(action_score) == 'number' and action_score < 0 then
cfg.actions['no_action'] = cfg.actions[d] - 0.001
logger.infox(rspamd_config, 'set no_action score to: %s, as action %s has negative score',
cfg.actions['no_action'], d)