changeset 5070:5cc6f3749376

mod_sasl2_fast: Fix make_token() to return appropriate result
author Matthew Wild <mwild1@gmail.com>
date Sat, 15 Oct 2022 19:41:33 +0100
parents e8342ae5ae12
children bc983da908e6
files mod_sasl2_fast/mod_sasl2_fast.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_sasl2_fast/mod_sasl2_fast.lua	Fri Oct 14 16:21:01 2022 +0100
+++ b/mod_sasl2_fast/mod_sasl2_fast.lua	Sat Oct 15 19:41:33 2022 +0100
@@ -17,12 +17,16 @@
 	local new_token = "secret-token:fast-"..id.long();
 	local key = hash.sha256(client_id, true).."-new";
 	local issued_at = now();
-	token_store:set(username, key, {
+	local token_info = {
 		mechanism = mechanism;
 		secret = new_token;
 		issued_at = issued_at;
 		expires_at = issued_at + fast_token_ttl;
-	});
+	};
+	if not token_store:set(username, key, token_info) then
+		return nil;
+	end
+	return token_info;
 end
 
 local function new_token_tester(username, hmac_f)