From a68169b93ef7aa132665f507b143747d1a753857 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 12 Apr 2023 11:43:32 +0200 Subject: mod_tokenauth: Fix parsing binary part of tokens Fixes parsing of tokens that happen to have a `;` in their secret part, otherwise it splits there and the later bit goes into the username and hitting the "Invalid token in storage" condition. --- plugins/mod_tokenauth.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/mod_tokenauth.lua') diff --git a/plugins/mod_tokenauth.lua b/plugins/mod_tokenauth.lua index 240e9fbd..ccd06155 100644 --- a/plugins/mod_tokenauth.lua +++ b/plugins/mod_tokenauth.lua @@ -120,7 +120,7 @@ local function parse_token(encoded_token) if not encoded_data then return nil; end local token = base64.decode(encoded_data); if not token then return nil; end - local token_id, token_secret, token_jid = token:match("^2;([^;]+);([^;]+);(.+)$"); + local token_id, token_secret, token_jid = token:match("^2;([^;]+);(..................);(.+)$"); if not token_id then return nil; end local token_user, token_host = jid.split(token_jid); return token_id, token_user, token_host, token_secret; -- cgit v1.2.3