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

rule['symbols_set'][s] = 1 rule['symbols_set'][s] = 1
end, rule['symbols']) end, rule['symbols'])
end 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 if rule['score'] then
-- Register metric symbol -- Register metric symbol
rule.name = rule.symbol rule.name = rule.symbol
end end
end, fun.filter(function(r) return not r['prefilter'] end, rules)) 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({ rspamd_config:register_symbol({
type = 'prefilter', 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)) end, fun.filter(function(r) return r['prefilter'] end, rules))



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

rspamd_config:register_symbol{ rspamd_config:register_symbol{
type = 'virtual', type = 'virtual',
parent = id, parent = id,
group = 'rbl',
score = 0,
name = prefix .. '_' .. rbl.symbol, name = prefix .. '_' .. rbl.symbol,
} }
end end
type = 'callback', type = 'callback',
callback = callback, callback = callback,
name = rbl.symbol, name = rbl.symbol,
group = 'rbl',
score = 0,
flags = table.concat(flags_tbl, ',') flags = table.concat(flags_tbl, ',')
} }
if not (rbl.is_whitelist or rbl.ignore_whitelist) then if not (rbl.is_whitelist or rbl.ignore_whitelist) then
type = 'virtual', type = 'virtual',
parent = id, parent = id,
name = s, name = s,
group = 'rbl',
score = 0,
} }
end end
if rbl.is_whitelist then if rbl.is_whitelist then

Loading…
Cancel
Save