aboutsummaryrefslogtreecommitdiffstats
path: root/testing/opendmarc/fix-153-duplicate-dkim-auth_result-sections.patch
blob: d0bc7eb27cd00d73f689b8538ee0244b6b57a986 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: do not report same dkim result multiple times
             in the same record object
URL: https://sf.net/p/opendmarc/tickets/153/
Author: Tomki

Patch-Source: https://sourceforge.net/p/opendmarc/tickets/_discuss/thread/1ed9d2d3/a93c/attachment/ticket153.patch
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: opendmarc-1.3.1/reports/opendmarc-reports.in
===================================================================
--- opendmarc-1.3.1.orig/reports/opendmarc-reports.in
+++ opendmarc-1.3.1/reports/opendmarc-reports.in
@@ -719,6 +719,7 @@ foreach (@$domainset)
 			exit(1);
 		}
 
+		my %dkim_domain_result_cache = ();
 		while ($dbi_a = $dbi_d->fetchrow_arrayref())
 		{
 			undef $dkimdomain;
@@ -732,11 +733,15 @@ foreach (@$domainset)
 				$dkimresult = $dbi_a->[1];
 			}
 
-
 			if (!defined($dkimdomain))
 			{
 				next;
 			}
+			if (defined($dkim_domain_result_cache{$dkimdomain}{$dkimresult}))
+			{
+				next; # no duplicate per-record auth_result dkim sections
+			}
+			$dkim_domain_result_cache{$dkimdomain}{$dkimresult}++;
 
 			switch ($dkimresult)
 			{