Skip to content

Commit

Permalink
v0.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Jun 19, 2024
1 parent db3591e commit e082e30
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "Apache-2.0 OR MIT"
Expand Down Expand Up @@ -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 }
Expand Down
8 changes: 4 additions & 4 deletions src/common/lru.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ pub struct LruItem<V> {

pub trait DnsCache<K, V>: Sized {
fn with_capacity(capacity: usize) -> Self;
fn get<Q: ?Sized>(&self, name: &Q) -> Option<V>
fn get<Q>(&self, name: &Q) -> Option<V>
where
K: Borrow<Q>,
Q: Hash + Eq;
Q: Hash + Eq + ?Sized;
fn insert(&self, name: K, value: V, valid_until: Instant) -> V;
}

Expand All @@ -37,10 +37,10 @@ impl<K: Hash + Eq, V: Clone> DnsCache<K, V> for LruCache<K, V> {
))
}

fn get<Q: ?Sized>(&self, name: &Q) -> Option<V>
fn get<Q>(&self, name: &Q) -> Option<V>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
let mut cache = self.lock();
let entry = cache.get_mut(name)?;
Expand Down
2 changes: 1 addition & 1 deletion src/report/dmarc/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/report/tlsrpt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -38,7 +38,7 @@ pub struct TlsReport {
pub policies: Vec<Policy>,
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct Policy {
#[serde(rename = "policy")]
pub policy: PolicyDetails,
Expand All @@ -51,7 +51,7 @@ pub struct Policy {
pub failure_details: Vec<FailureDetails>,
}

#[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,
Expand All @@ -69,7 +69,7 @@ pub struct PolicyDetails {
pub mx_host: Vec<String>,
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
pub struct Summary {
#[serde(rename = "total-successful-session-count")]
#[serde(default)]
Expand All @@ -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,
Expand Down Expand Up @@ -108,7 +108,7 @@ pub struct FailureDetails {
pub failure_reason_code: Option<String>,
}

#[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")]
Expand All @@ -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,
Expand Down

0 comments on commit e082e30

Please sign in to comment.