diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c8c695..7e67244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +mail-auth 0.4.3 +================================ +- Fix: Domain name length check in SPF verification (#34) +- Fix: DNS lookup limit being hit too early during SPF verification (#35) +- Make `TlsReport` clonable. +- Bump `quick-xml` dependency to 0.3.2. + mail-auth 0.4.2 ================================ - Fix: IPv6 parsing bug in SPF parser (#32) diff --git a/Cargo.toml b/Cargo.toml index 617cad5..69af37e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mail-auth" description = "DKIM, ARC, SPF and DMARC library for Rust" -version = "0.4.2" +version = "0.4.3" edition = "2021" authors = [ "Stalwart Labs "] license = "Apache-2.0 OR MIT" @@ -29,7 +29,7 @@ lru-cache = "0.1.2" mail-parser = { version = "0.9", features = ["ludicrous_mode", "full_encoding"] } mail-builder = { version = "0.3", features = ["ludicrous_mode"] } parking_lot = "0.12.0" -quick-xml = "0.31" +quick-xml = "0.32" ring = { version = "0.17", optional = true } rsa = { version = "0.9.6", optional = true } rustls-pemfile = { version = "2", optional = true } diff --git a/src/common/lru.rs b/src/common/lru.rs index 67be0ee..2ba5361 100644 --- a/src/common/lru.rs +++ b/src/common/lru.rs @@ -22,10 +22,10 @@ pub struct LruItem { pub trait DnsCache: Sized { fn with_capacity(capacity: usize) -> Self; - fn get(&self, name: &Q) -> Option + fn get(&self, name: &Q) -> Option where K: Borrow, - Q: Hash + Eq; + Q: Hash + Eq + ?Sized; fn insert(&self, name: K, value: V, valid_until: Instant) -> V; } @@ -37,10 +37,10 @@ impl DnsCache for LruCache { )) } - fn get(&self, name: &Q) -> Option + fn get(&self, name: &Q) -> Option where K: Borrow, - Q: Hash + Eq, + Q: Hash + Eq + ?Sized, { let mut cache = self.lock(); let entry = cache.get_mut(name)?; diff --git a/src/report/dmarc/parse.rs b/src/report/dmarc/parse.rs index a7646f4..bee1c5e 100644 --- a/src/report/dmarc/parse.rs +++ b/src/report/dmarc/parse.rs @@ -143,7 +143,7 @@ impl Report { let mut extensions = Vec::new(); let mut reader = Reader::from_reader(report); - reader.trim_text(true); + reader.config_mut().trim_text(true); let mut buf = Vec::with_capacity(128); let mut found_feedback = false; diff --git a/src/report/tlsrpt/mod.rs b/src/report/tlsrpt/mod.rs index fc50330..b8011f7 100644 --- a/src/report/tlsrpt/mod.rs +++ b/src/report/tlsrpt/mod.rs @@ -16,7 +16,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; pub mod generate; pub mod parse; -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct TlsReport { #[serde(rename = "organization-name")] #[serde(default)] @@ -38,7 +38,7 @@ pub struct TlsReport { pub policies: Vec, } -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct Policy { #[serde(rename = "policy")] pub policy: PolicyDetails, @@ -51,7 +51,7 @@ pub struct Policy { pub failure_details: Vec, } -#[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct PolicyDetails { #[serde(rename = "policy-type")] pub policy_type: PolicyType, @@ -69,7 +69,7 @@ pub struct PolicyDetails { pub mx_host: Vec, } -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct Summary { #[serde(rename = "total-successful-session-count")] #[serde(default)] @@ -80,7 +80,7 @@ pub struct Summary { pub total_failure: u32, } -#[derive(Debug, Default, Hash, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Default, Hash, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct FailureDetails { #[serde(rename = "result-type")] pub result_type: ResultType, @@ -108,7 +108,7 @@ pub struct FailureDetails { pub failure_reason_code: Option, } -#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct DateRange { #[serde(rename = "start-datetime")] #[serde(serialize_with = "serialize_datetime")] @@ -120,7 +120,7 @@ pub struct DateRange { pub end_datetime: DateTime, } -#[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Default, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)] pub enum PolicyType { #[serde(rename = "tlsa")] Tlsa,