Software /
code /
prosody
Changeset
3245:a8a4c87a4fbf
MUC: Added password checking on room join.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 13 Jun 2010 18:14:46 +0500 |
parents | 3244:616a3bb2bad9 |
children | 3246:3371419eb0e1 |
files | plugins/muc/muc.lib.lua |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Sun Jun 13 18:13:18 2010 +0500 +++ b/plugins/muc/muc.lib.lua Sun Jun 13 18:14:46 2010 +0500 @@ -337,7 +337,15 @@ end is_merge = true; end - if not new_nick then + local password = stanza:get_child("x", "http://jabber.org/protocol/muc"); + password = password and password:get_child("password", "http://jabber.org/protocol/muc"); + password = password and password[1] ~= "" and password[1]; + if self:get_password() and self:get_password() ~= password then + log("debug", "%s couldn't join due to invalid password: %s", from, to); + local reply = st.error_reply(stanza, "auth", "not-authorized"):up(); + reply.tags[1].attr.code = "401"; + origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); + elseif not new_nick then log("debug", "%s couldn't join due to nick conflict: %s", from, to); local reply = st.error_reply(stanza, "cancel", "conflict"):up(); reply.tags[1].attr.code = "409";