Browse Source

[Minor] Add implicit score for rbl and multimap rules

tags/2.6
Vsevolod Stakhov 4 years ago
parent
commit
2a4a393ff5
2 changed files with 15 additions and 3 deletions
  1. 9
    3
      src/plugins/lua/multimap.lua
  2. 6
    0
      src/plugins/lua/rbl.lua

+ 9
- 3
src/plugins/lua/multimap.lua View File

@@ -1265,6 +1265,10 @@ if opts and type(opts) == 'table' then
rule['symbols_set'][s] = 1
end, rule['symbols'])
end
if not rule.score then
rspamd_logger.infox(rspamd_config, 'set default score 0 for multimap rule %s', rule.symbol)
rule.score = 0
end
if rule['score'] then
-- Register metric symbol
rule.name = rule.symbol
@@ -1275,11 +1279,13 @@ if opts and type(opts) == 'table' then
end
end, fun.filter(function(r) return not r['prefilter'] end, rules))

fun.each(function(r)
-- prefilter symbils
fun.each(function(rule)
rspamd_config:register_symbol({
type = 'prefilter',
name = r['symbol'],
callback = gen_multimap_callback(r),
name = rule['symbol'],
score = rule.score or 0,
callback = gen_multimap_callback(rule),
})
end, fun.filter(function(r) return r['prefilter'] end, rules))


+ 6
- 0
src/plugins/lua/rbl.lua View File

@@ -954,6 +954,8 @@ local function add_rbl(key, rbl, global_opts)
rspamd_config:register_symbol{
type = 'virtual',
parent = id,
group = 'rbl',
score = 0,
name = prefix .. '_' .. rbl.symbol,
}
end
@@ -969,6 +971,8 @@ local function add_rbl(key, rbl, global_opts)
type = 'callback',
callback = callback,
name = rbl.symbol,
group = 'rbl',
score = 0,
flags = table.concat(flags_tbl, ',')
}
if not (rbl.is_whitelist or rbl.ignore_whitelist) then
@@ -1008,6 +1012,8 @@ local function add_rbl(key, rbl, global_opts)
type = 'virtual',
parent = id,
name = s,
group = 'rbl',
score = 0,
}
end
if rbl.is_whitelist then

Loading…
Cancel
Save