diff mod_muc_rtbl/mod_muc_rtbl.lua @ 4812:9cdbb1b5e6f2

mod_muc_rtbl: Check joining user's host against RTBL
author Matthew Wild <mwild1@gmail.com>
date Mon, 06 Dec 2021 12:27:16 +0000
parents a1fe59c06c48
children 0a257d1402c3
line wrap: on
line diff
--- a/mod_muc_rtbl/mod_muc_rtbl.lua	Mon Dec 06 12:26:16 2021 +0000
+++ b/mod_muc_rtbl/mod_muc_rtbl.lua	Mon Dec 06 12:27:16 2021 +0000
@@ -100,8 +100,9 @@
 		return;
 	end
 
-	local hash = sha256(jid.bare(event.stanza.attr.from), true);
-	if banned_hashes[hash] then
+	local bare_hash = sha256(jid.bare(event.stanza.attr.from), true);
+	local host_hash = sha256(jid.host(event.stanza.attr.from), true);
+	if banned_hashes[bare_hash] or banned_hashes[host_hash] then
 		module:log("info", "Blocked user <%s> from room <%s> due to RTBL match", from_bare, event.stanza.attr.to);
 		local error_reply = st.error_reply(event.stanza, "cancel", "forbidden", "You are banned from this service", event.room.jid);
 		event.origin.send(error_reply);