Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/DKIM.pm
Criterion Covered Total %
branch 74 342 21.6


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 300 unless (defined $value and not $value =~ /^$/)
466 0 300 unless ($value =~ /^ \@? ( [*a-z0-9._-]+ ) (?: \s+ (nxdomain|unknown|all|discardable| custom_low|custom_med|custom_high) )?$/xi)
473 60 240 unless defined $adsp
475 0 300 if ($adsp eq 'custom_low') { }
0 300 elsif ($adsp eq 'custom_med') { }
0 300 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 { do { { require Mail::DKIM::Verifier; } } })
677 0 0 $@ ne '' ? :
681 0 1 if (defined $eval_stat) { }
686 1 0 if ($version >= 0.31) { }
696 0 1 unless ($adsp_avail)
713 0 0 unless defined $sig
714 0 0 if ($must_be_valid)
715 0 0 $sig->UNIVERSAL::can('result') ? :
0 0 if ($sig->UNIVERSAL::can('result') ? $sig : $verifier)->result ne 'pass'
717 0 0 if $sig->UNIVERSAL::can('check_expiration') and not $sig->check_expiration
720 0 0 if $minimum_key_bits and $sig->{'_spamassassin_key_size'} and $sig->{'_spamassassin_key_size'} < $minimum_key_bits
723 0 0 unless defined $sdid
725 0 0 if ($must_be_author_domain_signature)
726 0 0 unless $pms->{'dkim_author_domains'}{$sdid}
728 0 0 if (not @$acceptable_domains_ref) { }
732 0 0 if ($ad =~ /^\*?\.(.*)\z/s) { }
734 0 0 if ($sdid eq $d or $sdid =~ /\.\Q$d\E\z/s)
736 0 0 if ($sdid eq lc $ad)
740 0 0 if $result
757 42 0 if /\@([^\@]+?)[ \t]*\z/s
786 81 0 unless $pms->{'dkim_author_addresses'}
789 0 34 if (defined $suppl_attrib and exists $suppl_attrib->{'dkim_signatures'})
792 0 0 if ref $provided_signatures
799 0 81 if ($pms->{'dkim_signatures_ready'}) { }
77 4 elsif (not $pms->is_dns_available) { }
0 4 elsif (not $self->_dkim_load_modules) { }
809 4 0 if ('Mail::DKIM::Verifier'->VERSION >= 0.4)
811 4 0 if ($edns and $edns >= 1024)
822 0 4 unless ($verifier)
834 0 4 if ($pms->{'msg'}{'line_ending'} eq "\r\n") { }
845 0 4 unless (eval { do { my $str = $pms->{'msg'}->get_pristine; if ($pms->{'msg'}{'line_ending'} eq "\r\n") { $verifier->PRINT($str); } else { my $str2 = $str; $str2 =~ s/\012/\r\n/gs; $verifier->PRINT($str2); undef $str2; } ; 1 } })
846 0 0 $@ ne '' ? :
865 4 0 $verifier->UNIVERSAL::can('signatures') ? :
868 0 4 if ($timer->timed_out) { }
0 4 elsif ($err) { }
879 4 0 unless (@signatures and $pms->{'tests_already_hit'}{'__TRUNCATED'})
884 4 77 if ($pms->{'dkim_signatures_ready'})
889 0 0 unless defined $signature
890 0 0 unless $signature->selector
894 0 0 $sig_result_supported ? :
896 0 0 $valid ? :
897 0 0 if ($valid and $signature->UNIVERSAL::can('check_expiration'))
899 0 0 if $expired
902 0 0 if ($valid and not $expired and $minimum_key_bits)
904 0 0 if $pk and $pk->cork
905 0 0 if ($key_size)
907 0 0 if $key_size < $minimum_key_bits
910 0 0 if $valid and not $expired
914 0 0 if (not defined $d) { }
918 0 0 if ($pms->{'dkim_author_domains'}{$d})
920 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) { }
930 0 0 if (would_log('dbg', 'dkim'))
939 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} ? :
945 0 4 if (@valid_signatures) { }
0 4 elsif (@signatures) { }
950 0 0 $sig_result_supported ? :
961 0 0 @identity_list == 1 ? :
963 0 0 @domain_list == 1 ? :
965 0 0 @selector_list == 1 ? :
970 0 0 $sig_result_supported && $sig ? :
989 0 4 unless $pms->{'dkim_author_addresses'}
1000 0 4 unless $pms->{'dkim_checked_signature'}
1002 0 4 if (not $pms->{'dkim_signatures_ready'}) { }
0 4 elsif (not @author_domains) { }
1014 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'}) { }
1051 4 0 if ($p)
1056 0 14 if (defined $adsp)
1060 0 4 if (defined $adsp) { }
0 4 elsif (not $pms->is_dns_available) { }
0 4 elsif (not $self->_dkim_load_modules) { }
1063 0 0 if $matched_key ne $author_domain
1082 4 0 if ('Mail::DKIM::AuthorDomainPolicy'->UNIVERSAL::can('fetch'))
1092 0 4 unless (eval { do { if ('Mail::DKIM::AuthorDomainPolicy'->UNIVERSAL::can('fetch')) { dbg('dkim: adsp: performing lookup on _adsp._domainkey.%s', $author_domain); my $res = $self->{'main'}{'resolver'}->get_resolver; $practices = 'Mail::DKIM::AuthorDomainPolicy'->fetch('Protocol', 'dns', 'Domain', $author_domain, 'DnsResolver', $res); } ; 1 } })
1094 0 0 $@ ne '' ? :
1100 0 4 if ($timer->timed_out) { }
0 4 elsif ($err) { }
1109 4 0 if $practices
1110 0 4 if (not defined $sp or $sp eq '') { }
1115 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' ? :
1128 4 0 if defined $adsp
1131 0 4 !defined($adsp) ? :
1142 0 0 unless $pms->{'dkim_author_addresses'}
1145 0 0 if ($authors_str eq '')
1160 0 0 unless (@acceptable_sdid_tuples)
1170 0 0 unless $self->check_dkim_valid($pms) or would_log('dbg', 'dkim')
1171 0 0 unless $pms->{'dkim_signatures_ready'}
1180 0 0 if (defined $match)
1181 0 0 if $match
1182 0 0 $match ? :
1185 0 0 if (@valid) { }
0 0 elsif (@fail) { }
1208 0 0 if ($author =~ /$re/)
1228 0 0 if ($author =~ /$re/)
1246 0 0 unless defined $signature
1247 0 0 unless $signature->selector
1251 0 0 $sig_result_supported ? :
1253 0 0 $valid ? :
1254 0 0 if ($valid and $signature->UNIVERSAL::can('check_expiration'))
1256 0 0 if $expired
1258 0 0 if ($valid and not $expired and $minimum_key_bits)
1260 0 0 if ($key_size and $key_size < $minimum_key_bits)
1266 0 0 if defined $sdid
1278 0 0 !($author =~ /\@([^\@]+)\z/s) ? :
1282 0 0 if (not defined $sdid) { }
0 0 elsif (not defined $acceptable_sdid or $acceptable_sdid eq '') { }
1293 0 0 if $sdid eq $author_domain
1301 0 0 if $acceptable_sdid =~ /\@([^\@]*)\z/s
1302 0 0 if ($acceptable_sdid =~ s/^\*?\.//s) { }
1303 0 0 if $sdid =~ /\.\Q$acceptable_sdid\E\z/is
1305 0 0 if $sdid eq lc $acceptable_sdid
1308 0 0 if ($matches)
1309 0 0 if (would_log('dbg', 'dkim'))
1310 0 0 if ($sdid eq $author_domain) { }
1320 0 0 unless exists $any_match_by_wl{$wl}
1323 0 0 if not $valid or $expired or $key_size_weak
1325 0 0 if ($matches)
1330 0 0 defined $sdid ? :
0 0 unless $any_match_at_all