aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-18 13:55:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-09-18 13:55:51 +0100
commitaceaa1dcb93b0129cf33a02755181b3b153052a6 (patch)
tree1b0d2174c7be75f0dc61a509de42522c1f98fe8e /src
parent1ef294980a2587602361a3c1a6ec910dc2900e1b (diff)
downloadrspamd-aceaa1dcb93b0129cf33a02755181b3b153052a6.tar.gz
rspamd-aceaa1dcb93b0129cf33a02755181b3b153052a6.zip
[Minor] Reputation: Fix symbols
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/reputation.lua23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/plugins/lua/reputation.lua b/src/plugins/lua/reputation.lua
index 648efa53f..4276f23cc 100644
--- a/src/plugins/lua/reputation.lua
+++ b/src/plugins/lua/reputation.lua
@@ -73,7 +73,7 @@ local function add_symbol_score(task, rule, mult, params)
if not params then params = {tostring(mult)};
end
- if rule.config.split_symbols then
+ if rule.selector.config.split_symbols then
if mult >= 0 then
task:insert_result(rule.symbol .. '_SPAM', mult, params)
else
@@ -89,7 +89,7 @@ local function sub_symbol_score(task, rule, score)
local s = task:get_symbol(sym)[1]
return s.score
end
- if rule.config.split_symbols then
+ if rule.selector.config.split_symbols then
local spam_sym = rule.symbol .. '_SPAM'
local ham_sym = rule.symbol .. '_HAM'
@@ -1121,7 +1121,7 @@ local function parse_rule(name, tbl)
rule.config.whitelist, N)
end
- local symbol = name
+ local symbol = rule.selector.config.symbol or name
if tbl.symbol then
symbol = tbl.symbol
end
@@ -1156,26 +1156,27 @@ local function parse_rule(name, tbl)
end
if rule.enabled then
- rspamd_logger.infox(rspamd_config, 'Enable %s (%s backend) rule for symbol %s',
- sel_type, bk_type, rule.symbol)
+ rspamd_logger.infox(rspamd_config, 'Enable %s (%s backend) rule for symbol %s (split symbols: %s)',
+ sel_type, bk_type, rule.symbol,
+ rule.selector.config.split_symbols)
end
end)
-- We now generate symbol for checking
local id = rspamd_config:register_symbol{
- name = symbol,
+ name = rule.symbol,
type = 'normal',
callback = callback_gen(reputation_filter_cb, rule),
}
- if rule.config.split_symbols then
+ if rule.selector.config.split_symbols then
rspamd_config:register_symbol{
- name = symbol .. '_HAM',
+ name = rule.symbol .. '_HAM',
type = 'virtual',
parent = id,
}
rspamd_config:register_symbol{
- name = symbol .. '_SPAM',
+ name = rule.symbol .. '_SPAM',
type = 'virtual',
parent = id,
}
@@ -1190,7 +1191,7 @@ local function parse_rule(name, tbl)
if rule.selector.postfilter then
-- Also register a postfilter
rspamd_config:register_symbol{
- name = symbol .. '_POST',
+ name = rule.symbol .. '_POST',
type = 'postfilter,nostat',
callback = callback_gen(reputation_postfilter_cb, rule),
}
@@ -1199,7 +1200,7 @@ local function parse_rule(name, tbl)
if rule.selector.idempotent then
-- Has also idempotent component (e.g. saving data to the backend)
rspamd_config:register_symbol{
- name = symbol .. '_IDEMPOTENT',
+ name = rule.symbol .. '_IDEMPOTENT',
type = 'idempotent',
callback = callback_gen(reputation_idempotent_cb, rule),
}