Fix MTA: DMARC is skipped when MAIL FROM SPF is unavailable

This commit is contained in:
Maurus Decimus
2026-07-19 15:44:06 +02:00
parent 3de53f9c31
commit f967132971
2 changed files with 14 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
- Web Push payloads with `Content-Encoding: aes128gcm` should not be base64-encoded but sent as raw bytes.
- `Email/import` does not send push notifications for imported messages.
- `CalendarEvent/set` silently ignores `ifInState`.
- MTA: DMARC is skipped when MAIL FROM SPF is unavailable.
- Calendar:
- Uppercase `MAILTO` calendar addresses become invalid SMTP recipients.
- Scheduling invitations on a shared, non-owned calendar fail with `MAIL FROM unauthorized`.

View File

@@ -29,6 +29,7 @@ use common::{
};
use mail_auth::{
AuthenticatedMessage, AuthenticationResults, Dkim2Result, DkimResult, DmarcResult, ReceivedSpf,
SpfOutput, SpfResult,
common::{
crypto::Algorithm,
headers::{Header, HeaderWriter},
@@ -349,8 +350,16 @@ impl<T: SessionStream> Session<T> {
// Verify DMARC
let is_report = !self.is_authenticated() && self.is_report();
let (dmarc_result, dmarc_policy) = match &self.data.spf_mail_from {
Some(spf_output) if dmarc.verify() => {
let (dmarc_result, dmarc_policy) = if dmarc.verify() {
{
let synthetic_spf;
let spf_output = match &self.data.spf_mail_from {
Some(spf_output) => spf_output,
None => {
synthetic_spf = SpfOutput::new(String::new()).with_result(SpfResult::None);
&synthetic_spf
}
};
let time = Instant::now();
let dmarc_output =
self.server
@@ -432,7 +441,8 @@ impl<T: SessionStream> Session<T> {
(dmarc_result.into(), dmarc_policy.into())
}
_ => (None, None),
} else {
(None, None)
};
// Analyze reports