From f44c78e413732416ff953f6c332a3770821cc7a6 Mon Sep 17 00:00:00 2001 From: Wolfgang Karall-Ahlborn Date: Sun, 7 Mar 2021 17:58:54 +0100 Subject: Avoid fatal error when there's no 'auth_results' in the XML Reports seen in the wild sometime lack actual 'auth_results' in the XML which leads to Can't use string ("") as a HASH ref while "strict refs" in use --- dmarcts-report-parser.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dmarcts-report-parser.pl b/dmarcts-report-parser.pl index 2de3b04..5c3c9eb 100755 --- a/dmarcts-report-parser.pl +++ b/dmarcts-report-parser.pl @@ -813,6 +813,10 @@ sub storeXMLInDatabase { my $identifier_hfrom = $r{'identifiers'}->{'header_from'}; my ($dkim, $dkimresult, $spf, $spfresult, $reason); + if(ref $r{'auth_results'} ne "HASH"){ + print "Report has no auth_results data. Skipped.\n"; + return 0; + } my $rp = $r{'auth_results'}->{'dkim'}; if(ref $rp eq "HASH") { $dkim = $rp->{'domain'}; -- cgit v1.2.3