minfrin / rpms / opendmarc

Forked from rpms/opendmarc 3 years ago
Clone
Blob Blame History Raw
Description: do not report same dkim result multiple times
             in the same record object
URL: https://sf.net/p/opendmarc/tickets/153/
Author: Tomki
---
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)
 			{