aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-12-15 16:06:37 +0600
committerGitHub <noreply@github.com>2024-12-15 16:06:37 +0600
commit798fd3cbfa7bbc7c8bb8815c4c154c92298e41d4 (patch)
tree743293464884e9199ef36d35923d31ae5e4c02ce
parent16957bfccc4ce6b131bff2cb73ce433611233f9c (diff)
parent4c45f5b1c800d3bb856091b0efc8a2b12108e08a (diff)
downloadrspamd-798fd3cbfa7bbc7c8bb8815c4c154c92298e41d4.tar.gz
rspamd-798fd3cbfa7bbc7c8bb8815c4c154c92298e41d4.zip
Merge pull request #5255 from teplynin/fix-rbl-check_received
[Fix] Skip extra RBL checks when Received IP same as From IP
-rw-r--r--src/plugins/lua/rbl.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index b2ccf8699..76c84f85d 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -689,12 +689,19 @@ local function gen_rbl_callback(rule)
local received_total = #received
local check_conditions = gen_check_rcvd_conditions(rule, received_total)
+ local from_ip = task:get_from_ip()
for pos, rh in ipairs(received) do
if check_conditions(rh, pos) then
- add_dns_request(task, rh.real_ip, false, true,
- requests_table, 'received',
- whitelist)
+ if rh.real_ip ~= from_ip or (rh.real_ip == from_ip and not rule.from) then
+ add_dns_request(task, rh.real_ip, false, true,
+ requests_table, 'received',
+ whitelist)
+ else
+ lua_util.debugm(N, task, 'rbl %s; skip check_received for %s:' ..
+ 'Received IP same as From IP and will be checked only in check_from function',
+ rule.symbol, rh.real_ip)
+ end
end
end