Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/DKIM.pm
Criterion Covered Total %
branch 73 340 21.4


line true false branch
401 0 0 unless (defined $value and not $value =~ /^$/)
404 0 0 unless ($value =~ /^(\S+)(?:\s+(\S+))?$/)
408 0 0 defined $2 ? :
421 0 0 unless (defined $value and not $value =~ /^$/)
424 0 0 unless ($value =~ /^(\S+)(?:\s+(\S+))?$/)
428 0 0 defined $2 ? :
441 0 0 unless (defined $value and not $value =~ /^$/)
444 0 0 unless ($value =~ /^(\S+)(?:\s+(\S+))?$/)
448 0 0 defined $2 ? :
463 0 305 unless (defined $value and not $value =~ /^$/)
466 0 305 unless ($value =~ /^ \@? ( [*a-z0-9._-]+ )
473 61 244 unless defined $adsp
475 0 305 if ($adsp eq 'custom_low') { }
0 305 elsif ($adsp eq 'custom_med') { }
0 305 elsif ($adsp eq 'custom_high') { }
521 0 81 unless $pms->{'dkim_checked_signature'}
523 81 0 if (not $pms->{'dkim_signed'}) { }
0 0 elsif (not @acceptable_domains) { }
535 0 81 unless $pms->{'dkim_checked_signature'}
537 81 0 if (not $pms->{'dkim_valid'}) { }
0 0 elsif (not @acceptable_domains) { }
550 0 81 unless $pms->{'dkim_checked_signature'}
552 81 0 if (not %{$pms->{'dkim_has_valid_author_sig'};}) { }
565 0 0 unless $envfrom
566 0 0 unless $pms->{'dkim_checked_signature'}
567 0 0 if (not $pms->{'dkim_valid'}) { }
577 0 0 unless $pms->{'dkim_checked_signature'}
589 81 405 unless $pms->{'dkim_checked_signature'}
591 462 24 if (not $pms->{'dkim_signatures_ready'}) { }
594 4 20 unless $pms->{'dkim_checked_adsp'}
598 0 24 if $adsp_char eq "*"
600 20 4 if (not grep({index($adsp_char, $_) >= 0;} values %{$$pms{'dkim_adsp'};})) { }
4 0 elsif (not @domains_list) { }
608 0 0 if ($dom =~ /^\*?\.(.*)\z/s) { }
610 0 0 if ($author_domains{$doms} or grep {/\.\Q$doms\E\z/s;} keys %author_domains)
615 0 0 if ($author_domains{lc $dom})
644 0 0 unless $pms->{'dkim_checked_signature'}
645 0 0 if $pms->{'dkim_key_testing'}
651 0 0 unless $pms->{'whitelist_checked'}
658 0 0 unless $pms->{'whitelist_checked'}
668 1 7 unless ($self->{'tried_loading'})
676 0 1 unless (eval {
677 0 0 $@ ne '' ? :
681 0 1 if (defined $eval_stat) { }
687 1 0 if ('version'->parse($version) >= 'version'->parse(0.31)) { }
697 0 1 unless ($adsp_avail)
714 0 0 unless defined $sig
715 0 0 if ($must_be_valid)
716 0 0 $sig->UNIVERSAL::can('result') ? :
0 0 if ($sig->UNIVERSAL::can("result") ? $sig : $verifier)->result ne "pass"
718 0 0 if $sig->UNIVERSAL::can("check_expiration") and not $sig->check_expiration
721 0 0 if $minimum_key_bits and $sig->{'_spamassassin_key_size'} and $sig->{'_spamassassin_key_size'} < $minimum_key_bits
724 0 0 unless defined $sdid
726 0 0 if ($must_be_author_domain_signature)
727 0 0 unless $pms->{'dkim_author_domains'}{$sdid}
729 0 0 if (not @$acceptable_domains_ref) { }
733 0 0 if ($ad =~ /^\*?\.(.*)\z/s) { }
735 0 0 if ($sdid eq $d or $sdid =~ /\.\Q$d\E\z/s)
737 0 0 if ($sdid eq lc $ad)
741 0 0 if $result
758 42 0 if /\@([^\@]+?)[ \t]*\z/s
787 81 0 unless $pms->{'dkim_author_addresses'}
790 0 81 if (defined $suppl_attrib and exists $suppl_attrib->{'dkim_signatures'})
793 0 0 if ref $provided_signatures
800 0 81 if ($pms->{'dkim_signatures_ready'}) { }
77 4 elsif (not $pms->is_dns_available) { }
0 4 elsif (not $self->_dkim_load_modules) { }
811 4 0 if ("version"->parse("Mail::DKIM::Verifier"->VERSION) >= "version"->parse("0.4"))
813 4 0 if ($edns and $edns >= 1024)
824 0 4 unless ($verifier)
839 0 4 unless (eval {
840 0 0 $@ ne '' ? :
859 4 0 $verifier->UNIVERSAL::can('signatures') ? :
862 0 4 if ($timer->timed_out) { }
0 4 elsif ($err) { }
873 4 0 unless (@signatures and $pms->{'tests_already_hit'}{'__TRUNCATED'})
878 4 77 if ($pms->{'dkim_signatures_ready'})
883 0 0 unless defined $signature
884 0 0 unless $signature->selector
888 0 0 $sig_result_supported ? :
890 0 0 $valid ? :
891 0 0 if ($valid and $signature->UNIVERSAL::can("check_expiration"))
893 0 0 if $expired
896 0 0 if ($valid and not $expired and $minimum_key_bits)
898 0 0 if $pk and $pk->cork
899 0 0 if ($key_size)
901 0 0 if $key_size < $minimum_key_bits
904 0 0 if $valid and not $expired
908 0 0 if (not defined $d) { }
912 0 0 if ($pms->{'dkim_author_domains'}{$d})
914 0 0 $sig_result_supported ? :
0 0 if ($valid and not $expired and $key_size and $key_size >= $minimum_key_bits) { }
0 0 elsif (($sig_result_supported ? $signature : $verifier)->result_detail =~ /\b(?:timed out|SERVFAIL)\b/i) { }
924 0 0 if (would_log("dbg", "dkim"))
933 0 0 $signature->isa('Mail::DKIM::DkSignature') ? :
0 0 !defined($_) ? :
0 0 $key_size ? :
0 0 $sig_result_supported ? :
0 0 defined $d && $pms->{'dkim_author_domains'}{$d} ? :
939 0 4 if (@valid_signatures) { }
0 4 elsif (@signatures) { }
944 0 0 $sig_result_supported ? :
955 0 0 @identity_list == 1 ? :
957 0 0 @domain_list == 1 ? :
959 0 0 @selector_list == 1 ? :
964 0 0 $sig_result_supported && $sig ? :
983 0 4 unless $pms->{'dkim_author_addresses'}
994 0 4 unless $pms->{'dkim_checked_signature'}
996 0 4 if (not $pms->{'dkim_signatures_ready'}) { }
0 4 elsif (not @author_domains) { }
1008 0 4 if ($pms->{'dkim_has_valid_author_sig'}{$author_domain}) { }
0 4 elsif ($pms->{'dkim_author_sig_tempfailed'}{$author_domain}) { }
0 4 elsif ($pms->{'dkim_has_any_author_sig'}{$author_domain} and not $pms->{'dkim_signatures_dependable'}) { }
1045 4 0 if ($p)
1050 0 14 if (defined $adsp)
1054 0 4 if (defined $adsp) { }
0 4 elsif (not $pms->is_dns_available) { }
0 4 elsif (not $self->_dkim_load_modules) { }
1057 0 0 if $matched_key ne $author_domain
1076 4 0 if ("Mail::DKIM::AuthorDomainPolicy"->UNIVERSAL::can("fetch"))
1086 0 4 unless (eval {
1088 0 0 $@ ne '' ? :
1094 0 4 if ($timer->timed_out) { }
0 4 elsif ($err) { }
1103 4 0 if $practices
1104 0 4 if (not defined $sp or $sp eq '') { }
1109 4 0 uc $sp eq 'NXDOMAIN' ? :
0 4 $sp eq 'strict' ? :
0 4 $sp eq 'discardable' ? :
0 4 $sp eq 'all' ? :
0 4 $sp eq 'unknown' ? :
1122 4 0 if defined $adsp
1125 0 4 !defined($adsp) ? :
1136 0 0 unless $pms->{'dkim_author_addresses'}
1139 0 0 if ($authors_str eq "")
1154 0 0 unless (@acceptable_sdid_tuples)
1164 0 0 unless $self->check_dkim_valid($pms) or would_log("dbg", "dkim")
1165 0 0 unless $pms->{'dkim_signatures_ready'}
1174 0 0 if (defined $match)
1175 0 0 if $match
1176 0 0 $match ? :
1179 0 0 if (@valid) { }
0 0 elsif (@fail) { }
1202 0 0 if ($author =~ /$re/)
1222 0 0 if ($author =~ /$re/)
1240 0 0 unless defined $signature
1241 0 0 unless $signature->selector
1245 0 0 $sig_result_supported ? :
1247 0 0 $valid ? :
1248 0 0 if ($valid and $signature->UNIVERSAL::can("check_expiration"))
1250 0 0 if $expired
1252 0 0 if ($valid and not $expired and $minimum_key_bits)
1254 0 0 if ($key_size and $key_size < $minimum_key_bits)
1260 0 0 if defined $sdid
1272 0 0 !($author =~ /\@([^\@]+)\z/s) ? :
1276 0 0 if (not defined $sdid) { }
0 0 elsif (not defined $acceptable_sdid or $acceptable_sdid eq '') { }
1287 0 0 if $sdid eq $author_domain
1295 0 0 if $acceptable_sdid =~ /\@([^\@]*)\z/s
1296 0 0 if ($acceptable_sdid =~ s/^\*?\.//s) { }
1297 0 0 if $sdid =~ /\.\Q$acceptable_sdid\E\z/is
1299 0 0 if $sdid eq lc $acceptable_sdid
1302 0 0 if ($matches)
1303 0 0 if (would_log("dbg", "dkim"))
1304 0 0 if ($sdid eq $author_domain) { }
1314 0 0 unless exists $any_match_by_wl{$wl}
1317 0 0 if not $valid or $expired or $key_size_weak
1319 0 0 if ($matches)
1324 0 0 defined $sdid ? :
0 0 unless $any_match_at_all