Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/techsneeze/dmarcts-report-parser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTechSneeze <dave@techsneeze.com>2021-04-03 19:17:45 +0300
committerGitHub <noreply@github.com>2021-04-03 19:17:45 +0300
commit38eaaf01db349bdfd3ee6b01357fe539efab5221 (patch)
tree3ab922aa5146f08e747385eecc67b12fb9bb1f0a
parentf5fc06ed4fd7bf6a7e43b1320f90876a94bc34d9 (diff)
parentb663dee14ae97dd1480936bb5a7df147f85064fd (diff)
Merge pull request #95 from wolfgangkarall/no_mystery
Reduce chances of getting a 'mystery' result
-rwxr-xr-xdmarcts-report-parser.pl14
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)