Changeset

3106:f4341cac3ae1

util.sasl.scram: Fixing issue #177.
author Tobias Markmann <tm@ayena.de>
date Sat, 22 May 2010 20:51:01 +0200
parents 3105:7aab97057ce4
children 3107:6d576a66ca63
files util/sasl/scram.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/sasl/scram.lua	Sat May 22 20:34:32 2010 +0200
+++ b/util/sasl/scram.lua	Sat May 22 20:51:01 2010 +0200
@@ -108,6 +108,7 @@
 	local function scram_hash(self, message)
 		if not self.state then self["state"] = {} end
 	
+		if type(message) ~= "string" or #message == 0 then return "failure", "malformed-request" end
 		if not self.state.name then
 			-- we are processing client_first_message
 			local client_first_message = message;
@@ -169,7 +170,6 @@
 			self.state["server_first_message"] = server_first_message;
 			return "challenge", server_first_message
 		else
-			if type(message) ~= "string" then return "failure", "malformed-request" end
 			-- we are processing client_final_message
 			local client_final_message = message;