local bad_hosts = {}
local good_hosts = {}
local whitelist = nil
+
local rspamd_logger = require "rspamd_logger"
+local fun = require "fun"
+
local check_local = false
local check_authed = false
local function check_quantity_received (task)
local recvh = task:get_received_headers()
+ local nreceived = fun.reduce(function(acc, rcvd)
+ return acc + 1
+ end, 0, fun.filter(function(h)
+ return not h['artificial']
+ end, recvh))
+
local function recv_dns_cb(_, to_resolve, results, err)
if err and (err ~= 'requested record is not found' and err ~= 'no records with this name') then
rspamd_logger.errx(task, 'error looking up %s: %s', to_resolve, err)
task:inc_dns_req()
if not results then
- if recvh and #recvh <= 1 then
+ if nreceived <= 1 then
task:insert_result(symbol, 1)
task:insert_result(symbol_strict, 1)
-- Check for MUAs
end
end
- task:insert_result(symbol, 1)
- for _,h in ipairs(bad_hosts) do
- if string.find(results[1], h) then
+ if nreceived <= 1 then
+ task:insert_result(symbol, 1)
+ for _,h in ipairs(bad_hosts) do
+ if string.find(results[1], h) then
- task:insert_result(symbol_strict, 1, h)
- return
+ task:insert_result(symbol_strict, 1, h)
+ return
+ end
end
end
end
return
end
- if recvh and #recvh <= 1 then
+ if nreceived <= 1 then
local ret = true
local r = recvh[1]