From: Andrew Lewis Date: Fri, 7 Apr 2017 13:50:09 +0000 (+0200) Subject: [Minor] Antivirus: don't set action if all results were whitelisted X-Git-Tag: 1.5.5~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8d535feef2e2a2c7d1a085cd990d6e321313da9e;p=rspamd.git [Minor] Antivirus: don't set action if all results were whitelisted --- 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'],