Diff

util/sasl/scram.lua @ 2210:78c9b5255b27

Adding some human readable error messages.
author Tobias Markmann <tm@ayena.de>
date Thu, 19 Nov 2009 17:17:52 +0100
parent 2206:5f54100bb426
child 2255:92e329e1cd99
line wrap: on
line diff
--- a/util/sasl/scram.lua	Thu Nov 19 17:08:58 2009 +0100
+++ b/util/sasl/scram.lua	Thu Nov 19 17:17:52 2009 +0100
@@ -95,7 +95,7 @@
 		self.state.name = validate_username(self.state.name);
 		if not self.state.name then
 			log("debug", "Username violates either SASLprep or contains forbidden character sequences.")
-			return "failure", "malformed-request";
+			return "failure", "malformed-request", "Invalid username.";
 		end
 		
 		self.state["servernonce"] = generate_uuid();
@@ -113,7 +113,7 @@
 		self.state["nonce"] = client_final_message:match("r=(.+),p=");
 		self.state["channelbinding"] = client_final_message:match("c=(.+),r=");
 		if not self.state.proof or not self.state.nonce or not self.state.channelbinding then
-			return "failure", "malformed-request";
+			return "failure", "malformed-request", "Missing an attribute(p, r or c) in SASL message.";
 		end
 		
 		local password;
@@ -124,7 +124,7 @@
 			password = saslprep(password);
 			if not password then
 				log("debug", "Password violates SASLprep.");
-				return "failure", "not-authorized"
+				return "failure", "not-authorized", "Invalid password."
 			end
 		end