diff options
Diffstat (limited to 'dmarcts-report-parser.pl')
-rwxr-xr-x | dmarcts-report-parser.pl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/dmarcts-report-parser.pl b/dmarcts-report-parser.pl index 6b473fc..54749d5 100755 --- a/dmarcts-report-parser.pl +++ b/dmarcts-report-parser.pl @@ -797,6 +797,12 @@ sub storeXMLInDatabase { $policy_pct = $xml->{'policy_published'}[0]->{'pct'}; } + my $record = $xml->{'record'}; + if ( ! defined($record) ) { + warn "$scriptname: $org: $id: No records in report. Skipped.\n"; + return 0; + } + # begin transaction if ($db_tx_support) { $dbh->do(qq{START TRANSACTION}); @@ -858,13 +864,15 @@ sub storeXMLInDatabase { if ($debug){ print " serial $serial \n"; } - my $record = $xml->{'record'}; sub dorow($$$$) { my ($serial,$recp,$org,$id) = @_; my %r = %$recp; my $ip = $r{'row'}->{'source_ip'}; - #print "ip $ip\n"; + if ( $ip eq '' ) { + warn "$scriptname: $org: $id: source_ip is empty. Skipped.\n"; + return 0; + } my $count = $r{'row'}->{'count'}; my $disp = $r{'row'}->{'policy_evaluated'}->{'disposition'}; if ( ! grep { $_ eq $disp } ALLOWED_DISPOSITION ) { @@ -982,7 +990,7 @@ sub storeXMLInDatabase { $iptype = "ip6"; } else { warn "$scriptname: $org: $id: ??? mystery ip $ip\n"; - next; # of dorow + return 0; } $dbh->do(qq{INSERT INTO rptrecord(serial,$iptype,rcount,disposition,spf_align,dkim_align,reason,dkimdomain,dkimresult,spfdomain,spfresult,identifier_hfrom) |