diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 560e9e2..3ead55b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -89,7 +89,7 @@ jobs: # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability strategy: matrix: - msrv: [1.56.1] # 2021 edition requires 1.56 + msrv: [1.57.0] # base64 0.21 requires 1.57 name: ubuntu / ${{ matrix.msrv }} steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e165dc3..2f47488 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -122,6 +122,10 @@ jobs: matrix: os: [macos-latest, windows-latest] steps: + - run: echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append + if: runner.os == 'Windows' + - run: vcpkg install openssl:x64-windows-static-md + if: runner.os == 'Windows' - uses: actions/checkout@v3 with: submodules: true diff --git a/Cargo.lock b/Cargo.lock index 2f33c09..36d9b4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,6 +85,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "bitflags" version = "1.3.2" @@ -162,7 +168,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34dd14c63662e0206599796cd5e1ad0268ab2b9d19b868d6050d688eba2bbf98" dependencies = [ - "base64", + "base64 0.13.0", "memchr", ] @@ -371,7 +377,7 @@ dependencies = [ name = "imap" version = "3.0.0-alpha.9" dependencies = [ - "base64", + "base64 0.21.0", "bufstream", "chrono", "encoding", @@ -382,6 +388,7 @@ dependencies = [ "mime", "native-tls", "nom", + "openssl", "ouroboros", "regex", "rustls-connector", @@ -427,7 +434,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eabca5e0b4d0e98e7f2243fb5b7520b6af2b65d8f87bcc86f2c75185a6ff243" dependencies = [ - "base64", + "base64 0.13.0", "email-encoding", "email_address", "fastrand", @@ -791,7 +798,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ - "base64", + "base64 0.13.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 1fb34b3..87cc351 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ regex = "1.0" bufstream = "0.1.3" imap-proto = "0.16.1" nom = { version = "7.1.0", default-features = false } -base64 = "0.13" +base64 = "0.21" chrono = { version = "0.4", default-features = false, features = ["std"]} lazy_static = "1.4" ouroboros = "0.15.0" @@ -40,6 +40,7 @@ structopt = "0.3" encoding = "0.2.32" failure = "0.1.8" mime = "0.3.4" +openssl = "0.10.35" [[example]] name = "basic" diff --git a/src/client.rs b/src/client.rs index f629b3e..7969497 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,3 +1,4 @@ +use base64::{engine::general_purpose, Engine as _}; use bufstream::BufStream; use chrono::{DateTime, FixedOffset}; use imap_proto::Response; @@ -471,16 +472,18 @@ impl Client { let data = ok_or_unauth_client_err!(parse_authenticate_response(line_str), self); ok_or_unauth_client_err!( - base64::decode(data).map_err(|e| Error::Parse(ParseError::Authentication( - data.to_string(), - Some(e) - ))), + general_purpose::STANDARD_NO_PAD + .decode(data) + .map_err(|e| Error::Parse(ParseError::Authentication( + data.to_string(), + Some(e) + ))), self ) }; let raw_response = &authenticator.process(&challenge); - let auth_response = base64::encode(raw_response); + let auth_response = general_purpose::STANDARD_NO_PAD.encode(raw_response); ok_or_unauth_client_err!( self.write_line(auth_response.into_bytes().as_slice()), self