aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/rbl.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2023-09-19 15:45:10 +0200
committerAndrew Lewis <nerf@judo.za.org>2023-09-19 15:45:10 +0200
commit38cf55d84f0080c8c91fc1758081c216defc8beb (patch)
treecf8e8f5517e0a0958d2c606e15eb30c066d69087 /src/plugins/lua/rbl.lua
parente879458ea89ce76226c12078d05632f67bc657fe (diff)
downloadrspamd-38cf55d84f0080c8c91fc1758081c216defc8beb.tar.gz
rspamd-38cf55d84f0080c8c91fc1758081c216defc8beb.zip
[Minor] Revisit numeric_urls
Diffstat (limited to 'src/plugins/lua/rbl.lua')
-rw-r--r--src/plugins/lua/rbl.lua29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index c5cdbef1c..837707b3f 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -563,7 +563,31 @@ local function gen_rbl_callback(rule)
no_cache = true,
}
- if not rule.urls then
+ if rule.numeric_urls then
+ if rule.content_urls then
+ if not rule.images then
+ ex_params.flags_mode = 'explicit'
+ ex_params.flags = {'numeric'}
+ ex_params.filter = function(url)
+ return (bit.band(url:get_flags_num(), url_flag_bits.image) == 0)
+ end
+ else
+ ex_params.filter = function(url)
+ return (bit.band(url:get_flags_num(), url_flag_bits.numeric) ~= 0)
+ end
+ end
+ elseif rule.images then
+ ex_params.filter = function(url)
+ return (bit.band(url:get_flags_num(), url_flag_bits.numeric) ~= 0)
+ end
+ else
+ ex_params.flags_mode = 'explicit'
+ ex_params.flags = {'numeric'}
+ ex_params.filter = function(url)
+ return (bit.band(url:get_flags_num(), url_flag_bits.content) == 0)
+ end
+ end
+ elseif not rule.urls and (rule.content_urls or rule.images) then
ex_params.flags_mode = 'explicit'
ex_params.flags = {}
if rule.content_urls then
@@ -572,9 +596,6 @@ local function gen_rbl_callback(rule)
if rule.images then
table.insert(ex_params.flags, 'image')
end
- if rule.numeric_urls then
- table.insert(ex_params.flags, 'numeric')
- end
end
local urls = lua_util.extract_specific_urls(ex_params)