commit 1b2b501: [Fix] Do not flag pre-result of virus scanners as least if action is reject

Gregor Dschung gregor at chkpnt.de
Sun Apr 19 20:28:06 UTC 2020


Author: Gregor Dschung
Date: 2020-04-19 10:33:17 +0200
URL: https://github.com/rspamd/rspamd/commit/1b2b501ceb111303062e9a5f247d01cd85e87c1c (refs/pull/3342/head)

[Fix] Do not flag pre-result of virus scanners as least if action is reject
fixes #3279

---
 lualib/lua_scanners/common.lua | 6 +++++-
 src/lua/lua_task.c             | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lualib/lua_scanners/common.lua b/lualib/lua_scanners/common.lua
index f286d963a..5c298b46f 100644
--- a/lualib/lua_scanners/common.lua
+++ b/lualib/lua_scanners/common.lua
@@ -68,6 +68,7 @@ local function yield_result(task, rule, vname, dyn_weight, is_fail)
   local symbol
   local threat_table = {}
   local threat_info
+  local flags
 
   -- This should be more generic
   if not is_fail then
@@ -112,11 +113,14 @@ local function yield_result(task, rule, vname, dyn_weight, is_fail)
 
   if rule.action and is_fail ~= 'fail' and not all_whitelisted then
     threat_table = table.concat(threat_table, '; ')
+    if rule.action ~= 'reject' then
+      flags = 'least'
+    end
     task:set_pre_result(rule.action,
         lua_util.template(rule.message or 'Rejected', {
           SCANNER = rule.name,
           VIRUS = threat_table,
-        }), rule.name, nil, nil, 'least')
+        }), rule.name, nil, nil, flags)
   end
 end
 
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index f36e51824..b891d7d99 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -176,7 +176,7 @@ LUA_FUNCTION_DEF (task, adjust_result);
  * - module: string
  * - score: number
  * - priority: integer
- * - flags: flags sring
+ * - flags: flags string
  * - result: named result if needed
  *
  * @param {rspamd_action or string} action a numeric or string action value


More information about the Commits mailing list