summaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-07 11:48:48 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-07 11:49:17 +0000
commit207375a0f80a29ca6aac64a0b2f164fd39ac2799 (patch)
tree7880980a463a118c304052448fb0a890248c965b /rules
parentf05496beabff912e4ff87c21a34bc4f2884fc33b (diff)
downloadrspamd-207375a0f80a29ca6aac64a0b2f164fd39ac2799.tar.gz
rspamd-207375a0f80a29ca6aac64a0b2f164fd39ac2799.zip
[Fix] Fix MISSING_MIME_VERSION rule for plain messages
Diffstat (limited to 'rules')
-rw-r--r--rules/misc.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/rules/misc.lua b/rules/misc.lua
index 28fb19f5c..151500d88 100644
--- a/rules/misc.lua
+++ b/rules/misc.lua
@@ -716,13 +716,15 @@ local check_mime_id = rspamd_config:register_callback_symbol('CHECK_MIME', 1.0,
-- Make sure there is a MIME-Version header
local mv = task:get_header('MIME-Version')
+ local missing_mime = false
if (not mv) then
- task:insert_result('MISSING_MIME_VERSION', 1.0)
+ missing_mime = true
end
local found_ma = false
local found_plain = false
local found_html = false
+ local cte_7bit = false
for _,p in ipairs(parts) do
local mtype,subtype = p:get_type()
@@ -731,13 +733,27 @@ local check_mime_id = rspamd_config:register_callback_symbol('CHECK_MIME', 1.0,
found_ma = true
end
if (ctype == 'text/plain') then
+ if p:get_cte() == '7bit' then
+ cte_7bit = true
+ end
found_plain = true
end
if (ctype == 'text/html') then
+ if p:get_cte() == '7bit' then
+ cte_7bit = true
+ end
found_html = true
end
end
+ if missing_mime then
+ if not found_ma and ((found_plain or found_html) and cte_7bit) then
+ -- Skip symbol insertion
+ else
+ task:insert_result('MISSING_MIME_VERSION', 1.0)
+ end
+ end
+
if (found_ma) then
if (not found_plain) then
task:insert_result('MIME_MA_MISSING_TEXT', 1.0)