Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/DKIM.pm
Criterion Covered Total %
branch 22 336 6.5


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 310 unless (defined $value and not $value =~ /^$/)
466 0 310 unless ($value =~ /^ \@? ( [*a-z0-9._-]+ ) (?: \s+ (nxdomain|unknown|all|discardable| custom_low|custom_med|custom_high) )?$/xi)
473 62 248 unless defined $adsp
475 0 310 if ($adsp eq 'custom_low') { }
0 310 elsif ($adsp eq 'custom_med') { }
0 310 elsif ($adsp eq 'custom_high') { }
521 0 77 unless $pms->{'dkim_checked_signature'}
523 77 0 if (not $pms->{'dkim_signed'}) { }
0 0 elsif (not @acceptable_domains) { }
535 0 77 unless $pms->{'dkim_checked_signature'}
537 77 0 if (not $pms->{'dkim_valid'}) { }
0 0 elsif (not @acceptable_domains) { }
550 0 77 unless $pms->{'dkim_checked_signature'}
552 77 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 77 385 unless $pms->{'dkim_checked_signature'}
591 462 0 if (not $pms->{'dkim_signatures_ready'}) { }
594 0 0 unless $pms->{'dkim_checked_adsp'}
598 0 0 if $adsp_char eq '*'
600 0 0 if (not grep({index($adsp_char, $_) >= 0;} values %{$$pms{'dkim_adsp'};})) { }
0 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 0 0 unless ($self->{'tried_loading'})
676 0 0 unless (eval { do { { require Mail::DKIM::Verifier; } } })
677 0 0 $@ ne '' ? :
681 0 0 if (defined $eval_stat) { }
686 0 0 if ($version >= 0.31) { }
696 0 0 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 38 0 if /\@([^\@]+?)[ \t]*\z/s
786 77 0 unless $pms->{'dkim_author_addresses'}
789 0 33 if (defined $suppl_attrib and exists $suppl_attrib->{'dkim_signatures'})
792 0 0 if ref $provided_signatures
799 0 77 if ($pms->{'dkim_signatures_ready'}) { }
77 0 elsif (not $pms->is_dns_available) { }
0 0 elsif (not $self->_dkim_load_modules) { }
809 0 0 if ('Mail::DKIM::Verifier'->VERSION >= 0.4)
811 0 0 if ($edns and $edns >= 1024)
822 0 0 unless ($verifier)
838 0 0 unless (eval { do { my $str = $pms->{'msg'}->get_pristine; $str =~ s/\r?\n/\r\n/gs; $verifier->PRINT($str); 1 } })
839 0 0 $@ ne '' ? :
858 0 0 $verifier->UNIVERSAL::can('signatures') ? :
861 0 0 if ($timer->timed_out) { }
0 0 elsif ($err) { }
872 0 0 unless (@signatures and $pms->{'tests_already_hit'}{'__TRUNCATED'})
877 0 77 if ($pms->{'dkim_signatures_ready'})
882 0 0 unless defined $signature
886 0 0 $sig_result_supported ? :
888 0 0 $valid ? :
889 0 0 if ($valid and $signature->UNIVERSAL::can('check_expiration'))
891 0 0 if $expired
894 0 0 if ($valid and not $expired and $minimum_key_bits)
896 0 0 if $pk and $pk->cork
897 0 0 if ($key_size)
899 0 0 if $key_size < $minimum_key_bits
902 0 0 if $valid and not $expired
906 0 0 if (not defined $d) { }
910 0 0 if ($pms->{'dkim_author_domains'}{$d})
912 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) { }
922 0 0 if (would_log('dbg', 'dkim'))
931 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} ? :
937 0 0 if (@valid_signatures) { }
0 0 elsif (@signatures) { }
942 0 0 $sig_result_supported ? :
953 0 0 @identity_list == 1 ? :
955 0 0 @domain_list == 1 ? :
957 0 0 @selector_list == 1 ? :
962 0 0 $sig_result_supported && $sig ? :
981 0 0 unless $pms->{'dkim_author_addresses'}
992 0 0 unless $pms->{'dkim_checked_signature'}
994 0 0 if (not $pms->{'dkim_signatures_ready'}) { }
0 0 elsif (not @author_domains) { }
1006 0 0 if ($pms->{'dkim_has_valid_author_sig'}{$author_domain}) { }
0 0 elsif ($pms->{'dkim_author_sig_tempfailed'}{$author_domain}) { }
0 0 elsif ($pms->{'dkim_has_any_author_sig'}{$author_domain} and not $pms->{'dkim_signatures_dependable'}) { }
1043 0 0 if ($p)
1048 0 0 if (defined $adsp)
1052 0 0 if (defined $adsp) { }
0 0 elsif (not $pms->is_dns_available) { }
0 0 elsif (not $self->_dkim_load_modules) { }
1055 0 0 if $matched_key ne $author_domain
1074 0 0 if ('Mail::DKIM::AuthorDomainPolicy'->UNIVERSAL::can('fetch'))
1084 0 0 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 } })
1086 0 0 $@ ne '' ? :
1092 0 0 if ($timer->timed_out) { }
0 0 elsif ($err) { }
1101 0 0 if $practices
1102 0 0 if (not defined $sp or $sp eq '') { }
1107 0 0 uc $sp eq 'NXDOMAIN' ? :
0 0 $sp eq 'strict' ? :
0 0 $sp eq 'discardable' ? :
0 0 $sp eq 'all' ? :
0 0 $sp eq 'unknown' ? :
1120 0 0 if defined $adsp
1123 0 0 !defined($adsp) ? :
1134 0 0 unless $pms->{'dkim_author_addresses'}
1137 0 0 if ($authors_str eq '')
1152 0 0 unless (@acceptable_sdid_tuples)
1162 0 0 unless $self->check_dkim_valid($pms) or would_log('dbg', 'dkim')
1163 0 0 unless $pms->{'dkim_signatures_ready'}
1172 0 0 if (defined $match)
1173 0 0 if $match
1174 0 0 $match ? :
1177 0 0 if (@valid) { }
0 0 elsif (@fail) { }
1200 0 0 if ($author =~ /$re/)
1220 0 0 if ($author =~ /$re/)
1238 0 0 unless defined $signature
1242 0 0 $sig_result_supported ? :
1244 0 0 $valid ? :
1245 0 0 if ($valid and $signature->UNIVERSAL::can('check_expiration'))
1247 0 0 if $expired
1249 0 0 if ($valid and not $expired and $minimum_key_bits)
1251 0 0 if ($key_size and $key_size < $minimum_key_bits)
1257 0 0 if defined $sdid
1269 0 0 !($author =~ /\@([^\@]+)\z/s) ? :
1273 0 0 if (not defined $sdid) { }
0 0 elsif (not defined $acceptable_sdid or $acceptable_sdid eq '') { }
1284 0 0 if $sdid eq $author_domain
1292 0 0 if $acceptable_sdid =~ /\@([^\@]*)\z/s
1293 0 0 if ($acceptable_sdid =~ s/^\*?\.//s) { }
1294 0 0 if $sdid =~ /\.\Q$acceptable_sdid\E\z/is
1296 0 0 if $sdid eq lc $acceptable_sdid
1299 0 0 if ($matches)
1300 0 0 if (would_log('dbg', 'dkim'))
1301 0 0 if ($sdid eq $author_domain) { }
1311 0 0 unless exists $any_match_by_wl{$wl}
1314 0 0 if not $valid or $expired or $key_size_weak
1316 0 0 if ($matches)
1321 0 0 defined $sdid ? :
0 0 unless $any_match_at_all