Commit
Author: Kevin Schoon [me@kevinschoon.com]
Hash: 577b5cc3ee4ac56a2ce9605fba4d5f9ca22d22b7
Timestamp: Sun, 19 Jan 2025 12:04:38 +0000 (2 days ago)

+35 -25 +/-3 browse
bump mail-auth package
1diff --git a/Cargo.lock b/Cargo.lock
2index 77a6a43..4647ae5 100644
3--- a/Cargo.lock
4+++ b/Cargo.lock
5 @@ -1179,18 +1179,17 @@ dependencies = [
6
7 [[package]]
8 name = "mail-auth"
9- version = "0.5.1"
10+ version = "0.6.0"
11 source = "registry+https://github.com/rust-lang/crates.io-index"
12- checksum = "01e36ed6613c4c43f2d3e4ff3af1888b3612c74d56fe0eac2cf25706f6a85a6b"
13+ checksum = "b07f5abe750633593de4a5b1d84c6c7fbe54313c105732cddc7f3aa205d1e31e"
14 dependencies = [
15 "ahash",
16 "flate2",
17 "hickory-resolver",
18- "lru-cache",
19 "mail-builder",
20 "mail-parser",
21- "parking_lot",
22 "quick-xml",
23+ "quick_cache",
24 "ring 0.17.8",
25 "rustls-pemfile 2.2.0",
26 "serde",
27 @@ -1578,6 +1577,18 @@ dependencies = [
28 ]
29
30 [[package]]
31+ name = "quick_cache"
32+ version = "0.6.9"
33+ source = "registry+https://github.com/rust-lang/crates.io-index"
34+ checksum = "7d7c94f8935a9df96bb6380e8592c70edf497a643f94bd23b2f76b399385dbf4"
35+ dependencies = [
36+ "ahash",
37+ "equivalent",
38+ "hashbrown 0.14.5",
39+ "parking_lot",
40+ ]
41+
42+ [[package]]
43 name = "quote"
44 version = "1.0.36"
45 source = "registry+https://github.com/rust-lang/crates.io-index"
46 diff --git a/Cargo.toml b/Cargo.toml
47index 7170f7e..909b238 100644
48--- a/Cargo.toml
49+++ b/Cargo.toml
50 @@ -4,29 +4,29 @@ version = "0.1.0"
51 edition = "2021"
52
53 [dependencies]
54- async-trait = "0.1.83"
55+ async-trait = "0.1.85"
56 base64 = { version = "0.22.1"}
57- bytes = "1.8.0"
58+ bytes = "1.9.0"
59 email_address = "0.2.9"
60 futures = "0.3.31"
61 hickory-resolver = { version = "0.24.2", optional = true }
62- mail-auth = { version = "0.5.1", features = ["ring", "rustls-pemfile"], optional = true }
63+ mail-auth = { version = "0.6.0", features = ["ring", "rustls-pemfile"], optional = true }
64 mail-builder = "0.3.2"
65 mail-parser = { version = "0.9.4", features = ["serde", "serde_support"] }
66 maildir = "0.6.4"
67 md5 = "0.7.0"
68 proxy-header = "0.1.2"
69- rustls = { version = "0.23.15", optional = true }
70+ rustls = { version = "0.23.21", optional = true }
71 rustls-pemfile = { version = "2.2.0", optional = true }
72 smtp-proto = { version = "0.1.5", features = ["serde", "serde_support"] }
73 stringprep = "0.1.5"
74- thiserror = "1.0.65"
75- tokio = { version = "1.41.0", features = ["full"], optional = true }
76- tokio-rustls = { version = "0.26.0", optional = true }
77- tokio-stream = { version = "0.1.16", features = ["full"], optional = true }
78- tokio-util = { version = "0.7.12", features = ["full"], optional = true }
79- tracing = { version = "0.1.40", features = ["log"] }
80- url = "2.5.2"
81+ thiserror = "1.0.69"
82+ tokio = { version = "1.43.0", features = ["full"], optional = true }
83+ tokio-rustls = { version = "0.26.1", optional = true }
84+ tokio-stream = { version = "0.1.17", features = ["full"], optional = true }
85+ tokio-util = { version = "0.7.13", features = ["full"], optional = true }
86+ tracing = { version = "0.1.41", features = ["log"] }
87+ url = "2.5.4"
88
89 [dependencies.lettre]
90 version = "0.11.11"
91 @@ -36,7 +36,7 @@ default-features = false
92
93 [dev-dependencies]
94 port_check = "0.2.1"
95- tracing-subscriber = "0.3.18"
96+ tracing-subscriber = "0.3.19"
97
98 [features]
99 default = []
100 diff --git a/src/authentication.rs b/src/authentication.rs
101index 8b9766f..6536dba 100644
102--- a/src/authentication.rs
103+++ b/src/authentication.rs
104 @@ -1,14 +1,16 @@
105 use std::net::IpAddr;
106
107- use mail_auth::{AuthenticatedMessage, AuthenticationResults, Resolver};
108+ use mail_auth::{
109+ spf::verify::SpfParameters, AuthenticatedMessage, AuthenticationResults, MessageAuthenticator,
110+ };
111 use tokio::sync::Mutex;
112
113 /// Perform various mail authentication
114- pub struct Authentication(Mutex<Resolver>);
115+ pub struct Authentication(Mutex<MessageAuthenticator>);
116
117 impl Default for Authentication {
118 fn default() -> Self {
119- Authentication(Mutex::new(Resolver::new_system_conf().unwrap()))
120+ Authentication(Mutex::new(MessageAuthenticator::new_system_conf().unwrap()))
121 }
122 }
123
124 @@ -25,12 +27,9 @@ impl Authentication {
125 host_domain: &str,
126 mail_from: &str,
127 ) -> AuthenticationResults<'a> {
128- let output = self
129- .0
130- .lock()
131- .await
132- .verify_spf(ip_addr, helo_domain, host_domain, mail_from)
133- .await;
134+ let authenticator = self.0.lock().await;
135+ let params = SpfParameters::new(ip_addr, helo_domain, helo_domain, host_domain, mail_from);
136+ let output = authenticator.verify_spf(params).await;
137 tracing::info!("SPF result: {}", output.result());
138 results.with_spf_ehlo_result(&output, ip_addr, helo_domain)
139 }