Skip to content

Commit 09981bc

Browse files
committed
v0.4.2
1 parent 53904ce commit 09981bc

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
mail-send 0.4.2
2+
================================
3+
- Bump `webpki-roots` dependency to 0.26
4+
15
mail-send 0.4.1
26
================================
37
- Bump `webpki-roots` dependency to 0.25

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "mail-send"
33
description = "E-mail delivery library with SMTP and DKIM support"
4-
version = "0.4.1"
4+
version = "0.4.2"
55
edition = "2021"
66
authors = [ "Stalwart Labs <hello@stalw.art>"]
77
license = "Apache-2.0 OR MIT"
@@ -18,13 +18,13 @@ doctest = false
1818
smtp-proto = { version = "0.1", git = "https://github.com/stalwartlabs/smtp-proto" }
1919
mail-auth = { version = "0.3", git = "https://github.com/stalwartlabs/mail-auth", optional = true }
2020
mail-builder = { version = "0.3", git = "https://github.com/stalwartlabs/mail-builder", optional = true }
21-
base64 = "0.20.0"
21+
base64 = "0.21"
2222
rand = { version = "0.8.5", optional = true }
2323
md5 = { version = "0.7.0", optional = true }
2424
tokio = { version = "1.23", features = ["net", "io-util", "time"]}
2525
rustls = { version = "0.21", features = ["tls12", "dangerous_configuration"]}
2626
tokio-rustls = { version = "0.24"}
27-
webpki-roots = { version = "0.25.2"}
27+
webpki-roots = { version = "0.26"}
2828
gethostname = { version = "0.4"}
2929

3030
[dev-dependencies]

src/smtp/auth.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use std::{fmt::Display, hash::Hash};
1212

13+
use base64::{engine, Engine};
1314
use smtp_proto::{
1415
response::generate::BitToString, EhloResponse, AUTH_CRAM_MD5, AUTH_DIGEST_MD5, AUTH_LOGIN,
1516
AUTH_OAUTHBEARER, AUTH_PLAIN, AUTH_XOAUTH2,
@@ -139,14 +140,14 @@ impl<T: AsRef<str> + PartialEq + Eq + Hash> Credentials<T> {
139140
}
140141

141142
pub fn encode(&self, mechanism: u64, challenge: &str) -> crate::Result<String> {
142-
Ok(base64::encode(
143+
Ok(engine::general_purpose::STANDARD.encode(
143144
match (mechanism, self) {
144145
(AUTH_PLAIN, Credentials::Plain { username, secret }) => {
145146
format!("\u{0}{}\u{0}{}", username.as_ref(), secret.as_ref())
146147
}
147148

148149
(AUTH_LOGIN, Credentials::Plain { username, secret }) => {
149-
let challenge = base64::decode(challenge)?;
150+
let challenge = engine::general_purpose::STANDARD.decode(challenge)?;
150151
let username = username.as_ref();
151152
let secret = secret.as_ref();
152153

@@ -174,7 +175,7 @@ impl<T: AsRef<str> + PartialEq + Eq + Hash> Credentials<T> {
174175
let mut key = None;
175176
let mut in_quote = false;
176177
let mut values = std::collections::HashMap::new();
177-
let challenge = base64::decode(challenge)?;
178+
let challenge = engine::general_purpose::STANDARD.decode(challenge)?;
178179
let challenge_len = challenge.len();
179180
let username = username.as_ref();
180181
let secret = secret.as_ref();
@@ -239,7 +240,7 @@ impl<T: AsRef<str> + PartialEq + Eq + Hash> Credentials<T> {
239240
use rand::RngCore;
240241
let mut buf = [0u8; 16];
241242
rand::thread_rng().fill_bytes(&mut buf);
242-
base64::encode(buf)
243+
engine::general_purpose::STANDARD.encode(buf)
243244
};
244245

245246
#[cfg(test)]
@@ -288,7 +289,8 @@ impl<T: AsRef<str> + PartialEq + Eq + Hash> Credentials<T> {
288289
}
289290
}
290291

291-
secret_ipad.extend_from_slice(&base64::decode(challenge)?);
292+
secret_ipad
293+
.extend_from_slice(&engine::general_purpose::STANDARD.decode(challenge)?);
292294
secret_opad.extend_from_slice(&md5::compute(&secret_ipad).0);
293295

294296
format!("{} {:x}", username, md5::compute(&secret_opad))

src/smtp/tls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ pub fn build_tls_connector(allow_invalid_certs: bool) -> TlsConnector {
8282

8383
root_cert_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.iter().map(|ta| {
8484
OwnedTrustAnchor::from_subject_spki_name_constraints(
85-
ta.subject,
86-
ta.spki,
87-
ta.name_constraints,
85+
ta.subject.as_ref(),
86+
ta.subject_public_key_info.as_ref(),
87+
ta.name_constraints.as_ref().map(|v| v.as_ref()),
8888
)
8989
}));
9090

0 commit comments

Comments
 (0)