Index: opendmarc-1.2.0.beta2/opendmarc/opendmarc.c =================================================================== --- opendmarc-1.2.0.beta2.orig/opendmarc/opendmarc.c 2014-03-11 07:36:15.000000000 +0100 +++ opendmarc-1.2.0.beta2/opendmarc/opendmarc.c 2014-03-11 08:34:51.000000000 +0100 @@ -126,6 +126,7 @@ struct dmarcf_config { _Bool conf_reqhdrs; + _Bool conf_rejectreqhdrsfail; _Bool conf_afrf; _Bool conf_afrfnone; _Bool conf_rejectfail; @@ -1231,6 +1232,10 @@ &conf->conf_reqhdrs, sizeof conf->conf_reqhdrs); + (void) config_get(data, "RejectRequiredHeadersFailures", + &conf->conf_rejectreqhdrsfail, + sizeof conf->conf_rejectreqhdrsfail); + (void) config_get(data, "ForensicReports", &conf->conf_afrf, sizeof conf->conf_afrf); @@ -2039,7 +2044,17 @@ dfc->mctx_jobid, reqhdrs_error); } - return SMFIS_REJECT; + if (conf->conf_rejectreqhdrsfail) { + /* TODO: handle setreply failures */ + snprintf(replybuf, sizeof replybuf, + "RFC5322 header requirement error"); + dmarcf_setreply(ctx, DMARC_REJECT_SMTP, + DMARC_REJECT_ESC, replybuf); + return SMFIS_REJECT; + /* Option: Add Header, which header(s) is/are wrong */ + // } else { + // add code here + } } } @@ -2057,7 +2072,7 @@ dfc->mctx_jobid); } - if (conf->conf_reqhdrs) + if (conf->conf_rejectreqhdrsfail) return SMFIS_REJECT; else return SMFIS_ACCEPT; Index: opendmarc-1.2.0.beta2/opendmarc/opendmarc.conf.5.in =================================================================== --- opendmarc-1.2.0.beta2.orig/opendmarc/opendmarc.conf.5.in 2014-03-11 07:36:15.000000000 +0100 +++ opendmarc-1.2.0.beta2/opendmarc/opendmarc.conf.5.in 2014-03-11 08:31:55.000000000 +0100 @@ -225,8 +225,12 @@ .I RequiredHeaders (Boolean) If set, the filter will ensure the header of the message conforms to the basic header field count restrictions laid out in RFC5322, Section 3.6. Messages -failing this test are rejected without further processing. A From: -field from which no domain name could be extracted will also be rejected. +failing this test are logged. A From: +field from which no domain name could be extracted will also be logged. + +.TP +.I RejectRequiredHeadersFailures (Boolean) +Messages failing the above tests are rejected without further processing. .TP .I Socket (string) Index: opendmarc-1.2.0.beta2/opendmarc/opendmarc-config.h =================================================================== --- opendmarc-1.2.0.beta2.orig/opendmarc/opendmarc-config.h 2014-03-11 07:36:15.000000000 +0100 +++ opendmarc-1.2.0.beta2/opendmarc/opendmarc-config.h 2014-03-11 08:31:55.000000000 +0100 @@ -39,6 +39,7 @@ { "PublicSuffixList", CONFIG_TYPE_STRING, FALSE }, { "RecordAllMessages", CONFIG_TYPE_BOOLEAN, FALSE }, { "RequiredHeaders", CONFIG_TYPE_BOOLEAN, FALSE }, + { "RejectRequiredHeadersFailures", CONFIG_TYPE_BOOLEAN, FALSE }, { "RejectFailures", CONFIG_TYPE_BOOLEAN, FALSE }, { "ReportCommand", CONFIG_TYPE_STRING, FALSE }, { "Socket", CONFIG_TYPE_STRING, FALSE },