summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-04-09 11:19:47 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2018-04-09 12:01:45 +0100
commitd341f2a27e689098e23c4eae2f78b59d053d5060 (patch)
treedec333c732b8d14ae12f4acde0426c964b12eb36
parente5c155710bc95053e6e4b3845b79eb8fc281f769 (diff)
DMARC: fix history file
Too many variables were being cleared between connections Broken-by: c780096c29 4.91 RC2
-rw-r--r--src/src/dmarc.c9
-rw-r--r--src/src/dmarc.h2
-rw-r--r--src/src/smtp_in.c4
-rw-r--r--test/log/46502
4 files changed, 9 insertions, 8 deletions
diff --git a/src/src/dmarc.c b/src/src/dmarc.c
index 1c917aa15..2ac0ac550 100644
--- a/src/src/dmarc.c
+++ b/src/src/dmarc.c
@@ -474,8 +474,8 @@ if (!dmarc_abort && !sender_host_authenticated)
log_write(0, LOG_MAIN, "DMARC results: spf_domain=%s dmarc_domain=%s "
"spf_align=%s dkim_align=%s enforcement='%s'",
spf_sender_domain, dmarc_used_domain,
- (sa==DMARC_POLICY_SPF_ALIGNMENT_PASS) ?"yes":"no",
- (da==DMARC_POLICY_DKIM_ALIGNMENT_PASS)?"yes":"no",
+ sa==DMARC_POLICY_SPF_ALIGNMENT_PASS ?"yes":"no",
+ da==DMARC_POLICY_DKIM_ALIGNMENT_PASS ?"yes":"no",
dmarc_status_text);
history_file_status = dmarc_write_history_file();
/* Now get the forensic reporting addresses, if any */
@@ -493,7 +493,7 @@ if (!dmarc_disable_verify)
return OK;
}
-int
+static int
dmarc_write_history_file()
{
int history_file_fd;
@@ -503,7 +503,10 @@ u_char **rua; /* aggregate report addressees */
uschar *history_buffer = NULL;
if (!dmarc_history_file)
+ {
+ DEBUG(D_receive) debug_printf("DMARC history file not set\n");
return DMARC_HIST_DISABLED;
+ }
history_file_fd = log_create(dmarc_history_file);
if (history_file_fd < 0)
diff --git a/src/src/dmarc.h b/src/src/dmarc.h
index 764ff88ff..3a3bc6d13 100644
--- a/src/src/dmarc.h
+++ b/src/src/dmarc.h
@@ -23,7 +23,7 @@ int dmarc_process();
uschar *dmarc_exim_expand_query(int);
uschar *dmarc_exim_expand_defaults(int);
uschar *dmarc_auth_results_header(header_line *,uschar *);
-int dmarc_write_history_file();
+static int dmarc_write_history_file();
#define DMARC_AR_HEADER US"Authentication-Results:"
#define DMARC_VERIFY_STATUS 1
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index db9fb6879..33d6d3cc8 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -2015,9 +2015,7 @@ spf_result_guessed = FALSE;
#endif
#ifdef EXPERIMENTAL_DMARC
dmarc_has_been_checked = dmarc_disable_verify = dmarc_enable_forensic = FALSE;
-dmarc_domain_policy = dmarc_forensic_sender =
-dmarc_history_file = dmarc_status = dmarc_status_text =
-dmarc_used_domain = NULL;
+dmarc_domain_policy = dmarc_status = dmarc_status_text = dmarc_used_domain = NULL;
#endif
#ifdef EXPERIMENTAL_ARC
arc_state = arc_state_reason = NULL;
diff --git a/test/log/4650 b/test/log/4650
index 2abe33f88..bc25849f4 100644
--- a/test/log/4650
+++ b/test/log/4650
@@ -5,5 +5,5 @@
1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_status_text <No DMARC record>
1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_used_domain <example.com>
1999-03-02 09:44:33 10HmaX-0005vi-00 dmarc_domain_policy <>
-1999-03-02 09:44:33 10HmaX-0005vi-00 Authentication-Results: myhost.test.ex;\n spf=fail smtp.mailfrom=example.com;\n dmarc=noneheader.from=example.com
+1999-03-02 09:44:33 10HmaX-0005vi-00 Authentication-Results: myhost.test.ex;\n spf=fail smtp.mailfrom=example.com;\n dmarc=none header.from=example.com
1999-03-02 09:44:33 10HmaX-0005vi-00 <= a@example.com H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss