changeset 4321:71498f484c22

mod_muc_ban_ip: do not error() on banned user sending error to MUC
author Georg Lukas <georg@op-co.de>
date Wed, 06 Jan 2021 17:07:16 +0100
parents 8fc16174fec6
children 9606e7a63a69
files mod_muc_ban_ip/mod_muc_ban_ip.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_ban_ip/mod_muc_ban_ip.lua	Fri May 22 09:47:42 2020 +0200
+++ b/mod_muc_ban_ip/mod_muc_ban_ip.lua	Wed Jan 06 17:07:16 2021 +0100
@@ -48,9 +48,11 @@
 	local to = jid_bare(stanza.attr.to);
 	if ip_bans[ip] and ip_bans[ip][to] then
 		(origin.log or module._log)("debug", "IP banned: %s is banned from %s", ip, to)
-		origin.send(st.error_reply(stanza, "auth", "forbidden")
-			:tag("x", { xmlns = xmlns_muc_user })
-				:tag("status", { code = '301' }));
+		if stanza.attr.type != "error" then
+			origin.send(st.error_reply(stanza, "auth", "forbidden")
+				:tag("x", { xmlns = xmlns_muc_user })
+					:tag("status", { code = '301' }));
+		end
 		return true;
 	end
 	(origin.log or module._log)("debug", "IP not banned: %s from %s", ip, to)