]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Antivirus: don't set action if all results were whitelisted
authorAndrew Lewis <nerf@judo.za.org>
Fri, 7 Apr 2017 13:50:09 +0000 (15:50 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Fri, 7 Apr 2017 13:58:45 +0000 (15:58 +0200)
src/plugins/lua/antivirus.lua

index 277a95c2b2c8afe36902cb02effd010f6151e160..e83308b4e7b304d151fb1560818fc0091a74d138 100644 (file)
@@ -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'],