summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/rbl.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2022-01-16 20:20:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2022-01-16 20:20:34 +0000
commite27291f671d8707f2f98d62448b0fdf4f205fcd0 (patch)
treec257d2cbc15e5e5892b77eaf275011b87d30f376 /src/plugins/lua/rbl.lua
parentb9368887523031fcad0524cee98af04181a59f3c (diff)
downloadrspamd-e27291f671d8707f2f98d62448b0fdf4f205fcd0.tar.gz
rspamd-e27291f671d8707f2f98d62448b0fdf4f205fcd0.zip
[Minor] Fix for random monitored
Reported by: @moisseev
Diffstat (limited to 'src/plugins/lua/rbl.lua')
-rw-r--r--src/plugins/lua/rbl.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 22305aa1f..49b67221f 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -48,12 +48,18 @@ local url_flag_bits = rspamd_url.flags
local function get_monitored(rbl)
local function is_random_monitored()
- return (rbl.dkim
- or rbl.urls
- or rbl.emails
- or rbl.no_ip
- or rbl.rdns
- or rbl.helo)
+ -- Explicit definition
+ if type(rbl.random_monitored) == 'boolean' then
+ return rbl.random_monitored
+ end
+
+ -- We check 127.0.0.1 for merely RBLs with `from` or `received` and only if
+ -- they don't have `no_ip` attribute at the same time
+ --
+ -- Convert to a boolean variable using the common idiom
+ return (not (rbl.from or rbl.received)
+ or rbl.no_ip)
+ and true or false
end
local default_monitored = '1.0.0.127'