local function reputation_dns_get_token(task, rule, token, continuation_cb)
local r = task:get_resolver()
- local to_resolve = gen_token_key(token)
- local dns_name = to_resolve .. '.' .. rule.backend.config.list
+ local key = gen_token_key(token, rule)
+ local dns_name = key .. '.' .. rule.backend.config.list
local function dns_callback(_, to_resolve, results, err)
if err and (err ~= 'requested record is not found' and err ~= 'no records with this name') then
fun.each(function(e)
local vals = lua_util.rspamd_str_split(e, "=")
if vals and #vals == 2 then
- local nv = tonumber[vals[2]]
+ local nv = tonumber(vals[2])
if nv then
values[vals[1]] = nv
end
end
local function reputation_redis_get_token(task, rule, token, continuation_cb)
- local key = gen_token_key(token)
+ local key = gen_token_key(token, rule)
local function redis_get_cb(err, data)
if data then
end
local function reputation_redis_set_token(task, rule, token, values, continuation_cb)
- local key = gen_token_key(token)
+ local key = gen_token_key(token, rule)
- local ret,conn,upstream
+ local ret,conn
local function redis_set_cb(err, data)
if err then
end
-- We start from expiry update
- ret,conn,upstream = rspamd_redis_make_request(task,
+ ret,conn = rspamd_redis_make_request(task,
redis_params, -- connect params
nil, -- hash key
true, -- is write
}
local function is_rule_applicable(task, rule)
+ local ip = task:get_from_ip()
if rule.config.outbound then
if not (task:get_user() or (ip and ip:is_local())) then
return false
end
if rule.config.whitelisted_ip_map then
- if rule.config.whitelisted_ip_map:get_key(task:get_from_ip()) then
+ if rule.config.whitelisted_ip_map:get_key(ip) then
return false
end
end
end
end
-local rules = {}
-
local function callback_gen(cb, rule)
return function(task)
cb(task, rule)
}
end
- rules.symbol = rule
end
redis_params = rspamd_parse_redis_server('reputation')
end
if opts['rules'] then
- for k,v in opts['rules'] do
- if not v.selector or not v.selector.type then
+ for k,v in pairs(opts['rules']) do
+ if not ((v or E).selector or E).type then
rspamd_logger.errx(rspamd_config, "no selector defined for rule %s", k)
else
parse_rule(k, v)