| line |
true |
false |
branch |
|
41
|
2 |
0 |
if @_ == 1 |
|
44
|
0 |
0 |
if ($_[$i] eq 'DebugFunc' or $_[$i] eq 'Debug') |
|
50
|
0 |
0 |
if @_ > 1 |
|
83
|
0 |
7 |
if ($args{'spf_result'}) { } |
|
|
4 |
3 |
elsif ($args{'ip'} and $args{'mailfrom'} and $args{'helo'}) { } |
|
|
0 |
3 |
elsif (exists $args{'spf_result'}) { } |
|
96
|
0 |
7 |
if ($args{'dkim_result'}) { } |
|
|
2 |
5 |
elsif ($args{'dkim_sub'}) { } |
|
127
|
0 |
60 |
if $self->{'result'} |
|
128
|
34 |
26 |
unless @input |
|
135
|
12 |
14 |
unless (ref $data) |
|
136
|
0 |
12 |
if $Mail::DMARC::Iterator::DEBUG |
|
137
|
8 |
4 |
if (not $self->{'domain'} and defined $self->{'_hdrbuf'}) |
|
141
|
10 |
2 |
if ($self->{'dkim'}) |
|
152
|
0 |
14 |
if (not UNIVERSAL::isa($data, 'Net::DNS::Packet')) { } |
|
155
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
158
|
0 |
14 |
if $Mail::DMARC::Iterator::DEBUG |
|
165
|
0 |
14 |
unless ($cb) |
|
168
|
0 |
0 |
unless defined $cb |
|
174
|
0 |
14 |
if $self->{'dnscache'} |
|
182
|
0 |
35 |
if $self->{'result'} |
|
183
|
8 |
27 |
unless $self->{'domain'} |
|
189
|
7 |
20 |
unless my $rec = $self->{'record'} |
|
192
|
2 |
18 |
if ($self->{'dkim_sub'} and my $r = $self->{'dkim_result'}[0] = $self->{'dkim_sub'}->()) |
|
194
|
2 |
0 |
if $self->{'domrx'} |
|
196
|
20 |
0 |
if ($self->{'dkim_result'}) |
|
197
|
4 |
16 |
if ($self->{'dkim'} and not $self->{'dkim_result'}[1]) |
|
199
|
0 |
4 |
unless $self->{'dkim_result'}[0] |
|
200
|
0 |
4 |
if $Mail::DMARC::Iterator::DEBUG |
|
203
|
1 |
19 |
unless $self->{'dkim_result'}[0] |
|
204
|
0 |
19 |
if $Mail::DMARC::Iterator::DEBUG |
|
207
|
6 |
0 |
if ($st == 1) { } |
|
|
0 |
0 |
elsif ($st == -2 or $st == -1) { } |
|
|
0 |
0 |
elsif ($st == 0) { } |
|
225
|
0 |
14 |
unless my $sr = $self->{'spf_result'} |
|
226
|
9 |
5 |
unless defined $sr->[0] |
|
232
|
0 |
5 |
$rec->{'aspf'} eq 's' ? : |
|
|
1 |
4 |
if ($rec->{'aspf'} eq 's' ? lc $from ne $rec->{'domain'} : !($from =~ /^([\w\-\.]+\.)?\Q$rec->{'domain'}\E/i)) |
|
236
|
0 |
1 |
if $Mail::DMARC::Iterator::DEBUG |
|
244
|
0 |
4 |
if $Mail::DMARC::Iterator::DEBUG |
|
246
|
1 |
3 |
if ($sr->[0] eq 'Pass') |
|
253
|
0 |
0 |
$sr->[0] eq 'TempError' ? : |
|
|
0 |
0 |
$sr->[0] eq 'PermError' ? : |
|
|
0 |
0 |
$sr->[0] eq 'SoftFail' ? : |
|
|
3 |
0 |
$sr->[0] eq 'Fail' ? : |
|
260
|
1 |
0 |
if ($dkim_result || !$self->{'dkim'} and $spf_result || !$self->{'spf'}) |
|
267
|
0 |
0 |
$dkim_result ? : |
|
|
0 |
0 |
$spf_result ? : |
|
|
0 |
1 |
if $Mail::DMARC::Iterator::DEBUG |
|
271
|
2 |
0 |
unless defined $_->[0] |
|
272
|
0 |
0 |
if (not $best) { } |
|
|
0 |
0 |
elsif ($_->[0] and $_->[0] > $best->[0]) { } |
|
278
|
1 |
0 |
if ($self->{'dkim_sub'} and !$best || $best->[0] != 1 and !$self->{'dkim_result'}[0] || grep({not $_->status;} @{$$self{'dkim_result'}[0];})) |
|
283
|
0 |
1 |
if $Mail::DMARC::Iterator::DEBUG |
|
296
|
8 |
19 |
if (not $self->{'domain'}) { } |
|
|
7 |
12 |
elsif (my $dom = $self->{'_dmarc_domain'}) { } |
|
298
|
0 |
8 |
if $Mail::DMARC::Iterator::DEBUG |
|
302
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
312
|
15 |
12 |
unless $self->{'record'} |
|
314
|
12 |
0 |
if ($self->{'dkim'}) |
|
318
|
0 |
12 |
if (not $self->{'dkim_result'}[1]) { } |
|
320
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
328
|
12 |
8 |
if (ref $todo) { } |
|
329
|
0 |
12 |
if $Mail::DMARC::Iterator::DEBUG |
|
332
|
0 |
8 |
if $Mail::DMARC::Iterator::DEBUG |
|
344
|
6 |
6 |
if ($self->{'spf'}) { } |
|
|
0 |
6 |
elsif (not $self->{'spf_result'}) { } |
|
348
|
1 |
5 |
if ($self->{'spf_result'}[0]) { } |
|
351
|
0 |
1 |
if $Mail::DMARC::Iterator::DEBUG |
|
361
|
0 |
5 |
if $Mail::DMARC::Iterator::DEBUG |
|
368
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
375
|
19 |
7 |
if $need_data |
|
382
|
0 |
19 |
if ($self->{'dnscache'} and my $cached = $self->{'dnscache'}{$q->qtype . ':' . $q->qname}) { } |
|
385
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
391
|
0 |
19 |
if $Mail::DMARC::Iterator::DEBUG |
|
395
|
0 |
26 |
if @input |
|
397
|
0 |
26 |
if ($Mail::DMARC::Iterator::DEBUG) |
|
399
|
0 |
0 |
if (not ref $_) { } |
|
411
|
0 |
7 |
unless $self->{'result'} |
|
412
|
7 |
0 |
unless (defined $self->{'result'}[2]) |
|
413
|
0 |
7 |
if ($self->{'result'}[0] == 0) { } |
|
414
|
0 |
0 |
if ($rec->{'sp'} and $rec->{'domain'} ne $self->{'domain'}[0]) { } |
|
423
|
0 |
7 |
if ($Mail::DMARC::Iterator::DEBUG) |
|
429
|
0 |
0 |
unless $self->{'result'} |
|
447
|
0 |
7 |
if $error |
|
456
|
0 |
7 |
unless $_->type eq 'TXT' |
|
459
|
0 |
7 |
unless $txt =~ /^\s*v=DMARC1[\s;]/ |
|
460
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
461
|
0 |
7 |
unless my $v = parse_taglist($txt, \$error) |
|
462
|
0 |
7 |
unless $v = _check_dmarc_record($v) |
|
466
|
0 |
7 |
unless @record |
|
472
|
0 |
7 |
if ($record[0]{'pct'} < 100 and rand 100 < $record[0]{'pct'}) |
|
474
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
483
|
0 |
7 |
if (@{$self->{'domain'};} > 1 and $dom ne $self->{'domain'}[0]) |
|
488
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
492
|
7 |
0 |
if ($record[0]{'adkim'} eq 'r') { } |
|
500
|
5 |
2 |
if ($self->{'dkim'}) { } |
|
|
2 |
0 |
elsif ($self->{'dkim_result'}) { } |
|
511
|
0 |
7 |
if ($self->{'spf_result'} and ref $self->{'spf_result'}[0] eq 'ARRAY') |
|
514
|
0 |
0 |
$record[0]{'aspf'} eq 'r' ? : |
|
|
0 |
0 |
$record[0]{'aspf'} eq $record[0]{'adkim'} ? : |
|
519
|
0 |
0 |
unless my $from = $_->[1]{'envelope-from'} |
|
522
|
0 |
0 |
unless $from =~ /$domrx/ |
|
525
|
0 |
0 |
if (@aligned > 1) { } |
|
|
0 |
0 |
elsif (@aligned) { } |
|
528
|
0 |
0 |
unless my(@a) = grep({$_->[0] eq $_;} @aligned) |
|
532
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
535
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
537
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
539
|
0 |
0 |
!@aligned ? : |
|
547
|
0 |
0 |
@$dom > 1 ? : |
|
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
554
|
0 |
0 |
if (@$dom) { } |
|
562
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
564
|
0 |
0 |
$error ? : |
|
589
|
21 |
56 |
if (defined $v->{$k}) { } |
|
|
42 |
14 |
elsif (defined $default) { } |
|
590
|
0 |
21 |
unless ($v->{$k} =~ /$rx/) |
|
591
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
596
|
0 |
42 |
if (ref $default) |
|
597
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
608
|
0 |
4 |
if ($error) { } |
|
609
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
612
|
4 |
0 |
$_->type eq 'TXT' ? : |
|
613
|
0 |
4 |
if $Mail::DMARC::Iterator::DEBUG |
|
620
|
0 |
3 |
if ($error) { } |
|
626
|
3 |
0 |
if (not defined $rv[0] or $rv[0] ne '') { } |
|
644
|
0 |
8 |
if $data eq '' |
|
659
|
7 |
24 |
if ($2) |
|
661
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
668
|
0 |
8 |
if @hdr and defined $self->{'_hdrbuf'} |
|
676
|
31 |
0 |
$self->{'spf'} || $self->{'spf_result'} ? : |
|
|
24 |
7 |
unless $self->{'spf'} || $self->{'spf_result'} ? s/^(From)\s*:\s*//i : s/^(?:(From)\s*|Received-SPF):\s*//i |
|
679
|
7 |
0 |
if ($1) { } |
|
681
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
685
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
691
|
1 |
7 |
if (defined $self->{'_hdrbuf'}) |
|
692
|
1 |
0 |
if $data ne '' |
|
698
|
7 |
0 |
unless ($self->{'domain'}) |
|
700
|
0 |
7 |
if (not $from) { } |
|
|
0 |
7 |
elsif (@$from != 1) { } |
|
701
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
705
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
711
|
7 |
0 |
if (my $dom = organizational_domain($from->[0])) |
|
712
|
0 |
7 |
if $dom ne $from->[0] |
|
716
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
720
|
0 |
7 |
if (not $self->{'spf_result'} || $self->{'spf'}) |
|
722
|
0 |
0 |
unless delete $self->{'_spfr'} |
|
723
|
0 |
0 |
unless my($result, $hash) = _parse_spfreceived($_) |
|
724
|
0 |
0 |
unless (my $from = $hash->{'envelope-from'}) |
|
725
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
730
|
0 |
0 |
unless @dom == 1 |
|
732
|
0 |
0 |
if $Mail::DMARC::Iterator::DEBUG |
|
735
|
0 |
0 |
@records ? : |
|
747
|
14 |
0 |
if (not @state) { } |
|
|
0 |
0 |
elsif ($state[-1] eq '<') { } |
|
|
0 |
0 |
elsif ($state[-1] eq '"') { } |
|
|
0 |
0 |
elsif ($state[-1] eq '(') { } |
|
748
|
0 |
14 |
unless /\G ([^<,\"\(]*) (?: ([<\(\"]) | (,) | \z) /cgx |
|
749
|
0 |
14 |
if ($2) { } |
|
|
7 |
7 |
elsif ($1 ne '') { } |
|
|
7 |
0 |
elsif (not $3) { } |
|
752
|
7 |
0 |
if (my $x = $1) =~ /^\s*$addr\s*\z/ |
|
758
|
0 |
0 |
unless /\G(?: $addr | (?:[^>]*) ) > /cgx |
|
760
|
0 |
0 |
if $1 |
|
763
|
0 |
0 |
unless /\G (?:[^"\\]+|\\.)* \"/cgx |
|
767
|
0 |
0 |
unless /\G .*? ([()]) /cgsx |
|
768
|
0 |
0 |
if ($1 eq ')') { } |
|
775
|
0 |
7 |
if $Mail::DMARC::Iterator::DEBUG |
|
796
|
0 |
0 |
unless /\G($res)\s+/cig |
|
801
|
0 |
0 |
if ($comment) { } |
|
|
0 |
0 |
elsif (/\G($key)$fws?=$fws?($val)\s*(;\s*)?/cg) { } |
|
|
0 |
0 |
elsif (not %hash || defined $comment and /\G\(/cg) { } |
|
802
|
0 |
0 |
unless /\G[^()]*([()])\s*/cg |
|
803
|
0 |
0 |
$1 eq '(' ? : |
|
806
|
0 |
0 |
if $v =~ s/\A\"(.*)\"\z/$1/ |
|
808
|
0 |
0 |
unless $delim |