diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-04-07 15:50:09 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-04-07 15:58:45 +0200 |
commit | 8d535feef2e2a2c7d1a085cd990d6e321313da9e (patch) | |
tree | d05f693ce91b947d326fd2226983cf8a439b844f | |
parent | 3ca316cd22f55b484b0a00a5818617dd585325b4 (diff) | |
download | rspamd-8d535feef2e2a2c7d1a085cd990d6e321313da9e.tar.gz rspamd-8d535feef2e2a2c7d1a085cd990d6e321313da9e.zip |
[Minor] Antivirus: don't set action if all results were whitelisted
-rw-r--r-- | src/plugins/lua/antivirus.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua index 277a95c2b..e83308b4e 100644 --- a/src/plugins/lua/antivirus.lua +++ b/src/plugins/lua/antivirus.lua @@ -38,6 +38,7 @@ local function trim(s) end local function yield_result(task, rule, vname) + local all_whitelisted = true if type(vname) == 'string' then local symname = match_patterns(rule['symbol'], vname, rule['patterns']) if rule['whitelist'] and rule['whitelist']:get_key(vname) then @@ -52,6 +53,7 @@ local function yield_result(task, rule, vname) if rule['whitelist'] and rule['whitelist']:get_key(vn) then rspamd_logger.infox(task, '%s: "%s" is in whitelist', rule['type'], vn) else + all_whitelisted = false task:insert_result(symname, 1.0, vn) rspamd_logger.infox(task, '%s: virus found: "%s"', rule['type'], vn) end @@ -59,6 +61,7 @@ local function yield_result(task, rule, vname) end if rule['action'] then if type(vname) == 'table' then + if all_whitelisted then return end vname = table.concat(vname, '; ') end task:set_pre_result(rule['action'], |