Changeset

3418:e75af8e6af54

mod_saslauth: Fixed a nil global access.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 31 Jul 2010 15:16:15 +0500
parents 3417:53e854b52110
children 3419:79e08dc3fd37
files plugins/mod_saslauth.lua
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Sat Jul 31 13:55:46 2010 +0500
+++ b/plugins/mod_saslauth.lua	Sat Jul 31 15:16:15 2010 +0500
@@ -113,17 +113,18 @@
 local function sasl_handler(session, stanza)
 	if stanza.name == "auth" then
 		-- FIXME ignoring duplicates because ejabberd does
+		local mechanism = stanza.attr.mechanism;
 		if anonymous_login then
-			if stanza.attr.mechanism ~= "ANONYMOUS" then
+			if mechanism ~= "ANONYMOUS" then
 				return session.send(build_reply("failure", "invalid-mechanism"));
 			end
-		elseif stanza.attr.mechanism == "ANONYMOUS" then
+		elseif mechanism == "ANONYMOUS" then
 			return session.send(build_reply("failure", "mechanism-too-weak"));
 		end
 		if not session.secure and (secure_auth_only or (mechanism == "PLAIN" and not allow_unencrypted_plain_auth)) then
 			return session.send(build_reply("failure", "encryption-required"));
 		end
-		local valid_mechanism = session.sasl_handler:select(stanza.attr.mechanism);
+		local valid_mechanism = session.sasl_handler:select(mechanism);
 		if not valid_mechanism then
 			return session.send(build_reply("failure", "invalid-mechanism"));
 		end