diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-05 20:36:06 +0200 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-05 20:36:06 +0200 |
commit | 64022c191d7234f52dccc6d4009bf3b7d0491074 (patch) | |
tree | 90b0c374ca93475c2a17fea1ecf7b75122be8ebd /rules/forwarding.lua | |
parent | 42ef4ee31d73aca6aef41f66bc825a4296070cca (diff) | |
download | rspamd-64022c191d7234f52dccc6d4009bf3b7d0491074.tar.gz rspamd-64022c191d7234f52dccc6d4009bf3b7d0491074.zip |
[Fix] Fix processing of messages without received headers
Diffstat (limited to 'rules/forwarding.lua')
-rw-r--r-- | rules/forwarding.lua | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/rules/forwarding.lua b/rules/forwarding.lua index 6ee0b9a97..c5c8912af 100644 --- a/rules/forwarding.lua +++ b/rules/forwarding.lua @@ -81,24 +81,27 @@ rspamd_config.FORWARDED = { local matches = 0 -- Retrieve and loop through all Received headers local rcvds = task:get_header_full('Received') - for _, rcvd in ipairs(rcvds) do + + if rcvds then + for _, rcvd in ipairs(rcvds) do local _,_,addr = rcvd['decoded']:lower():find("%sfor%s<(.-)>") if addr then - matches = matches + 1 - -- Check that it doesn't match the envrcpt - -- TODO: remove any plus addressing? - if addr ~= envrcpts[1].addr:lower() then - -- Check for mailing-lists as they will have the same signature - if matches < 2 and lu and to and to[1].addr:lower() == addr then - return false - else - return true, addr - end + matches = matches + 1 + -- Check that it doesn't match the envrcpt + -- TODO: remove any plus addressing? + if addr ~= envrcpts[1].addr:lower() then + -- Check for mailing-lists as they will have the same signature + if matches < 2 and lu and to and to[1].addr:lower() == addr then + return false + else + return true, addr end - -- Prevent any other iterations as we only want - -- process the first matching Received header - return false + end + -- Prevent any other iterations as we only want + -- process the first matching Received header + return false end + end end return false end, |