diff options
author | Andrew Lewis <nerf@judo.za.org> | 2023-10-24 13:23:13 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2023-10-24 13:23:13 +0200 |
commit | fea6bf4c35ae7fd40c9d61edc2283d335347d998 (patch) | |
tree | 56f8335a9c406afa5c96dea995de7f2536997d87 /lualib/plugins/rbl.lua | |
parent | 78f91465d1170b19d12411c5b6be224565f25b84 (diff) | |
download | rspamd-fea6bf4c35ae7fd40c9d61edc2283d335347d998.tar.gz rspamd-fea6bf4c35ae7fd40c9d61edc2283d335347d998.zip |
[Minor] rbl: support use of different matchers for return codes
Diffstat (limited to 'lualib/plugins/rbl.lua')
-rw-r--r-- | lualib/plugins/rbl.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lualib/plugins/rbl.lua b/lualib/plugins/rbl.lua index 02d0d3338..1a25c1ed3 100644 --- a/lualib/plugins/rbl.lua +++ b/lualib/plugins/rbl.lua @@ -107,6 +107,7 @@ local rule_schema_tbl = { ipv6 = ts.boolean:is_optional(), is_whitelist = ts.boolean:is_optional(), local_exclude_ip_map = ts.string:is_optional(), + matcher = ts.one_of { "equality", "luapattern" }:is_optional(), monitored_address = ts.string:is_optional(), no_ip = ts.boolean:is_optional(), process_script = ts.string:is_optional(), @@ -199,6 +200,21 @@ local function convert_checks(rule) rule.from = true end + if rule.returncodes and not rule.matcher then + for _, v in pairs(rule.returncodes) do + for _, e in ipairs(v) do + if e:find('%', 1, true) then + rspamd_logger.warnx(rspamd_config, 'implicitly enabling luapattern matcher for rule %s', rule.symbol) + rule.matcher = 'luapattern' + break + end + end + if rule.matcher then + break + end + end + end + return rule end |