diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-08-07 11:41:28 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-08-07 11:41:28 +0100 |
commit | 662145d0554de5e769b92dab2d41173a98adcee5 (patch) | |
tree | ec28311a0bce6181f248ba7b50304293ad764e44 /rules/mid.lua | |
parent | bbd88232db43d18f5e0de5a6502848d4074621c5 (diff) | |
download | rspamd-662145d0554de5e769b92dab2d41173a98adcee5.tar.gz rspamd-662145d0554de5e769b92dab2d41173a98adcee5.zip |
[Minor] Reformat all Lua code, no functional changes
Diffstat (limited to 'rules/mid.lua')
-rw-r--r-- | rules/mid.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/rules/mid.lua b/rules/mid.lua index 14c701cf6..1bac26c61 100644 --- a/rules/mid.lua +++ b/rules/mid.lua @@ -17,7 +17,9 @@ limitations under the License. local rspamd_util = require "rspamd_util" local function mid_check_func(task) local mid = task:get_header('Message-ID') - if not mid then return false end + if not mid then + return false + end -- Check for 'bare' IP addresses in RHS if mid:find("@%d+%.%d+%.%d+%.%d+>$") then task:insert_result('MID_BARE_IP', 1.0) @@ -39,7 +41,7 @@ local function mid_check_func(task) local fd if (from and from[1] and from[1].domain and from[1].domain ~= '') then fd = from[1].domain:lower() - local _,_,md = mid:find("@([^>]+)>?$") + local _, _, md = mid:find("@([^>]+)>?$") -- See if all or part of the From address -- can be found in the Message-ID -- extract tld @@ -49,7 +51,7 @@ local function mid_check_func(task) fdtld = rspamd_util.get_tld(fd) mdtld = rspamd_util.get_tld(md) end - if (mid:lower():find(from[1].addr:lower(),1,true)) then + if (mid:lower():find(from[1].addr:lower(), 1, true)) then task:insert_result('MID_CONTAINS_FROM', 1.0) elseif (md and fd == md:lower()) then task:insert_result('MID_RHS_MATCH_FROM', 1.0) @@ -61,12 +63,12 @@ local function mid_check_func(task) local to = task:get_recipients(2) if (to and to[1] and to[1].domain and to[1].domain ~= '') then local td = to[1].domain:lower() - local _,_,md = mid:find("@([^>]+)>?$") + local _, _, md = mid:find("@([^>]+)>?$") -- Skip if from domain == to domain if ((fd and fd ~= td) or not fd) then -- See if all or part of the To address -- can be found in the Message-ID - if (mid:lower():find(to[1].addr:lower(),1,true)) then + if (mid:lower():find(to[1].addr:lower(), 1, true)) then task:insert_result('MID_CONTAINS_TO', 1.0) elseif (md and td == md:lower()) then task:insert_result('MID_RHS_MATCH_TO', 1.0) @@ -115,9 +117,11 @@ rspamd_config:register_symbol { callback = function(task) local mid = task:get_header('Message-ID') - if not mid then return end + if not mid then + return + end local mime_from = task:get_from('mime') - local _,_,mid_realm = mid:find("@([a-z]+)>?$") + local _, _, mid_realm = mid:find("@([a-z]+)>?$") if mid_realm and mime_from and mime_from[1] and mime_from[1].user then if (mid_realm == mime_from[1].user) then return true |