Diff

util/sasl/scram.lua @ 8095:57192cf193c7

util.sasl.plain,scram: Record username in sasl state earlier
author Kim Alvefur <zash@zash.se>
date Wed, 19 Apr 2017 06:47:02 +0200
parent 7218:6226307f6ac4
child 8382:e5d00bf4a4d5
line wrap: on
line diff
--- a/util/sasl/scram.lua	Wed Apr 19 12:40:03 2017 +0100
+++ b/util/sasl/scram.lua	Wed Apr 19 06:47:02 2017 +0200
@@ -146,6 +146,7 @@
 				log("debug", "Username violates either SASLprep or contains forbidden character sequences.")
 				return "failure", "malformed-request", "Invalid username.";
 			end
+			self.username = username;
 
 			-- retreive credentials
 			local stored_key, server_key, salt, iteration_count;
@@ -225,7 +226,6 @@
 
 			if StoredKey == H_f(ClientKey) then
 				local server_final_message = "v="..base64.encode(ServerSignature);
-				self["username"] = state.username;
 				return "success", server_final_message;
 			else
 				return "failure", "not-authorized", "The response provided by the client doesn't match the one we calculated.";