From 6ee0bdd098ed387d5894f2635efc054d096f1247 Mon Sep 17 00:00:00 2001 From: Geert Hendrickx Date: Sun, 6 Feb 2022 21:09:04 +0100 Subject: [PATCH] RequiredHeaders: distinguish "missing From field" and "multiple From fields" instead of the ambiguous "not exactly one From field". Same for Date field. --- opendmarc/opendmarc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/opendmarc/opendmarc.c b/opendmarc/opendmarc.c index 7c1eda6..b01ae38 100644 --- a/opendmarc/opendmarc.c +++ b/opendmarc/opendmarc.c @@ -2405,13 +2405,17 @@ mlfi_eom(SMFICTX *ctx) from = dmarcf_findheader(dfc, "From", 0); /* verify RFC5322-required headers (RFC5322 3.6) */ - if (from == NULL || - dmarcf_findheader(dfc, "From", 1) != NULL) - reqhdrs_error = "not exactly one From field"; + if (from == NULL) + reqhdrs_error = "missing From field"; + + if (dmarcf_findheader(dfc, "From", 1) != NULL) + reqhdrs_error = "multiple From fields"; + + if (dmarcf_findheader(dfc, "Date", 0) == NULL) + reqhdrs_error = "missing Date field"; - if (dmarcf_findheader(dfc, "Date", 0) == NULL || - dmarcf_findheader(dfc, "Date", 1) != NULL) - reqhdrs_error = "not exactly one Date field"; + if (dmarcf_findheader(dfc, "Date", 1) != NULL) + reqhdrs_error = "multiple Date fields"; if (dmarcf_findheader(dfc, "Reply-To", 1) != NULL) reqhdrs_error = "multiple Reply-To fields";