aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/antivirus.lua2
-rw-r--r--src/plugins/lua/asn.lua9
-rw-r--r--src/plugins/lua/dmarc.lua1
-rw-r--r--src/plugins/lua/fann_classifier.lua11
-rw-r--r--src/plugins/lua/greylist.lua10
-rw-r--r--src/plugins/lua/hfilter.lua8
-rw-r--r--src/plugins/lua/ip_score.lua6
-rw-r--r--src/plugins/lua/metadata_exporter.lua3
-rw-r--r--src/plugins/lua/multimap.lua1
-rw-r--r--src/plugins/lua/mx_check.lua6
-rw-r--r--src/plugins/lua/phishing.lua2
-rw-r--r--src/plugins/lua/ratelimit.lua9
-rw-r--r--src/plugins/lua/replies.lua4
-rw-r--r--src/plugins/lua/spamassassin.lua4
-rw-r--r--src/plugins/lua/trie.lua4
15 files changed, 34 insertions, 46 deletions
diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua
index c55305f2a..91ac61af6 100644
--- a/src/plugins/lua/antivirus.lua
+++ b/src/plugins/lua/antivirus.lua
@@ -346,7 +346,7 @@ local function clamav_check(task, rule)
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: (.+)')
diff --git a/src/plugins/lua/asn.lua b/src/plugins/lua/asn.lua
index 7fff000a4..d7afa2507 100644
--- a/src/plugins/lua/asn.lua
+++ b/src/plugins/lua/asn.lua
@@ -71,7 +71,7 @@ local function asn_check(task)
if not redis_err then
upstream:ok()
else
- rspamd_logger.infox(task, 'got error %s when setting asn record on server %s',
+ rspamd_logger.errx(task, 'got error %s when setting asn record on server %s',
redis_err, upstream:get_addr())
upstream:fail()
end
@@ -89,8 +89,7 @@ local function asn_check(task)
redis_key, tostring(options['expire'])
})
else
- rspamd_logger.infox(task, 'got error while connecting to redis: %1', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error while connecting to redis')
end
end
end
@@ -126,12 +125,12 @@ local function asn_check(task)
{key, tostring(options.expire)} -- arguments
)
if not ret then
- upstream:fail()
+ rspamd_logger.err('got error connecting to redis')
end
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
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index cdbc8700e..400882755 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -116,6 +116,7 @@ local function dmarc_callback(task)
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)
diff --git a/src/plugins/lua/fann_classifier.lua b/src/plugins/lua/fann_classifier.lua
index 770f244d8..3b360d9a0 100644
--- a/src/plugins/lua/fann_classifier.lua
+++ b/src/plugins/lua/fann_classifier.lua
@@ -89,8 +89,7 @@ local function maybe_load_fann(task, continue_cb, call_if_fail)
{key, 'version', 'data', 'spam', 'ham'} -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'redis error on host %s', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error connecting to redis')
end
end
@@ -124,8 +123,7 @@ local function maybe_load_fann(task, continue_cb, call_if_fail)
{key, 'version'} -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'redis error on host %s', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error connecting to redis')
end
end
@@ -227,8 +225,7 @@ local function save_fann(task, is_spam)
conn:add_cmd('HINCRBY', {key, 'ham', 1})
end
else
- rspamd_logger.errx(task, 'redis error on host %s: %s', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error connecting to redis')
end
end
@@ -282,7 +279,7 @@ if redis_params then
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()
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua
index 354c2b3d2..36819e1d0 100644
--- a/src/plugins/lua/greylist.lua
+++ b/src/plugins/lua/greylist.lua
@@ -225,8 +225,7 @@ local function greylist_check(task)
{body_key, meta_key} -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'cannot make redis request to check results')
- upstream:fail()
+ rspamd_logger.err(task, 'cannot make redis request to check results')
end
end
@@ -304,8 +303,7 @@ local function greylist_set(task)
meta_key, tostring(settings['expire'])
})
else
- rspamd_logger.infox(task, 'got error while connecting to redis: %1', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error while connecting to redis')
end
elseif do_greylisting or do_greylisting_required then
local t = tostring(math.floor(rspamd_util.get_time()))
@@ -329,9 +327,7 @@ local function greylist_set(task)
meta_key, tostring(settings['expire']), t
})
else
- rspamd_logger.infox(task, 'got error while connecting to redis: %s',
- upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error while connecting to redis')
end
else
if action ~= 'no action' and action ~= 'reject' then
diff --git a/src/plugins/lua/hfilter.lua b/src/plugins/lua/hfilter.lua
index 6bf8358a9..0bcbc52ff 100644
--- a/src/plugins/lua/hfilter.lua
+++ b/src/plugins/lua/hfilter.lua
@@ -19,8 +19,7 @@ limitations under the License.
-- 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 = {
@@ -142,8 +141,11 @@ local function check_host(task, host, symbol_suffix, eq_ip, eq_host)
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
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua
index d8f61f511..ffffb22b1 100644
--- a/src/plugins/lua/ip_score.lua
+++ b/src/plugins/lua/ip_score.lua
@@ -166,8 +166,7 @@ local ip_score_set = function(task)
redis_args -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Redis HMSET failed on %s', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'error connecting to redis')
return
end
@@ -320,8 +319,7 @@ local ip_score_check = function(task)
args -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Call to redis at %s failed', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'error connecting to redis')
end
end
end
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua
index 70c10e6b7..d2c0fa620 100644
--- a/src/plugins/lua/metadata_exporter.lua
+++ b/src/plugins/lua/metadata_exporter.lua
@@ -93,8 +93,7 @@ local function metadata_exporter(task)
{channel, data} -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Redis PUBLISH failed')
- upstream:fail()
+ rspamd_logger.err(task, 'error connecting to redis')
end
end
if url then
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua
index 9783e99cb..0e0ead474 100644
--- a/src/plugins/lua/multimap.lua
+++ b/src/plugins/lua/multimap.lua
@@ -528,6 +528,7 @@ local function multimap_callback(task, rule)
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
diff --git a/src/plugins/lua/mx_check.lua b/src/plugins/lua/mx_check.lua
index fbf68d6d7..f5a44bc4e 100644
--- a/src/plugins/lua/mx_check.lua
+++ b/src/plugins/lua/mx_check.lua
@@ -90,8 +90,7 @@ local function mx_check(task)
{key, tostring(settings.expire_novalid), '0'} -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Redis SETEX failed')
- upstream:fail()
+ rspamd_logger.err(task, 'got error connecting to redis')
end
else
local valid_mx = {}
@@ -108,8 +107,7 @@ local function mx_check(task)
{key, tostring(settings.expire), table.concat(valid_mx, ';')} -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Redis SETEX failed')
- upstream:fail()
+ rspamd_logger.err(task, 'error connecting to redis')
end
end
end
diff --git a/src/plugins/lua/phishing.lua b/src/plugins/lua/phishing.lua
index 015e079dd..1383fcd05 100644
--- a/src/plugins/lua/phishing.lua
+++ b/src/plugins/lua/phishing.lua
@@ -177,7 +177,7 @@ local function phishing_map(mapname, phishmap, id)
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)
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index 92d80fe32..f15d8633e 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -308,8 +308,7 @@ local function check_limits(task, args)
fun.totable(fun.map(function(l) return l[2] end, args)) -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Redis MGET failed on %s', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error connecting to redis')
end
end
@@ -378,8 +377,7 @@ local function set_limits(task, args)
conn:add_cmd('setex', v)
end, fun.drop_n(1, values))
else
- rspamd_logger.infox(task, 'got error while connecting to redis: %1', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error while connecting to redis')
end
end
end
@@ -394,8 +392,7 @@ local function set_limits(task, args)
fun.totable(fun.map(function(l) return l[2] end, args)) -- arguments
)
if not ret then
- rspamd_logger.errx(task, 'Redis MGET failed on %s', upstream:get_addr())
- upstream:fail()
+ rspamd_logger.err(task, 'got error connecting to redis')
end
end
diff --git a/src/plugins/lua/replies.lua b/src/plugins/lua/replies.lua
index 314f09083..c8e4bb6b6 100644
--- a/src/plugins/lua/replies.lua
+++ b/src/plugins/lua/replies.lua
@@ -65,7 +65,7 @@ local function replies_check(task)
-- 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
@@ -96,7 +96,7 @@ local function replies_set(task)
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
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 07a80bb90..f6bb37fdf 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -1097,10 +1097,10 @@ local function apply_replacements(str)
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'])
diff --git a/src/plugins/lua/trie.lua b/src/plugins/lua/trie.lua
index 443f2e5de..1be5b1d98 100644
--- a/src/plugins/lua/trie.lua
+++ b/src/plugins/lua/trie.lua
@@ -18,7 +18,7 @@ limitations under the License.
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
@@ -122,7 +122,7 @@ local function process_trie_conf(symbol, cf)
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