diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-18 22:03:54 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-11-18 22:03:54 +0000 |
commit | d9d76b801cb8578867785054adf4234d808fcca2 (patch) | |
tree | 193a1de979e6a47028713c5c7273b8d6af2ed6f8 /lualib | |
parent | 3619509a29c5526cc8aa8277a9cebba83f935c8b (diff) | |
download | rspamd-d9d76b801cb8578867785054adf4234d808fcca2.tar.gz rspamd-d9d76b801cb8578867785054adf4234d808fcca2.zip |
[Fix] Allow to have negative actions limits
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/rspamd_config_transform.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lualib/rspamd_config_transform.lua b/lualib/rspamd_config_transform.lua index bca42691a..4f656ca9c 100644 --- a/lualib/rspamd_config_transform.lua +++ b/lualib/rspamd_config_transform.lua @@ -251,6 +251,24 @@ return function(cfg) logger.errx('no actions defined') end + -- Perform sanity check for actions + local actions_defs = {'greylist', 'add header', 'add_header', + 'rewrite subject', 'rewrite_subject', 'reject'} + + if not cfg.actions['no action'] and not cfg.actions['no_action'] and + not cfg.actions['accept'] then + for _,d in ipairs(actions_defs) do + if cfg.actions[d] then + if cfg.actions[d] < 0 then + cfg.actions['no action'] = cfg.actions[d] - 0.001 + logger.infox('set no action score to: %s, as action %s has negative score', + cfg.actions['no action'], d) + break + end + end + end + end + if not cfg.group then logger.errx('no symbol groups defined') else |