Commit
+21 -14 +/-5 browse
1 | diff --git a/CHANGELOG.md b/CHANGELOG.md |
2 | index 0c8c695..7e67244 100644 |
3 | --- a/CHANGELOG.md |
4 | +++ b/CHANGELOG.md |
5 | @@ -1,3 +1,10 @@ |
6 | + mail-auth 0.4.3 |
7 | + ================================ |
8 | + - Fix: Domain name length check in SPF verification (#34) |
9 | + - Fix: DNS lookup limit being hit too early during SPF verification (#35) |
10 | + - Make `TlsReport` clonable. |
11 | + - Bump `quick-xml` dependency to 0.3.2. |
12 | + |
13 | mail-auth 0.4.2 |
14 | ================================ |
15 | - Fix: IPv6 parsing bug in SPF parser (#32) |
16 | diff --git a/Cargo.toml b/Cargo.toml |
17 | index 617cad5..69af37e 100644 |
18 | --- a/Cargo.toml |
19 | +++ b/Cargo.toml |
20 | @@ -1,7 +1,7 @@ |
21 | [package] |
22 | name = "mail-auth" |
23 | description = "DKIM, ARC, SPF and DMARC library for Rust" |
24 | - version = "0.4.2" |
25 | + version = "0.4.3" |
26 | edition = "2021" |
27 | authors = [ "Stalwart Labs <hello@stalw.art>"] |
28 | license = "Apache-2.0 OR MIT" |
29 | @@ -29,7 +29,7 @@ lru-cache = "0.1.2" |
30 | mail-parser = { version = "0.9", features = ["ludicrous_mode", "full_encoding"] } |
31 | mail-builder = { version = "0.3", features = ["ludicrous_mode"] } |
32 | parking_lot = "0.12.0" |
33 | - quick-xml = "0.31" |
34 | + quick-xml = "0.32" |
35 | ring = { version = "0.17", optional = true } |
36 | rsa = { version = "0.9.6", optional = true } |
37 | rustls-pemfile = { version = "2", optional = true } |
38 | diff --git a/src/common/lru.rs b/src/common/lru.rs |
39 | index 67be0ee..2ba5361 100644 |
40 | --- a/src/common/lru.rs |
41 | +++ b/src/common/lru.rs |
42 | @@ -22,10 +22,10 @@ pub struct LruItem<V> { |
43 | |
44 | pub trait DnsCache<K, V>: Sized { |
45 | fn with_capacity(capacity: usize) -> Self; |
46 | - fn get<Q: ?Sized>(&self, name: &Q) -> Option<V> |
47 | + fn get<Q>(&self, name: &Q) -> Option<V> |
48 | where |
49 | K: Borrow<Q>, |
50 | - Q: Hash + Eq; |
51 | + Q: Hash + Eq + ?Sized; |
52 | fn insert(&self, name: K, value: V, valid_until: Instant) -> V; |
53 | } |
54 | |
55 | @@ -37,10 +37,10 @@ impl<K: Hash + Eq, V: Clone> DnsCache<K, V> for LruCache<K, V> { |
56 | )) |
57 | } |
58 | |
59 | - fn get<Q: ?Sized>(&self, name: &Q) -> Option<V> |
60 | + fn get<Q>(&self, name: &Q) -> Option<V> |
61 | where |
62 | K: Borrow<Q>, |
63 | - Q: Hash + Eq, |
64 | + Q: Hash + Eq + ?Sized, |
65 | { |
66 | let mut cache = self.lock(); |
67 | let entry = cache.get_mut(name)?; |
68 | diff --git a/src/report/dmarc/parse.rs b/src/report/dmarc/parse.rs |
69 | index a7646f4..bee1c5e 100644 |
70 | --- a/src/report/dmarc/parse.rs |
71 | +++ b/src/report/dmarc/parse.rs |
72 | @@ -143,7 +143,7 @@ impl Report { |
73 | let mut extensions = Vec::new(); |
74 | |
75 | let mut reader = Reader::from_reader(report); |
76 | - reader.trim_text(true); |
77 | + reader.config_mut().trim_text(true); |
78 | |
79 | let mut buf = Vec::with_capacity(128); |
80 | let mut found_feedback = false; |
81 | diff --git a/src/report/tlsrpt/mod.rs b/src/report/tlsrpt/mod.rs |
82 | index fc50330..b8011f7 100644 |
83 | --- a/src/report/tlsrpt/mod.rs |
84 | +++ b/src/report/tlsrpt/mod.rs |
85 | @@ -16,7 +16,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
86 | pub mod generate; |
87 | pub mod parse; |
88 | |
89 | - #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] |
90 | + #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] |
91 | pub struct TlsReport { |
92 | #[serde(rename = "organization-name")] |
93 | #[serde(default)] |
94 | @@ -38,7 +38,7 @@ pub struct TlsReport { |
95 | pub policies: Vec<Policy>, |
96 | } |
97 | |
98 | - #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] |
99 | + #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] |
100 | pub struct Policy { |
101 | #[serde(rename = "policy")] |
102 | pub policy: PolicyDetails, |
103 | @@ -51,7 +51,7 @@ pub struct Policy { |
104 | pub failure_details: Vec<FailureDetails>, |
105 | } |
106 | |
107 | - #[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] |
108 | + #[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize, Clone)] |
109 | pub struct PolicyDetails { |
110 | #[serde(rename = "policy-type")] |
111 | pub policy_type: PolicyType, |
112 | @@ -69,7 +69,7 @@ pub struct PolicyDetails { |
113 | pub mx_host: Vec<String>, |
114 | } |
115 | |
116 | - #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] |
117 | + #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] |
118 | pub struct Summary { |
119 | #[serde(rename = "total-successful-session-count")] |
120 | #[serde(default)] |
121 | @@ -80,7 +80,7 @@ pub struct Summary { |
122 | pub total_failure: u32, |
123 | } |
124 | |
125 | - #[derive(Debug, Default, Hash, PartialEq, Eq, Serialize, Deserialize)] |
126 | + #[derive(Debug, Default, Hash, PartialEq, Eq, Serialize, Deserialize, Clone)] |
127 | pub struct FailureDetails { |
128 | #[serde(rename = "result-type")] |
129 | pub result_type: ResultType, |
130 | @@ -108,7 +108,7 @@ pub struct FailureDetails { |
131 | pub failure_reason_code: Option<String>, |
132 | } |
133 | |
134 | - #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] |
135 | + #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] |
136 | pub struct DateRange { |
137 | #[serde(rename = "start-datetime")] |
138 | #[serde(serialize_with = "serialize_datetime")] |
139 | @@ -120,7 +120,7 @@ pub struct DateRange { |
140 | pub end_datetime: DateTime, |
141 | } |
142 | |
143 | - #[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] |
144 | + #[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)] |
145 | pub enum PolicyType { |
146 | #[serde(rename = "tlsa")] |
147 | Tlsa, |