Mercurial > prosody-modules
comparison 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 |
comparison
equal
deleted
inserted
replaced
4811:a1fe59c06c48 | 4812:9cdbb1b5e6f2 |
---|---|
98 if affiliation and affiliation ~= "none" then | 98 if affiliation and affiliation ~= "none" then |
99 -- Skip check for affiliated users | 99 -- Skip check for affiliated users |
100 return; | 100 return; |
101 end | 101 end |
102 | 102 |
103 local hash = sha256(jid.bare(event.stanza.attr.from), true); | 103 local bare_hash = sha256(jid.bare(event.stanza.attr.from), true); |
104 if banned_hashes[hash] then | 104 local host_hash = sha256(jid.host(event.stanza.attr.from), true); |
105 if banned_hashes[bare_hash] or banned_hashes[host_hash] then | |
105 module:log("info", "Blocked user <%s> from room <%s> due to RTBL match", from_bare, event.stanza.attr.to); | 106 module:log("info", "Blocked user <%s> from room <%s> due to RTBL match", from_bare, event.stanza.attr.to); |
106 local error_reply = st.error_reply(event.stanza, "cancel", "forbidden", "You are banned from this service", event.room.jid); | 107 local error_reply = st.error_reply(event.stanza, "cancel", "forbidden", "You are banned from this service", event.room.jid); |
107 event.origin.send(error_reply); | 108 event.origin.send(error_reply); |
108 return true; | 109 return true; |
109 end | 110 end |