aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/once_received.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lua/once_received.lua')
-rw-r--r--src/plugins/lua/once_received.lua30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua
index 04e2168c1..2a5552ab9 100644
--- a/src/plugins/lua/once_received.lua
+++ b/src/plugins/lua/once_received.lua
@@ -71,11 +71,11 @@ local function check_quantity_received (task)
else
rspamd_logger.infox(task, 'source hostname has not been passed to Rspamd from MTA, ' ..
'but we could resolve source IP address PTR %s as "%s"',
- to_resolve, results[1])
+ to_resolve, results[1])
task:set_hostname(results[1])
if good_hosts then
- for _,gh in ipairs(good_hosts) do
+ for _, gh in ipairs(good_hosts) do
if string.find(results[1], gh) then
return
end
@@ -84,7 +84,7 @@ local function check_quantity_received (task)
if nreceived <= 1 then
task:insert_result(symbol, 1)
- for _,h in ipairs(bad_hosts) do
+ for _, h in ipairs(bad_hosts) do
if string.find(results[1], h) then
task:insert_result(symbol_strict, 1, h)
@@ -104,17 +104,17 @@ local function check_quantity_received (task)
end
if whitelist and task_ip and whitelist:get_key(task_ip) then
rspamd_logger.infox(task, 'whitelisted mail from %s',
- task_ip:to_string())
+ task_ip:to_string())
return
end
local hn = task:get_hostname()
-- Here we don't care about received
if (not hn) and task_ip and task_ip:is_valid() then
- task:get_resolver():resolve_ptr({task = task,
- name = task_ip:to_string(),
- callback = recv_dns_cb,
- forced = true
+ task:get_resolver():resolve_ptr({ task = task,
+ name = task_ip:to_string(),
+ callback = recv_dns_cb,
+ forced = true
})
return
end
@@ -131,7 +131,7 @@ local function check_quantity_received (task)
local rhn = string.lower(r['real_hostname'])
-- Check for good hostname
if rhn and good_hosts then
- for _,gh in ipairs(good_hosts) do
+ for _, gh in ipairs(good_hosts) do
if string.find(rhn, gh) then
ret = false
break
@@ -146,8 +146,10 @@ local function check_quantity_received (task)
-- Unresolved host
task:insert_result(symbol, 1)
- if not hn then return end
- for _,h in ipairs(bad_hosts) do
+ if not hn then
+ return
+ end
+ for _, h in ipairs(bad_hosts) do
if string.find(hn, h) then
task:insert_result(symbol_strict, 1, h)
return
@@ -176,7 +178,7 @@ if opts then
callback = check_quantity_received,
})
- for n,v in pairs(opts) do
+ for n, v in pairs(opts) do
if n == 'symbol_strict' then
symbol_strict = v
elseif n == 'symbol_rdns' then
@@ -198,7 +200,7 @@ if opts then
elseif n == 'whitelist' then
local lua_maps = require "lua_maps"
whitelist = lua_maps.map_add('once_received', 'whitelist', 'radix',
- 'once received whitelist')
+ 'once received whitelist')
elseif n == 'symbol_mx' then
symbol_mx = v
end
@@ -214,7 +216,7 @@ if opts then
type = 'virtual',
parent = id
})
- rspamd_config:register_symbol({
+ rspamd_config:register_symbol({
name = symbol_strict,
type = 'virtual',
parent = id