aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-03-24 12:44:31 -0400
committerdaurnimator <quae@daurnimator.com>2014-03-24 12:44:31 -0400
commita86714d770459194c8be1e6350220e2bd9c844e5 (patch)
tree3b850e87fcd33a1fad4c77c96f10fef97bd16a76 /plugins
parenta8855463cfb002193502d19541b9575960ad8072 (diff)
downloadprosody-a86714d770459194c8be1e6350220e2bd9c844e5.tar.gz
prosody-a86714d770459194c8be1e6350220e2bd9c844e5.zip
plugins/muc/muc.lib: Better password check
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 1b3df029..821cb082 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -480,9 +480,9 @@ module:hook("muc-occupant-pre-join/password", function(event)
local room, stanza = event.room, event.stanza;
local from, to = stanza.attr.from, stanza.attr.to;
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 room:get_password() and room:get_password() ~= password then
+ password = password and password:get_child_text("password", "http://jabber.org/protocol/muc");
+ if not password or password == "" then password = nil; end
+ if room:get_password() ~= password then
local from, to = stanza.attr.from, stanza.attr.to;
log("debug", "%s couldn't join due to invalid password: %s", from, to);
local reply = st.error_reply(stanza, "auth", "not-authorized"):up();