plugins/muc/muc.lib: Better password check
authordaurnimator <quae@daurnimator.com>
Mon, 24 Mar 2014 12:44:31 -0400
changeset 6136 2068242028ff
parent 6135 6b061f8c6e11
child 6137 7db24f237a83
plugins/muc/muc.lib: Better password check
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Mon Mar 24 10:25:43 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Mon Mar 24 12:44:31 2014 -0400
@@ -480,9 +480,9 @@
 	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();