From 70ed8f170902b7b968c455b5c65eebc8c0508449 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Sat, 8 Feb 2025 14:44:56 -0500 Subject: [PATCH] Allow padded authentication tokens (#305) I honestly couldn't tell you why `NO_PAD` was chosen. It seems to have happened somewhat arbitrarily when the `base64` major upgrade that introduced the distinction landed in #253. Time to fix that. Fixes #299. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/client.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8448932..f5b41aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -405,7 +405,7 @@ dependencies = [ [[package]] name = "imap" -version = "3.0.0-alpha.14" +version = "3.0.0-alpha.15" dependencies = [ "base64 0.22.0", "bufstream", diff --git a/Cargo.toml b/Cargo.toml index d8dbc4d..3bacf63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imap" -version = "3.0.0-alpha.14" +version = "3.0.0-alpha.15" authors = ["Jon Gjengset ", "Matt McCoy "] documentation = "https://docs.rs/imap/" diff --git a/src/client.rs b/src/client.rs index 881eb98..046ec52 100644 --- a/src/client.rs +++ b/src/client.rs @@ -501,7 +501,7 @@ impl Client { let data = ok_or_unauth_client_err!(parse_authenticate_response(line_str), self); ok_or_unauth_client_err!( - general_purpose::STANDARD_NO_PAD + general_purpose::STANDARD .decode(data) .map_err(|e| Error::Parse(ParseError::Authentication( data.to_string(), @@ -512,7 +512,7 @@ impl Client { }; let raw_response = &authenticator.process(&challenge); - let auth_response = general_purpose::STANDARD_NO_PAD.encode(raw_response); + let auth_response = general_purpose::STANDARD.encode(raw_response); ok_or_unauth_client_err!( self.write_line(auth_response.into_bytes().as_slice()), self