|
|
@@ -65,7 +65,12 @@ local function rbl_cb (task) |
|
|
|
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) |
|
|
|
end |
|
|
|
if not results then return end |
|
|
|
if not results then |
|
|
|
rspamd_logger.debugx(task, 'DNS RESPONSE: label=%1 results=%2 error=%3 rbl=%4', to_resolve, false, err, rule['rbls'][1]['symbol']) |
|
|
|
return |
|
|
|
else |
|
|
|
rspamd_logger.debugx(task, 'DNS RESPONSE: label=%1 results=%2 error=%3 rbl=%4', to_resolve, true, err, rule['rbls'][1]['symbol']) |
|
|
|
end |
|
|
|
|
|
|
|
for _,rbl in ipairs(rule.rbls) do |
|
|
|
if rbl['returncodes'] == nil and rbl['symbol'] ~= nil then |
|
|
@@ -75,6 +80,7 @@ local function rbl_cb (task) |
|
|
|
for _,result in pairs(results) do |
|
|
|
local ipstr = result:to_string() |
|
|
|
local foundrc |
|
|
|
rspamd_logger.debugx(task, '%s DNS result %s', to_resolve, ipstr) |
|
|
|
for s,i in pairs(rbl['returncodes']) do |
|
|
|
if type(i) == 'string' then |
|
|
|
if string.find(ipstr, '^' .. i .. '$') then |
|
|
@@ -110,6 +116,7 @@ local function rbl_cb (task) |
|
|
|
local params = {} -- indexed by rbl name |
|
|
|
|
|
|
|
local function gen_rbl_rule(to_resolve, rbl) |
|
|
|
rspamd_logger.debugx(task, 'DNS REQUEST: label=%1 rbl=%2', to_resolve, rbl['symbol']) |
|
|
|
if not params[to_resolve] then |
|
|
|
local nrule = { |
|
|
|
to_resolve = to_resolve, |