Branch Coverage

blib/lib/Mail/Milter/Authentication/Handler.pm
Criterion Covered Total %
branch 280 398 70.3


line true false branch
54 0 5 unless (-e $basefile)
73 239 8629 unless defined $labels
74 1051 7817 unless defined $count
101 2 2 if ($ip->version == 4) { }
2 0 elsif ($ip->version == 6) { }
110 0 4 unless $lookup_ip
121 3 3 if ($packet)
123 3 0 if (lc $rr->type eq 'a')
143 0 7771 if $elapsed == 0
180 0 11070 unless defined $exception
181 10944 126 unless $exception
182 77 49 if ref $exception ne 'Mail::Milter::Authentication::Exception'
191 11021 24 unless $Type
192 24 0 if $Type eq 'Timeout'
201 0 123 unless exists $top_handler->{'timeout_at'}
214 3227 2926 if ($microseconds == 0) { }
229 0 61 if ($remaining < $microseconds) { }
247 0 61 if ($remaining < 1)
284 2891 360 if ($$config{$type . '_timeout'})
292 704 2547 if (my $overall_timeout = $top_handler->{'overall_timeout'})
296 0 704 if ($remaining < 1)
302 704 2547 if ($remaining)
303 669 35 if ($timeout) { }
304 488 181 if ($remaining < $timeout)
313 2926 325 if $effective
324 69 8022 unless exists $top_handler->{'timeout_at'}
325 8022 0 if $top_handler->{'timeout_at'} >= $self->get_microseconds
335 112 26 if (exists $config->{'ip_map'})
341 4 192 if ($is_overlap == $Mail::Milter::Authentication::Handler::IP_A_IN_B_OVERLAP or $is_overlap == $Mail::Milter::Authentication::Handler::IP_B_IN_A_OVERLAP or $is_overlap == $Mail::Milter::Authentication::Handler::IP_PARTIAL_OVERLAP or $is_overlap == $Mail::Milter::Authentication::Handler::IP_IDENTICAL)
349 2 14 if ($helo_host and exists $mapped_to->{'helo_map'} and exists $mapped_to->{'helo_map'}{$helo_host}) { }
375 8 61 if ($ip_remap)
398 215 0 if (my $timeout = $self->get_type_timeout('connect'))
409 1 327 if (my $error = $@)
421 1 214 if (my $error = $@)
422 1 0 if (my $type = $self->is_exception_type($error)) { }
440 69 0 unless ($self->{'helo_name'})
444 8 61 if ($ip_remap)
446 2 6 if ($self->{'ip_object'}->ip ne $ip_remap->{'ip'}->ip)
468 0 215 unless defined $helo_host
472 215 0 if (my $timeout = $self->get_type_timeout('command'))
477 215 0 if (not $self->{'seen_helo_name'}) { }
485 1 292 if (my $error = $@)
502 1 214 if (my $error = $@)
503 1 0 if (my $type = $self->is_exception_type($error)) { }
527 1 214 unless defined $env_from
531 215 0 if (my $timeout = $self->get_type_timeout('command'))
545 1 647 if (my $error = $@)
557 1 214 if (my $error = $@)
558 1 0 if (my $type = $self->is_exception_type($error)) { }
582 0 215 unless defined $env_to
586 215 0 if (my $timeout = $self->get_type_timeout('command'))
595 1 82 if (my $error = $@)
607 1 214 if (my $error = $@)
608 1 0 if (my $type = $self->is_exception_type($error)) { }
631 0 1251 unless defined $value
635 1251 0 if (my $timeout = $self->get_type_timeout('content'))
638 0 1251 if (my $error = $@)
647 15 4230 if (my $error = $@)
659 15 1236 if (my $error = $@)
660 15 0 if (my $type = $self->is_exception_type($error)) { }
686 215 0 if (my $timeout = $self->get_type_timeout('content'))
695 1 309 if (my $error = $@)
707 1 214 if (my $error = $@)
708 1 0 if (my $type = $self->is_exception_type($error)) { }
735 215 0 if (my $timeout = $self->get_type_timeout('content'))
744 1 214 if (my $error = $@)
756 1 214 if (my $error = $@)
757 1 0 if (my $type = $self->is_exception_type($error)) { }
784 215 0 if (my $timeout = $self->get_type_timeout('content'))
793 1 400 if (my $error = $@)
805 1 214 if (my $error = $@)
806 1 0 if (my $type = $self->is_exception_type($error)) { }
830 82 133 if (exists $top_handler->{'c_auth_headers'})
833 186 29 if (exists $top_handler->{'auth_headers'})
856 26 0 if (my $timeout = $self->get_type_timeout('command'))
865 1 0 if (my $error = $@)
877 1 25 if (my $error = $@)
878 1 0 if (my $type = $self->is_exception_type($error)) { }
907 109 0 if (my $timeout = $self->get_type_timeout('command'))
916 1 1055 if (my $error = $@)
928 1 108 if (my $error = $@)
929 1 0 if (my $type = $self->is_exception_type($error)) { }
962 35 325 if (my $timeout = $self->get_type_timeout('addheader'))
975 0 360 if (my $error = $@)
976 0 0 if (my $type = $self->is_exception_type($error)) { }
998 1338 4574 if (exists $self->{'thischild'}{'smtp'})
999 1338 0 if ($self->{'thischild'}{'smtp'}{'count'})
1003 5912 0 if ($status) { }
1022 0 1625 unless $type
1023 1625 0 if ($self->is_handler_loaded($type))
1027 0 1625 if (exists $config->{'_external_callback_processor'})
1028 0 0 if ($config->{'_external_callback_processor'}->can('handler_config'))
1043 0 1625 if ($type eq 'Mail::Milter::Authentication::Handler') { }
1625 0 elsif ($type =~ /^Mail::Milter::Authentication::Handler::(.*)/) { }
1067 2 2889 if (defined $self->get_reject_mail) { }
0 2889 elsif (defined $self->get_defer_mail) { }
10 2879 elsif (defined $self->get_quarantine_mail) { }
1137 7356 618 if (exists $config->{'handlers'}{$name})
1162 98 13 if $thischild->{'object_maker'}{$name}
1173 236 982 unless ($object)
1175 34 202 if (exists $thischild->{'object_maker'}{$name}) { }
123 79 elsif ($name eq 'resolver') { }
1186 123 0 if (defined $TestResolver) { }
1234 12 680 if ($name eq 'resolver')
1235 0 0 if ($thischild->{'object'}{'resolver'}->can('clear_error_cache'))
1239 430 250 unless $thischild->{'object'}{$name}{'destroy'}
1240 0 250 unless $thischild->{'object'}{$name}
1270 0 2 if (not $rcode =~ /^[5]\d\d$/ && $xcode =~ /^[5]\.\d+\.\d+$/ or substr($rcode, 0, 1) ne substr($xcode, 0, 1))
1291 0 0 if (not $rcode =~ /^[4]\d\d$/ && $xcode =~ /^[4]\.\d+\.\d+$/ or substr($rcode, 0, 1) ne substr($xcode, 0, 1))
1314 0 0 if (exists $top_handler->{'symbols'})
1315 0 0 if (exists $top_handler->{'symbols'}{'C'})
1322 0 0 if ($connect_symbols)
1336 63 306 unless (exists $top_handler->{'symbols'})
1339 115 254 unless (exists $top_handler->{'symbols'}{$code})
1354 30260 101023 if ($searchkey eq $key)
1366 0 24 if ($self->is_authenticated) { }
0 24 elsif ($self->is_local_ip_address) { }
0 24 elsif ($self->is_trusted_ip_address) { }
1367 0 0 if ($config->{'tempfail_on_error_authenticated'})
1373 0 0 if ($config->{'tempfail_on_error_local'})
1379 0 0 if ($config->{'tempfail_on_error_trusted'})
1385 24 0 if ($config->{'tempfail_on_error'})
1400 180 1852 unless $self->is_handler_loaded('LocalIP')
1407 180 2205 unless $self->is_handler_loaded('TrustedIP')
1414 0 0 unless $self->is_handler_loaded('TLS')
1421 180 1468 unless $self->is_handler_loaded('Auth')
1441 0 364 unless defined $text
1479 0 301 unless defined $address
1484 298 3 if ($address =~ /\@/)
1494 0 147 unless defined $addresstxt
1501 151 6 if ($address =~ /\@/)
1504 6 151 unless defined $domain
1526 0 787 unless defined $Str
1528 19 768 if ($Str eq '')
1542 7 1815 if ($Str =~ /\G\"(.*?)(?<!\\)(?:\"|\z)\s*/cgs) { }
119 1696 elsif ($Str =~ /\G\<(.*?)(?<!\\)(?:[>,;]|\z)\s*/cgs) { }
2 1694 elsif ($Str =~ /\G\((.*?)(?<!\\)\)\s*/cgs) { }
16 1678 elsif ($Str =~ /\G[,;]\s*/cg) { }
768 910 elsif ($Str =~ /\G$/cg) { }
910 0 elsif ($Str =~ /\G([^\s,;"<]*)\s*/cg) { }
1568 910 0 if (length $1)
1592 24 1014 if ($Type == 0 or $Type == 2 and defined $Email or $Type == 1 and defined $Email)
1595 35 5 if defined $Email
1600 917 137 if ($Type == 1) { }
119 18 elsif ($Type == 2) { }
2 16 elsif ($Type == 3) { }
1607 674 243 if ($Token =~ /^$RFC_dotatom\@$IDNRE$/o) { }
1614 0 674 if ($i + 1 < scalar @Tokens and $Types[$i + 1] == 2) { }
1615 0 0 defined $Phrase ? :
1619 0 674 if (defined $Email)
1628 130 113 defined $Phrase ? :
1636 0 2 defined $Comment ? :
1642 758 10 if defined $Email
1644 10 758 unless (@Addrs)
1653 0 803 if $Address =~ /\@unspecified-domain$/
1655 0 803 if ($Address =~ /^mailto:(.*)$/)
1671 0 768 unless (@TidyAddresses)
1684 323 149 unless ($hostname)
1687 323 149 unless ($hostname)
1701 0 24701 unless defined $key
1702 0 24701 unless defined $value
1705 0 24701 if ($priority == 7 and not $config->{'debug'})
1714 0 0 $priority == 0 ? :
0 0 $priority == 1 ? :
0 0 $priority == 2 ? :
122 0 $priority == 3 ? :
0 122 $priority == 4 ? :
0 122 $priority == 5 ? :
1012 122 $priority == 6 ? :
23567 1134 $priority == 7 ? :
1724 24701 0 if ($config->{'logtoerr'})
1729 10307 14394 unless (exists $top_handler->{'dbgout'})
1740 9795 14906 if ($self->get_symbol('i'))
1762 10304 245 if (exists $top_handler->{'dbgout'})
1769 0 24578 if ($priority eq 'debug' and not $config->{'debug'})
1807 797 0 if (ref $sa eq 'Mail::AuthenticationResults::Header::Entry') { }
1816 797 0 if (ref $sb eq 'Mail::AuthenticationResults::Header::Entry') { }
1825 40 757 if ($handler_a eq $handler_b)
1829 8 80 if ($handler->can_sort_header(lc $handler_a))
1830 8 0 if ($handler->can('handler_header_sort'))
1842 0 0 if (ref $header eq 'Mail::AuthenticationResults::Header::Entry')
1858 82 133 if (exists $top_handler->{'c_auth_headers'})
1861 186 29 if (exists $top_handler->{'auth_headers'})
1864 207 8 if (@auth_headers) { }
1872 0 620 if (ref $header ne 'Mail::AuthenticationResults::Header::Entry')
1879 0 207 if ($are_string_headers) { }
1887 0 207 if (exists $config->{'header_indent_style'}) { }
1893 0 207 if (exists $config->{'header_indent_by'}) { }
1899 0 207 if (exists $config->{'header_fold_at'})
1912 6 209 if (my $reason = $self->get_quarantine_mail)
1918 215 0 if (exists $top_handler->{'pre_headers'})
1926 2 213 if (exists $top_handler->{'add_headers'})
1941 215 56 unless (exists $top_handler->{'pre_headers'})
1956 185 296 unless (exists $top_handler->{'auth_headers'})
1969 81 58 unless (exists $top_handler->{'c_auth_headers'})
1980 2 6 unless (exists $top_handler->{'add_headers'})
2035 0 8 if $config->{'dryrun'}
2045 5 266 if $config->{'dryrun'}
2055 0 12 if $config->{'dryrun'}