File: ticket207.patch

package info (click to toggle)
opendmarc 1.4.2-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 9,900 kB
  • sloc: xml: 291,627; ansic: 14,128; perl: 2,384; sh: 460; makefile: 212; python: 58
file content (49 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download | duplicates (2)
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
38
39
40
41
42
43
44
45
46
47
48
49
From: Scott Kitterman <scott@kitterman.com>
Date: Mon, 23 Dec 2019 11:12:36 -0500
Subject: ticket207

Bug: https://sourceforge.net/p/opendmarc/tickets/207/
---
 reports/opendmarc-reports.in | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/reports/opendmarc-reports.in b/reports/opendmarc-reports.in
index 69a2194..143997e 100755
--- a/reports/opendmarc-reports.in
+++ b/reports/opendmarc-reports.in
@@ -65,6 +65,7 @@ my $domainset;
 my $forcedomain;
 my @skipdomains;
 
+my $poldomain;
 my $policy;
 my $spolicy;
 my $policystr;
@@ -447,7 +448,7 @@ foreach (@$domainset)
 		next;
 	}
 
-	$dbi_s = $dbi_h->prepare("SELECT repuri, adkim, aspf, policy, spolicy, pct, UNIX_TIMESTAMP(lastsent) FROM requests WHERE domain = ?");
+	$dbi_s = $dbi_h->prepare("SELECT repuri, adkim, aspf, requests.policy, spolicy, pct, UNIX_TIMESTAMP(lastsent), domains.name FROM requests JOIN messages ON messages.from_domain=requests.domain LEFT JOIN domains ON messages.policy_domain = domains.id WHERE domain = ? GROUP BY policy_domain");
 	if (!$dbi_s->execute($domainid))
 	{
 		print STDERR "$progname: can't get reporting URI for domain $domain: " . $dbi_h->errstr . "\n";
@@ -457,6 +458,7 @@ foreach (@$domainset)
 	}
 
 	undef $repuri;
+	$poldomain=$domain;
 
 	while ($dbi_a = $dbi_s->fetchrow_arrayref())
 	{
@@ -488,6 +490,10 @@ foreach (@$domainset)
 		{
 			$lastsent = $dbi_a->[6];
 		}
+		if (defined($dbi_a->[7]))
+		{
+			$poldomain = $dbi_a->[7];
+		}
 	}
 
 	$dbi_s->finish;