Branch Coverage

lib/Mail/DMARC/PurePerl.pm
Criterion Covered Total %
branch 143 208 68.7


line true false branch
34 0 15 unless my $from_dom = $self->get_from_dom
36 1 14 unless $self->exists_in_dns
38 1 13 unless $policy
48 0 13 if ($self->config->{'report_store'}{'auto_save'})
52 5 8 if $aligned
54 0 8 $self->is_subdomain && defined $policy->sp ? :
62 1 7 if (lc $effective_p eq "none")
66 0 7 if $self->is_whitelisted
71 6 1 unless (defined $policy->pct)
78 0 1 if (int rand 100 < $policy->pct)
88 1 0 $effective_p eq 'reject' ? :
98 5 0 if ($pol and $self->has_valid_reporting_uri($pol->rua))
102 0 5 $_->{'max_bytes'} > 0 ? :
115 0 11 unless my $from_dom = shift() || $self->header_from
116 0 11 if $self->verbose
121 1 10 if (0 == scalar @$matches)
129 0 10 if (scalar @$matches > 1)
131 0 0 if $self->verbose
136 0 10 unless ($at_dom)
138 0 10 unless eval { do { $policy = $self->policy($policy_str) } }
139 0 10 if ($@)
147 0 10 if (not $policy->p && $policy->is_valid_p($policy->p) or defined $policy->sp and not $policy->is_valid_p($policy->sp))
157 0 0 unless ($policy->rua and $self->has_valid_reporting_uri($policy->rua))
182 8 13 if ("pass" eq $self->result->spf or "pass" eq $self->result->dkim)
196 7 17 unless $self->get_dkim_pass_sigs
202 0 17 unless my $from_dom = $self->header_from
203 0 17 unless my $policy = $self->policy
216 4 15 if ($dkim_dom eq $from_dom)
224 8 7 if $policy->adkim and "s" eq lc $policy->adkim
227 0 7 if "pass" eq $self->result->dkim
231 2 5 if ($dkim_org eq $from_org)
237 6 11 if "pass" eq lc $self->result->dkim
245 0 21 unless ($spf_dom or $self->spf)
246 21 0 unless ($spf_dom)
247 29 0 if $_->{'result'}
248 0 21 if (scalar @passes == 0)
252 24 0 if $_->{'scope'}
253 0 21 unless ($ref)
254 0 0 if $_->{'scope'}
256 0 21 unless ($ref)
265 0 21 unless $spf_dom
267 0 21 unless my $from_dom = $self->header_from
269 5 16 if ($spf_dom eq $from_dom)
276 8 8 if ($self->policy->aspf and "s" eq lc $self->policy->aspf)
280 3 5 if ($self->get_organizational_domain($spf_dom) eq $self->get_organizational_domain($from_dom))
293 3 8 unless defined $s_ip
294 5 3 unless ($self->{'_whitelist'})
295 0 5 unless my $white_file = $self->config->{'smtp'}{'whitelist'}
296 0 5 unless -f $white_file and -r $white_file
298 20 10 if $line =~ /^#/
303 6 2 unless $self->{'_whitelist'}{$s_ip}
307 1 1 $comment && $comment =~ /\S/ ? :
322 0 18 unless $rua
326 13 3 unless ($self->external_report($uri_ref->{'uri'}))
331 2 1 if $ext
339 0 41 unless my $dkim_sigs = $self->dkim
341 0 41 if ("ARRAY" ne ref $dkim_sigs)
350 0 108 unless my $from_dom = shift() || $self->header_from
367 108 255 unless $labels[$i]
370 110 145 if ($self->is_public_suffix($tld))
375 2 106 if ($greatest == scalar @labels)
384 0 106 if $self->verbose
390 0 18 unless my $from_dom = shift() || $self->header_from
400 9 9 if ($from_dom ne $org_dom)
406 5 22 if $matched
407 10 12 if $self->has_dns_rr("MX", $_)
408 10 12 if $self->has_dns_rr("NS", $_)
409 6 6 if $self->has_dns_rr("A", $_)
410 1 11 if $self->has_dns_rr("AAAA", $_)
412 2 16 unless ($matched)
429 11 4 defined $org_dom ? :
431 0 15 unless my $query = $self->get_resolver->send("_dmarc.$zone", "TXT")
434 1 11 if $rr->type ne "TXT"
438 0 11 if "v=dmarc1" ne lc substr($rr->txtdata, 0, 8)
439 0 11 if $self->verbose
442 11 4 if (scalar @matches)
451 2 2 if (defined $org_dom)
452 1 1 if ($org_dom ne $zone)
462 15 10 if $self->header_from
464 0 10 unless (my $header = $self->header_from_raw)
480 0 10 unless ($from_dom)
492 0 20 unless my $dmarc_dom = $self->result->published->domain
495 17 3 if ("mailto" eq $uri->scheme)
498 13 4 if ($self->get_organizational_domain($dest_host) eq $self->get_organizational_domain($dmarc_dom))
502 0 13 if $self->verbose
505 0 4 if $self->verbose
508 3 4 if ("http" eq $uri->scheme)
509 2 1 if ($uri->host eq $dmarc_dom)
510 0 2 if $self->verbose
513 0 1 if $self->verbose
521 0 6 unless my $uri_ref = shift()
525 0 6 unless my $dmarc_dom = $self->result->published->domain
528 0 6 unless my $dest_email = $uri_ref->{'uri'}->path
537 0 6 unless (my $query = $self->get_resolver->send($dest, "TXT"))
538 0 0 if $self->verbose
546 0 5 if $rr->type ne "TXT"
548 0 5 if "v=dmarc1" ne lc substr($rr->txtdata, 0, 8)
552 5 0 $policy ? :
556 1 5 unless (scalar @matches)
557 0 1 if $self->verbose
564 5 0 if ref $_
566 0 3 unless my $recips_ref = $self->report->uri->parse($or->{'rua'})
567 3 0 if ((split(/@/, $recips_ref->[0]{'uri'}, 0))[-1] eq (split(/@/, $uri_ref->{'uri'}, 0))[-1])
571 0 3 if $self->verbose