aboutsummaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-11 21:13:42 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-04-11 21:13:42 +0100
commit01c729e15e01db5a5353f783325c520ac069a532 (patch)
tree9327f7cc38bf509854db015c4a4fe522b8a39cc5 /rules
parentc0a1b24230297749e9e920dc3f0875ad75e420e5 (diff)
downloadrspamd-01c729e15e01db5a5353f783325c520ac069a532.tar.gz
rspamd-01c729e15e01db5a5353f783325c520ac069a532.zip
[Rules] Fix FPs for CTYPE_MIXED_BOGUS
Diffstat (limited to 'rules')
-rw-r--r--rules/headers_checks.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua
index c4e4a4a67..79b8e5c2f 100644
--- a/rules/headers_checks.lua
+++ b/rules/headers_checks.lua
@@ -1004,14 +1004,19 @@ rspamd_config.CTYPE_MIXED_BOGUS = {
if (not ct:lower():match('^multipart/mixed')) then return false end
local found = false
-- Check each part and look for a part that isn't multipart/* or text/plain or text/html
+ local ntext_parts = 0
for _,p in ipairs(parts) do
- local pct = p:get_header('Content-Type')
- if (pct) then
- pct = pct:lower()
- if not ((pct:match('^multipart/') or
- pct:match('^text/plain') or
- pct:match('^text/html'))) then
+ local mtype,_ = p:get_type()
+ if mtype then
+ if mtype == 'text' then
+ ntext_parts = ntext_parts + 1
+ if ntext_parts > 2 then
+ found = true
+ break
+ end
+ elseif mtype ~= 'multipart' then
found = true
+ break
end
end
end