summaryrefslogtreecommitdiffstats
path: root/rules/headers_checks.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-28 12:48:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-28 12:48:52 +0100
commit3b8eb470b544364090de30d3e0fee714ec535876 (patch)
tree878001a32bce151849d5751f601a4c07cc23467d /rules/headers_checks.lua
parent240f1859bbb0080b26d91e1d3839dc0c66bb789b (diff)
downloadrspamd-3b8eb470b544364090de30d3e0fee714ec535876.tar.gz
rspamd-3b8eb470b544364090de30d3e0fee714ec535876.zip
[Fix] Fix REPLYTO_UNPARSEABLE rule
Diffstat (limited to 'rules/headers_checks.lua')
-rw-r--r--rules/headers_checks.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/rules/headers_checks.lua b/rules/headers_checks.lua
index ebe3e0aa0..cc28cab0b 100644
--- a/rules/headers_checks.lua
+++ b/rules/headers_checks.lua
@@ -176,9 +176,13 @@ rspamd_config:register_symbol{
group = 'header',
}
+local function get_raw_header(task, name)
+ return ((task:get_header_full(name) or {})[1] or {})['raw']
+end
+
local check_replyto_id = rspamd_config:register_callback_symbol('CHECK_REPLYTO', 1.0,
function (task)
- local replyto = task:get_header('Reply-To')
+ local replyto = get_raw_header(task, 'Reply-To')
if not replyto then return false end
local rt = util.parse_mail_address(replyto)
if not (rt and rt[1]) then
@@ -202,7 +206,7 @@ local check_replyto_id = rspamd_config:register_callback_symbol('CHECK_REPLYTO',
-- See if Reply-To matches From in some way
local from = task:get_from(2)
- local from_h = task:get_header('From')
+ local from_h = get_raw_header(task, 'From')
if not (from and from[1]) then return false end
if (from_h and from_h == replyto) then
-- From and Reply-To are identical
@@ -220,7 +224,8 @@ local check_replyto_id = rspamd_config:register_callback_symbol('CHECK_REPLYTO',
end
end
-- See if the Display Names match
- if (from[1].name and rt[1].name and util.strequal_caseless(from[1].name, rt[1].name)) then
+ if (from[1].name and rt[1].name and
+ util.strequal_caseless(from[1].name, rt[1].name)) then
task:insert_result('REPLYTO_DN_EQ_FROM_DN', 1.0)
end
end