commit db18212: [Minor] lua_scanners - fix detected parts_match

Carsten Rosenberg c.rosenberg at heinlein-support.de
Sat May 30 20:28:10 UTC 2020


Author: Carsten Rosenberg
Date: 2020-05-29 22:43:59 +0200
URL: https://github.com/rspamd/rspamd/commit/db18212e766e805410ce2003f8d7229c5934ce7e (refs/pull/3385/head)

[Minor] lua_scanners - fix detected parts_match

---
 lualib/lua_scanners/common.lua | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lualib/lua_scanners/common.lua b/lualib/lua_scanners/common.lua
index a162828fb..67952923d 100644
--- a/lualib/lua_scanners/common.lua
+++ b/lualib/lua_scanners/common.lua
@@ -399,7 +399,10 @@ local function check_parts_match(task, rule)
       -- check detected content type (libmagic) regex matching
       if detected_ext then
         local magic = lua_magic_types[detected_ext] or {}
-        if match_filter(task, magic.ct, rule.mime_parts_filter_regex) then
+        if match_filter(task, rule, detected_ext, rule.mime_parts_filter_ext, 'ext') then
+          lua_util.debugm(rule.name, task, '%s: detected extension matched: |%s|', rule.log_prefix, detected_ext)
+          return true
+        elseif magic.ct and match_filter(task, rule, magic.ct, rule.mime_parts_filter_regex, 'regex') then
           lua_util.debugm(rule.name, task, '%s: regex detected libmagic content-type: %s',
               rule.log_prefix, magic.ct)
           return true


More information about the Commits mailing list