aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2023-10-24 13:53:03 +0200
committerAndrew Lewis <nerf@judo.za.org>2023-10-24 13:53:03 +0200
commit06618f8a52242c8678eed659b56cebb23a34ed38 (patch)
tree2d0c1a26d5a053608e3421f45f64203dcd682d3c /src
parentfea6bf4c35ae7fd40c9d61edc2283d335347d998 (diff)
downloadrspamd-06618f8a52242c8678eed659b56cebb23a34ed38.tar.gz
rspamd-06618f8a52242c8678eed659b56cebb23a34ed38.zip
[Feature] rbl: support checking returncodes by regex
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/rbl.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index b6467c103..a36131b1b 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -21,6 +21,7 @@ end
local hash = require 'rspamd_cryptobox_hash'
local rspamd_logger = require 'rspamd_logger'
+local rspamd_regexp = require 'rspamd_regexp'
local rspamd_util = require 'rspamd_util'
local rspamd_ip = require "rspamd_ip"
local fun = require 'fun'
@@ -225,6 +226,18 @@ matchers.luapattern = function(to_match, pattern)
return string.find(to_match, '^' .. pattern .. '$') and true or false
end
+matchers.regexp = function(to_match, pattern)
+ local re = rspamd_regexp.get_cached(pattern)
+ if not re then
+ re = rspamd_regexp.create_cached(pattern)
+ if not re then
+ rspamd_logger.errx('regexp did not compile: %s', pattern)
+ return false
+ end
+ end
+ return re:match(to_match)
+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