# HG changeset patch # User Kim Alvefur # Date 1681292612 -7200 # Node ID 794a5ad5495e0ab09c7e6f60694171c493edf690 # Parent 9e5802b45b9ec5a736e9dfd1a1c4577d393aa00b 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. diff -r 9e5802b45b9e -r 794a5ad5495e plugins/mod_tokenauth.lua --- a/plugins/mod_tokenauth.lua Wed Apr 12 10:21:32 2023 +0200 +++ b/plugins/mod_tokenauth.lua Wed Apr 12 11:43:32 2023 +0200 @@ -120,7 +120,7 @@ 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;