mod_sasl2_fast: Fix make_token() to return appropriate result
authorMatthew Wild <mwild1@gmail.com>
Sat, 15 Oct 2022 19:41:33 +0100
changeset 5074 5cc6f3749376
parent 5073 e8342ae5ae12
child 5075 bc983da908e6
mod_sasl2_fast: Fix make_token() to return appropriate result
mod_sasl2_fast/mod_sasl2_fast.lua
--- 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)