DMARC: fix history file
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 9 Apr 2018 10:19:47 +0000 (11:19 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Mon, 9 Apr 2018 11:01:45 +0000 (12:01 +0100)
Too many variables were being cleared between connections
Broken-by: c780096c29 4.91 RC2
src/src/dmarc.c
src/src/dmarc.h
src/src/smtp_in.c
test/log/4650

index 1c917aa15623e8c47e23d8eafe777154f356aebd..2ac0ac55087057634a7aecf1eeb96d8ce0af2a86 100644 (file)
@@ -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,
     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 */
                           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;
 }
 
 return OK;
 }
 
-int
+static int
 dmarc_write_history_file()
 {
 int history_file_fd;
 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)
 uschar *history_buffer = NULL;
 
 if (!dmarc_history_file)
+  {
+  DEBUG(D_receive) debug_printf("DMARC history file not set\n");
   return DMARC_HIST_DISABLED;
   return DMARC_HIST_DISABLED;
+  }
 history_file_fd = log_create(dmarc_history_file);
 
 if (history_file_fd < 0)
 history_file_fd = log_create(dmarc_history_file);
 
 if (history_file_fd < 0)
index 764ff88ffb70a4288e6ef3f59cf671c798917843..3a3bc6d132b481ab2c966f04a13a3ef2382298d7 100644 (file)
@@ -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 *);
 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
 
 #define DMARC_AR_HEADER        US"Authentication-Results:"
 #define DMARC_VERIFY_STATUS    1
index db9fb68795741f139c8201a431b0704d40053b6d..33d6d3cc856ec204c5015886a9e3f0eb38e9df48 100644 (file)
@@ -2015,9 +2015,7 @@ spf_result_guessed = FALSE;
 #endif
 #ifdef EXPERIMENTAL_DMARC
 dmarc_has_been_checked = dmarc_disable_verify = dmarc_enable_forensic = 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;
 #endif
 #ifdef EXPERIMENTAL_ARC
 arc_state = arc_state_reason = NULL;
index 2abe33f8800244a812d05994a5e03e3a32ab39ad..bc25849f4630f456d6dc1a36f6a7f388d7a1d738 100644 (file)
@@ -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 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
 1999-03-02 09:44:33 10HmaX-0005vi-00 <= a@example.com H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss