diff --git a/CHANGELOG.md b/CHANGELOG.md index d04cc45..663daff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +mail-send 0.4.2 +================================ +- Bump `webpki-roots` dependency to 0.26 + mail-send 0.4.1 ================================ - Bump `webpki-roots` dependency to 0.25 diff --git a/Cargo.toml b/Cargo.toml index 6d493d0..755d586 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mail-send" description = "E-mail delivery library with SMTP and DKIM support" -version = "0.4.1" +version = "0.4.2" edition = "2021" authors = [ "Stalwart Labs "] license = "Apache-2.0 OR MIT" @@ -18,13 +18,13 @@ doctest = false smtp-proto = { version = "0.1", git = "https://github.com/stalwartlabs/smtp-proto" } mail-auth = { version = "0.3", git = "https://github.com/stalwartlabs/mail-auth", optional = true } mail-builder = { version = "0.3", git = "https://github.com/stalwartlabs/mail-builder", optional = true } -base64 = "0.20.0" +base64 = "0.21" rand = { version = "0.8.5", optional = true } md5 = { version = "0.7.0", optional = true } tokio = { version = "1.23", features = ["net", "io-util", "time"]} rustls = { version = "0.21", features = ["tls12", "dangerous_configuration"]} tokio-rustls = { version = "0.24"} -webpki-roots = { version = "0.25.2"} +webpki-roots = { version = "0.26"} gethostname = { version = "0.4"} [dev-dependencies] diff --git a/src/smtp/auth.rs b/src/smtp/auth.rs index f9293bb..47bd1d9 100644 --- a/src/smtp/auth.rs +++ b/src/smtp/auth.rs @@ -10,6 +10,7 @@ use std::{fmt::Display, hash::Hash}; +use base64::{engine, Engine}; use smtp_proto::{ response::generate::BitToString, EhloResponse, AUTH_CRAM_MD5, AUTH_DIGEST_MD5, AUTH_LOGIN, AUTH_OAUTHBEARER, AUTH_PLAIN, AUTH_XOAUTH2, @@ -139,14 +140,14 @@ impl + PartialEq + Eq + Hash> Credentials { } pub fn encode(&self, mechanism: u64, challenge: &str) -> crate::Result { - Ok(base64::encode( + Ok(engine::general_purpose::STANDARD.encode( match (mechanism, self) { (AUTH_PLAIN, Credentials::Plain { username, secret }) => { format!("\u{0}{}\u{0}{}", username.as_ref(), secret.as_ref()) } (AUTH_LOGIN, Credentials::Plain { username, secret }) => { - let challenge = base64::decode(challenge)?; + let challenge = engine::general_purpose::STANDARD.decode(challenge)?; let username = username.as_ref(); let secret = secret.as_ref(); @@ -174,7 +175,7 @@ impl + PartialEq + Eq + Hash> Credentials { let mut key = None; let mut in_quote = false; let mut values = std::collections::HashMap::new(); - let challenge = base64::decode(challenge)?; + let challenge = engine::general_purpose::STANDARD.decode(challenge)?; let challenge_len = challenge.len(); let username = username.as_ref(); let secret = secret.as_ref(); @@ -239,7 +240,7 @@ impl + PartialEq + Eq + Hash> Credentials { use rand::RngCore; let mut buf = [0u8; 16]; rand::thread_rng().fill_bytes(&mut buf); - base64::encode(buf) + engine::general_purpose::STANDARD.encode(buf) }; #[cfg(test)] @@ -288,7 +289,8 @@ impl + PartialEq + Eq + Hash> Credentials { } } - secret_ipad.extend_from_slice(&base64::decode(challenge)?); + secret_ipad + .extend_from_slice(&engine::general_purpose::STANDARD.decode(challenge)?); secret_opad.extend_from_slice(&md5::compute(&secret_ipad).0); format!("{} {:x}", username, md5::compute(&secret_opad)) diff --git a/src/smtp/tls.rs b/src/smtp/tls.rs index 1dea1a8..1096de7 100644 --- a/src/smtp/tls.rs +++ b/src/smtp/tls.rs @@ -82,9 +82,9 @@ pub fn build_tls_connector(allow_invalid_certs: bool) -> TlsConnector { root_cert_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| { OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, + ta.subject.as_ref(), + ta.subject_public_key_info.as_ref(), + ta.name_constraints.as_ref().map(|v| v.as_ref()), ) }));