From 8d535feef2e2a2c7d1a085cd990d6e321313da9e Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Fri, 7 Apr 2017 15:50:09 +0200 Subject: [Minor] Antivirus: don't set action if all results were whitelisted --- src/plugins/lua/antivirus.lua | 3 +++ 1 file changed, 3 insertions(+) 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'], -- cgit v1.2.3