diff options
author | Kim Alvefur <zash@zash.se> | 2023-04-12 11:43:32 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-04-12 11:43:32 +0200 |
commit | a68169b93ef7aa132665f507b143747d1a753857 (patch) | |
tree | 87fe3748d214ca04a4ccd1617360392fc6a9476f | |
parent | 816d0819f2065caa10dd95915157b3fb3b17f477 (diff) | |
download | prosody-a68169b93ef7aa132665f507b143747d1a753857.tar.gz prosody-a68169b93ef7aa132665f507b143747d1a753857.zip |
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.
-rw-r--r-- | plugins/mod_tokenauth.lua | 2 |
1 files changed, 1 insertions, 1 deletions
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; |