diff options
author | Andrew Lewis <nerf@judo.za.org> | 2023-10-25 15:00:08 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2023-10-25 15:00:08 +0200 |
commit | 5ef8dfff5dcff5e8922e5a2c8e41d7e381dbcd37 (patch) | |
tree | fc75a6ef2de5538786560df15bbef91b1b80670c /src/plugins/lua/rbl.lua | |
parent | 3d17d2d857bb2d719b6e32e1b85e81dd1431d5bd (diff) | |
download | rspamd-5ef8dfff5dcff5e8922e5a2c8e41d7e381dbcd37.tar.gz rspamd-5ef8dfff5dcff5e8922e5a2c8e41d7e381dbcd37.zip |
[Feature] rbl: support globbed return codes
Diffstat (limited to 'src/plugins/lua/rbl.lua')
-rw-r--r-- | src/plugins/lua/rbl.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua index 4365d245f..d1f2df69c 100644 --- a/src/plugins/lua/rbl.lua +++ b/src/plugins/lua/rbl.lua @@ -247,6 +247,10 @@ matchers.regexp = function(_, to_match, _, map) return map and map:get_key(to_match) or false end +matchers.glob = function(_, to_match, _, map) + return map and map:get_key(to_match) or false +end + local function rbl_dns_process(task, rbl, to_resolve, results, err, resolve_table_elt, match) local function make_option(ip, label) if ip then @@ -1009,6 +1013,12 @@ local function gen_rbl_callback(rule) return callback_f, string.format('checks: %s', table.concat(description, ',')) end +local map_match_types = { + glob = true, + radix = true, + regexp = true, +} + local function add_rbl(key, rbl, global_opts) if not rbl.symbol then rbl.symbol = key:upper() @@ -1087,7 +1097,7 @@ local function add_rbl(key, rbl, global_opts) end local match_type = rbl.matcher - if match_type and rbl.returncodes and (match_type == 'radix' or match_type == 'regexp') then + if match_type and rbl.returncodes and map_match_types[match_type] then if not rbl.returncodes_maps then rbl.returncodes_maps = {} end |