Comparison

mod_muc_ban_ip/mod_muc_ban_ip.lua @ 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
parent 3995:4c9805f29f2d
child 4323:a7a06c8cea37
comparison
equal deleted inserted replaced
4320:8fc16174fec6 4321:71498f484c22
46 local origin, stanza = event.origin, event.stanza; 46 local origin, stanza = event.origin, event.stanza;
47 local ip = origin.ip; 47 local ip = origin.ip;
48 local to = jid_bare(stanza.attr.to); 48 local to = jid_bare(stanza.attr.to);
49 if ip_bans[ip] and ip_bans[ip][to] then 49 if ip_bans[ip] and ip_bans[ip][to] then
50 (origin.log or module._log)("debug", "IP banned: %s is banned from %s", ip, to) 50 (origin.log or module._log)("debug", "IP banned: %s is banned from %s", ip, to)
51 origin.send(st.error_reply(stanza, "auth", "forbidden") 51 if stanza.attr.type != "error" then
52 :tag("x", { xmlns = xmlns_muc_user }) 52 origin.send(st.error_reply(stanza, "auth", "forbidden")
53 :tag("status", { code = '301' })); 53 :tag("x", { xmlns = xmlns_muc_user })
54 :tag("status", { code = '301' }));
55 end
54 return true; 56 return true;
55 end 57 end
56 (origin.log or module._log)("debug", "IP not banned: %s from %s", ip, to) 58 (origin.log or module._log)("debug", "IP not banned: %s from %s", ip, to)
57 end 59 end
58 60