@@ -137,7 +137,7 @@ local function need_av_check(task, rule) | |||
end | |||
local function check_av_cache(task, rule, fn) | |||
local function redis_av_cb(task, err, data) | |||
local function redis_av_cb(err, data) | |||
if data and type(data) == 'string' then | |||
-- Cached | |||
if data ~= 'OK' then | |||
@@ -172,7 +172,7 @@ end | |||
local function save_av_cache(task, rule, to_save) | |||
local key = task:get_digest() | |||
local function redis_set_cb(task, err, data) | |||
local function redis_set_cb(err, data) | |||
-- Do nothing | |||
if err then | |||
rspamd_logger.errx(task, 'failed to save virus cache for %s -> "%s": %s', |
@@ -65,7 +65,7 @@ local function asn_check(task) | |||
if redis_params then | |||
local redis_key = options.key_prefix .. ip:to_string() | |||
local ret,conn,upstream | |||
local function redis_asn_set_cb(task, err, data) | |||
local function redis_asn_set_cb(err, data) | |||
if not err then | |||
upstream:ok() | |||
else | |||
@@ -101,13 +101,13 @@ local function asn_check(task) | |||
local function asn_check_cache(ip, continuation_func) | |||
local key = options.key_prefix .. ip:to_string() | |||
local function redis_asn_get_cb(task, err, data) | |||
local function redis_asn_get_cb(err, data) | |||
if err or not data or type(data[1]) ~= 'string' then | |||
continuation_func(ip) | |||
else | |||
asn_set(data[1], data[2], data[3]) | |||
-- Refresh key | |||
local function redis_asn_expire_cb(task, err, data) | |||
local function redis_asn_expire_cb(err, data) | |||
end | |||
local ret,_,_ = rspamd_redis_make_request(task, |
@@ -92,7 +92,7 @@ local function dmarc_callback(task) | |||
return maybe_force_action('na') | |||
end | |||
local function dmarc_report_cb(task, err, data) | |||
local function dmarc_report_cb(err, data) | |||
if not err then | |||
rspamd_logger.infox(task, '<%1> dmarc report saved for %2', | |||
task:get_message_id(), from[1]['domain']) |
@@ -602,7 +602,7 @@ redis_params = rspamd_parse_redis_server('fann_scores') | |||
local function maybe_load_fann(task, continue_cb, call_if_fail) | |||
local function load_fann() | |||
local function redis_fann_load_cb(task, err, data) | |||
local function redis_fann_load_cb(err, data) | |||
if not err and type(data) == 'table' and type(data[2]) == 'string' then | |||
local version = tonumber(data[1]) | |||
local err,ann_data = rspamd_util.zstd_decompress(data[2]) | |||
@@ -653,7 +653,7 @@ local function maybe_load_fann(task, continue_cb, call_if_fail) | |||
end | |||
local function check_fann() | |||
local function redis_fann_check_cb(task, err, data) | |||
local function redis_fann_check_cb(err, data) | |||
if not err and type(data) == 'string' then | |||
local version = tonumber(data) | |||
@@ -737,7 +737,7 @@ local function create_fann() | |||
end | |||
local function save_fann(task, is_spam) | |||
local function redis_fann_save_cb(task, err, data) | |||
local function redis_fann_save_cb(err, data) | |||
if err then | |||
rspamd_logger.errx(task, "cannot save neural net to redis: %s", err) | |||
end |
@@ -145,7 +145,7 @@ local function greylist_check(task) | |||
local hash_key = body_key .. meta_key | |||
local upstream | |||
local function redis_set_cb(task, err, data) | |||
local function redis_set_cb(err, data) | |||
if not err then | |||
upstream:ok() | |||
else | |||
@@ -154,7 +154,7 @@ local function greylist_check(task) | |||
end | |||
end | |||
local function redis_get_cb(task, err, data) | |||
local function redis_get_cb(err, data) | |||
local ret_body = false | |||
local greylisted_body = false | |||
local ret_meta = false | |||
@@ -240,7 +240,7 @@ local function greylist_set(task) | |||
local upstream, ret, conn | |||
local hash_key = body_key .. meta_key | |||
local function redis_set_cb(task, err, data) | |||
local function redis_set_cb(err, data) | |||
if not err then | |||
upstream:ok() | |||
else |
@@ -105,7 +105,7 @@ local ip_score_set = function(task) | |||
return old_score + score, new_total | |||
end | |||
local score_set_cb = function(task, err, data) | |||
local score_set_cb = function(err, data) | |||
if err then | |||
rspamd_logger.infox(task, 'got error while IP score changing: %1', err) | |||
end | |||
@@ -210,7 +210,7 @@ end | |||
local ip_score_check = function(task) | |||
local asn, country, ipnet = ip_score_get_task_vars(task) | |||
local ip_score_redis_cb = function(task, err, data) | |||
local ip_score_redis_cb = function(err, data) | |||
local function calculate_score(score) | |||
local parts = asn_re:split(score) | |||
local rep = tonumber(parts[1]) |
@@ -317,7 +317,7 @@ local function multimap_callback(task, rule) | |||
return false | |||
end | |||
local function redis_map_cb(task, err, data) | |||
local function redis_map_cb(err, data) | |||
if not err and type(data) ~= 'userdata' then | |||
callback(data) | |||
end |
@@ -60,7 +60,7 @@ local function mx_check(task) | |||
if all(function(k, elt) return elt.checked end, mxes) then | |||
-- Save cache | |||
local key = settings.key_prefix .. mx_domain | |||
local function redis_cache_cb(task, err, data) | |||
local function redis_cache_cb(err, data) | |||
if err ~= nil then | |||
rspamd_logger.errx(task, 'redis_cache_cb received error: %1', err) | |||
return | |||
@@ -189,7 +189,7 @@ local function mx_check(task) | |||
forced = true | |||
}) | |||
else | |||
local function redis_cache_get_cb(task, err, data) | |||
local function redis_cache_get_cb(err, data) | |||
if err or type(data) ~= 'string' then | |||
local r = task:get_resolver() | |||
r:resolve('mx', { |
@@ -207,7 +207,7 @@ local function check_limits(task, args) | |||
local key = fun.foldl(function(acc, k) return acc .. k[2] end, '', args) | |||
local ret,upstream | |||
--- Called when value is got from server | |||
local function rate_get_cb(task, err, data) | |||
local function rate_get_cb(err, data) | |||
if err then | |||
rspamd_logger.infox(task, 'got error while getting limit: %1', err) | |||
upstream:fail() | |||
@@ -309,7 +309,7 @@ local function set_limits(task, args) | |||
local key = fun.foldl(function(acc, k) return acc .. k[2] end, '', args) | |||
local ret, upstream | |||
local function rate_set_cb(task, err, data) | |||
local function rate_set_cb(err, data) | |||
if not err then | |||
upstream:ok() | |||
else | |||
@@ -317,7 +317,7 @@ local function set_limits(task, args) | |||
err, upstream:get_addr()) | |||
end | |||
end | |||
local function rate_get_cb(task, err, data) | |||
local function rate_get_cb(err, data) | |||
if err then | |||
rspamd_logger.infox(task, 'got error while setting limit: %1', err) | |||
upstream:fail() |
@@ -42,7 +42,7 @@ local function make_key(goop) | |||
end | |||
local function replies_check(task) | |||
local function redis_get_cb(task, err, data) | |||
local function redis_get_cb(err, data) | |||
if err ~= nil then | |||
rspamd_logger.errx('redis_get_cb received error: %1', err) | |||
return | |||
@@ -83,7 +83,7 @@ local function replies_check(task) | |||
end | |||
local function replies_set(task) | |||
local function redis_set_cb(task, err, data) | |||
local function redis_set_cb(err, data) | |||
if err ~=nil then | |||
rspamd_logger.errx('redis_set_cb received error: %1', err) | |||
end |
@@ -528,7 +528,7 @@ local function gen_redis_callback(handler, id) | |||
return function(task) | |||
local key = handler(task) | |||
local function redis_settings_cb(task, err, data) | |||
local function redis_settings_cb(err, data) | |||
if not err and type(data) == 'string' then | |||
local ucl = require "ucl" | |||
local parser = ucl.parser() |