Diff

mod_anti_spam/mod_anti_spam.lua @ 6122:15f6f1566bdb

mod_anti_spam: Prevent traceback when processing a message to an unknown host I'm not currently sure what is happening here, so hopefully the log message will explain all if it happens again.
author Matthew Wild <mwild1@gmail.com>
date Mon, 30 Dec 2024 08:58:16 +0000
parent 6121:255ab0b81f14
child 6124:bdbf12a2a854
line wrap: on
line diff
--- a/mod_anti_spam/mod_anti_spam.lua	Sun Dec 29 11:49:36 2024 +0000
+++ b/mod_anti_spam/mod_anti_spam.lua	Mon Dec 30 08:58:16 2024 +0000
@@ -135,6 +135,11 @@
 module:hook("message/bare", function (event)
 	local to_user, to_host = jid_split(event.stanza.attr.to);
 
+	if not hosts[to_host] then
+		module:log("warn", "Skipping filtering of message to unknown host <%s>", to_host);
+		return;
+	end
+
 	if not user_exists(to_user, to_host) then return; end
 
 	local from_bare = jid_bare(event.stanza.attr.from);