Changeset

6120:bd3ff802d883

mod_anti_spam: Fix another traceback for origin sessions without an IP This is likely to be the case for stanzas originating from local hosts, for example (so not true s2s). It should be safe to bypass the IP check for those.
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Dec 2024 21:02:08 +0000
parents 6119:6dca425eea15
children 6121:255ab0b81f14
files mod_anti_spam/mod_anti_spam.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_anti_spam/mod_anti_spam.lua	Sat Dec 28 18:45:40 2024 +0000
+++ b/mod_anti_spam/mod_anti_spam.lua	Sat Dec 28 21:02:08 2024 +0000
@@ -65,9 +65,9 @@
 	end
 	local raw_ip = session.ip;
 	local parsed_ip = raw_ip and ip.new_ip(session.ip);
-	if not parsed_ip then
-		session.log("warn", "mod_anti_spam: Unable to determine IP address (missing/invalid)");
-	elseif spam_source_ips:contains_ip(parsed_ip) then
+	-- Not every session has an ip - for example, stanzas sent from a
+	-- local host session
+	if parsed_ip and spam_source_ips:contains_ip(parsed_ip) then
 		return true;
 	end
 end