Diff

util/sasl/scram.lua @ 3098:e5d349c0acde

util.sasl.scram: Fixed global access.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 06 May 2010 15:19:20 +0500
parent 3097:9341ef1a3345
child 3099:2c4d06e7e3d3
line wrap: on
line diff
--- a/util/sasl/scram.lua	Sun Feb 28 22:42:53 2010 +0100
+++ b/util/sasl/scram.lua	Thu May 06 15:19:20 2010 +0500
@@ -117,7 +117,7 @@
 			
 			-- retreive credentials
 			if self.profile.plain then
-				password, state = self.profile.plain(self.state.name, self.realm)
+				local password, state = self.profile.plain(self.state.name, self.realm)
 				if state == nil then return "failure", "not-authorized"
 				elseif state == false then return "failure", "account-disabled" end
 				
@@ -129,8 +129,8 @@
 				self.state.salt = generate_uuid();
 				self.state.iteration_count = default_i;
 				self.state.salted_password = Hi(HMAC_f, password, self.state.salt, default_i);
-			elseif self.profile["scram-"..hash_name] then
-				salted_password, iteration_count, salt, state = self.profile["scram-"..hash_name](self.state.name, self.realm);
+			elseif self.profile["scram_"..hash_name] then
+				local salted_password, iteration_count, salt, state = self.profile["scram-"..hash_name](self.state.name, self.realm);
 				if state == nil then return "failure", "not-authorized"
 				elseif state == false then return "failure", "account-disabled" end
 				
@@ -177,7 +177,7 @@
 
 function init(registerMechanism)
 	local function registerSCRAMMechanism(hash_name, hash, hmac_hash)
-		registerMechanism("SCRAM-"..hash_name, {"plain", "scram-"..(hash_name:lower())}, scram_gen(hash_name:lower(), hash, hmac_hash));
+		registerMechanism("SCRAM-"..hash_name, {"plain", "scram_"..(hash_name:lower())}, scram_gen(hash_name:lower(), hash, hmac_hash));
 	end
 	
 	registerSCRAMMechanism("SHA-1", sha1, hmac_sha1);