upstream:ok()
data = tostring(data)
- local s,_ = string.find(data, ' FOUND')
+ local s = string.find(data, ' FOUND')
local cached = 'OK'
if s then
local vname = string.match(data:sub(1, s - 1), 'stream: (.+)')
end
end
- local ret,_,_ = rspamd_redis_make_request(task,
+ local ret = rspamd_redis_make_request(task,
redis_params, -- connect params
key, -- hash key
false, -- is write
local function dmarc_dns_cb(_, to_resolve, results, err)
+ task:inc_dns_req()
local lookup_domain = string.sub(to_resolve, 8)
if err and (err ~= 'requested record is not found' and err ~= 'no records with this name') then
task:insert_result(dmarc_symbols['dnsfail'], 1.0, lookup_domain .. ' : ' .. err)
maybe_load_fann(task, classify_cb, false)
end,
- learn = function(task, _, tokens, is_spam, _)
+ learn = function(task, _, tokens, is_spam)
local function learn_cb(_, is_loaded)
if not is_loaded then
create_fann()
-- Weight for checks_hellohost and checks_hello: 5 - very hard, 4 - hard, 3 - meduim, 2 - low, 1 - very low.
-- From HFILTER_HELO_* and HFILTER_HOSTNAME_* symbols the maximum weight is selected in case of their actuating.
-
---local dumper = require 'pl.pretty'.dump
+local rspamd_logger = require "rspamd_logger"
local rspamd_regexp = require "rspamd_regexp"
local rspamc_local_helo = "rspamc.local"
local checks_hellohost = {
local failed_address = 0
local resolved_address = {}
- local function check_host_cb_mx(_, _, results)
+ local function check_host_cb_mx(_, to_resolve, results, err)
task:inc_dns_req()
+ 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
task:insert_result('HFILTER_' .. symbol_suffix .. '_NORES_A_OR_MX', 1.0)
else
match_rule(rule, ip)
else
local cb = function (_, to_resolve, results, err)
+ task:inc_dns_req()
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
xd[1] = opts[mapname]
end
for _,d in ipairs(xd) do
- local s, _ = string.find(d, ':[^:]+$')
+ local s = string.find(d, ':[^:]+$')
if s then
local sym = string.sub(d, s + 1, -1)
local map = string.sub(d, 1, s - 1)
-- Create hash of in-reply-to and query redis
local key = make_key(irt)
- local ret,_,_ = rspamd_redis_make_request(task,
+ local ret = rspamd_redis_make_request(task,
redis_params, -- connect params
key, -- hash key
false, -- is write
end
-- Create hash of message-id and store to redis
local key = make_key(msg_id)
- local ret,_,_ = rspamd_redis_make_request(task,
+ local ret = rspamd_redis_make_request(task,
redis_params, -- connect params
key, -- hash key
true, -- is write
end
local function replace_all_tags(s)
- local sstr, _
+ local sstr
sstr = s
fun.each(function(n, t)
- sstr,_ = string.gsub(sstr, string.format("<%s>", n),
+ sstr = string.gsub(sstr, string.format("<%s>", n),
string.format("%s%s%s", pre, t, post))
end, replace['tags'])
local rspamd_logger = require "rspamd_logger"
local rspamd_trie = require "rspamd_trie"
-local _ = require "fun"
+local fun = require "fun"
local mime_trie
local raw_trie
if cf['file'] then
process_trie_file(symbol, cf)
elseif cf['patterns'] then
- _.each(function(pat)
+ fun.each(function(pat)
process_single_pattern(pat, symbol, cf)
end, cf['patterns'])
end