Changeset

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
parents 6121:255ab0b81f14
children 6123:f6bbf42c341c
files mod_anti_spam/mod_anti_spam.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
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);