Branch Coverage

blib/lib/Mail/Milter/Authentication/Handler.pm
Criterion Covered Total %
branch 325 472 68.8


line true false branch
51 0 6 unless (-e $basefile)
69 301 12484 unless defined $labels
70 1360 11425 unless defined $count
86 0 29 unless defined $labels
87 0 29 unless defined $value
114 2 2 if ($ip->version == 4) { }
2 0 elsif ($ip->version == 6) { }
123 0 4 unless $lookup_ip
134 3 3 if ($packet)
136 3 0 if (lc $rr->type eq "a")
156 0 11380 if $elapsed == 0
181 3 0 if (my $timeout = $self->get_type_timeout("dequeue"))
194 0 3 if (my $error = $@)
195 0 0 if (my $type = $self->is_exception_type($error)) { }
227 0 12317 unless defined $exception
228 12144 173 unless $exception
229 125 48 if ref $exception ne "Mail::Milter::Authentication::Exception"
237 0 12293 unless defined $exception
239 12269 24 unless $Type
240 24 0 if $Type eq "Timeout"
248 0 242 unless exists $top_handler->{'timeout_at'}
261 4115 3731 if ($microseconds == 0) { }
275 0 126 if ($remaining < $microseconds) { }
292 0 116 if ($remaining < 1)
326 3686 453 if ($$config{$type . "_timeout"})
334 878 3261 if (my $overall_timeout = $top_handler->{'overall_timeout'})
338 0 878 if ($remaining < 1)
344 878 3261 if ($remaining)
345 833 45 if ($timeout) { }
346 617 216 if ($remaining < $timeout)
355 3731 408 if $effective
366 150 11604 unless exists $top_handler->{'timeout_at'}
367 11604 0 if $top_handler->{'timeout_at'} >= $self->get_microseconds
377 140 408 if (exists $config->{'ip_map'})
382 0 264 if (not $map_obj) { }
387 4 248 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)
395 2 14 if ($helo_host and exists $mapped_to->{'helo_map'} and exists $mapped_to->{'helo_map'}{$helo_host}) { }
421 8 269 if ($ip_remap)
422 0 8 if (not $ip_remap->{'ip'}) { }
440 0 10 if (my $error = $@)
462 277 0 if (my $timeout = $self->get_type_timeout("connect"))
473 1 350 if (my $error = $@)
484 1 276 if (my $error = $@)
485 1 0 if (my $type = $self->is_exception_type($error)) { }
502 271 0 if (not $self->{'helo_name'})
506 8 263 if ($ip_remap)
508 2 6 if ($self->{'ip_object'}->ip ne $ip_remap->{'ip'}->ip)
529 0 271 unless defined $helo_host
533 271 0 if (my $timeout = $self->get_type_timeout("command"))
538 271 0 if (not $self->{'seen_helo_name'}) { }
546 1 403 if (my $error = $@)
562 1 270 if (my $error = $@)
563 1 0 if (my $type = $self->is_exception_type($error)) { }
586 1 269 unless defined $env_from
590 270 0 if (my $timeout = $self->get_type_timeout("command"))
605 1 854 if (my $error = $@)
616 1 269 if (my $error = $@)
617 1 0 if (my $type = $self->is_exception_type($error)) { }
640 0 269 unless defined $env_to
644 269 0 if (my $timeout = $self->get_type_timeout("command"))
653 1 130 if (my $error = $@)
664 1 268 if (my $error = $@)
665 1 0 if (my $type = $self->is_exception_type($error)) { }
687 0 1637 unless defined $value
690 0 1637 if ($header eq "X-Authentication-Milter-Error" and $value eq "Generated Error Report")
696 1637 0 if (my $timeout = $self->get_type_timeout("content"))
699 0 1637 if (my $error = $@)
708 15 6795 if (my $error = $@)
719 15 1622 if (my $error = $@)
720 15 0 if (my $type = $self->is_exception_type($error)) { }
745 267 0 if (my $timeout = $self->get_type_timeout("content"))
754 1 521 if (my $error = $@)
765 1 266 if (my $error = $@)
766 1 0 if (my $type = $self->is_exception_type($error)) { }
792 265 0 if (my $timeout = $self->get_type_timeout("content"))
801 1 275 if (my $error = $@)
812 1 264 if (my $error = $@)
813 1 0 if (my $type = $self->is_exception_type($error)) { }
839 267 0 if (my $timeout = $self->get_type_timeout("content"))
848 1 530 if (my $error = $@)
859 1 266 if (my $error = $@)
860 1 0 if (my $type = $self->is_exception_type($error)) { }
907 33 0 if (my $timeout = $self->get_type_timeout("command"))
916 1 0 if (my $error = $@)
927 1 32 if (my $error = $@)
928 1 0 if (my $type = $self->is_exception_type($error)) { }
956 130 0 if (my $timeout = $self->get_type_timeout("command"))
965 1 1181 if (my $error = $@)
976 1181 0 if $key eq "thischild"
982 1 129 if (my $error = $@)
983 1 0 if (my $type = $self->is_exception_type($error)) { }
1015 42 408 if (my $timeout = $self->get_type_timeout("addheader"))
1028 0 450 if (my $error = $@)
1029 0 0 if (my $type = $self->is_exception_type($error)) { }
1048 1666 5894 if (exists $self->{'thischild'}{'smtp'})
1049 1666 0 if ($self->{'thischild'}{'smtp'}{'count'})
1053 7560 0 if ($status) { }
1071 0 3432 unless $type
1072 3432 0 if ($self->is_handler_loaded($type))
1076 0 3432 if (exists $config->{'_external_callback_processor'})
1077 0 0 if ($config->{'_external_callback_processor'}->can("handler_config"))
1091 0 3432 if ($type eq 'Mail::Milter::Authentication::Handler') { }
3432 0 elsif ($type =~ /^Mail::Milter::Authentication::Handler::(.*)/u) { }
1114 3 3683 if (defined $self->get_reject_mail) { }
9 3674 elsif (defined $self->get_defer_mail) { }
15 3659 elsif (defined $self->get_quarantine_mail) { }
1181 9277 3303 if (exists $config->{'handlers'}{$name})
1206 122 23 if $thischild->{'object_maker'}{$name}
1216 571 1357 unless ($object)
1218 65 506 if (exists $thischild->{'object_maker'}{$name}) { }
163 343 elsif ($name eq 'resolver') { }
1225 163 0 if (defined $TestResolver) { }
1237 0 0 if $config->{'dns_resolvers'} and @{$config->{'dns_resolvers'}}
1273 627 499 unless $thischild->{'object'}{$name}
1274 19 480 if ($name eq "resolver")
1275 0 19 if ($thischild->{'object'}{'resolver'}{'object'}->can("clear_error_cache"))
1279 35 464 unless $thischild->{'object'}{$name}{'destroy'}
1298 0 24 unless $error
1302 1 23 unless exists $top_handler->{'exit_on_close_error'}
1310 0 3 if (not $rcode =~ /^[5]\d\d$/u && $xcode =~ /^[5]\.\d+\.\d+$/u or substr($rcode, 0, 1) ne substr($xcode, 0, 1))
1329 0 9 if (not $rcode =~ /^[4]\d\d$/u && $xcode =~ /^[4]\.\d+\.\d+$/u or substr($rcode, 0, 1) ne substr($xcode, 0, 1))
1350 0 0 if (exists $top_handler->{'symbols'})
1351 0 0 if (exists $top_handler->{'symbols'}{'C'})
1358 0 0 if ($connect_symbols)
1370 80 381 unless (exists $top_handler->{'symbols'})
1373 146 315 unless (exists $top_handler->{'symbols'}{$code})
1387 20815 94209 if ($searchkey eq $key)
1398 0 24 if ($self->is_authenticated) { }
0 24 elsif ($self->is_local_ip_address) { }
0 24 elsif ($self->is_trusted_ip_address) { }
1399 0 0 if ($config->{'tempfail_on_error_authenticated'})
1405 0 0 if ($config->{'tempfail_on_error_local'})
1411 0 0 if ($config->{'tempfail_on_error_trusted'})
1417 24 0 if ($config->{'tempfail_on_error'})
1431 2 145 unless -d $dir
1471 2 1 if (-e $dequeue_index_file)
1479 0 3 unless opendir my $dh, $dir
1482 41 11 if ($file =~ /^$key\..*\.dequeue$/u)
1483 0 41 if (exists $dequeue_index->{$file})
1484 0 0 if (exists $$process_ids{$dequeue_index->{$file}{'pid'}}) { }
1505 32 41 unless -e $filepath
1522 0 41 unless -e $filepath
1523 0 41 unless -f $filepath
1533 0 41 unless -e $filepath
1534 0 41 unless -f $filepath
1542 0 0 unless -e $filepath
1543 0 0 unless -f $filepath
1550 2 0 unless $self->is_handler_loaded("Sanitize")
1557 982 1868 unless $self->is_handler_loaded("LocalIP")
1564 1190 2229 unless $self->is_handler_loaded("TrustedIP")
1571 0 4 unless $self->is_handler_loaded("TLS")
1578 984 1430 unless $self->is_handler_loaded("Auth")
1598 0 768 unless defined $text
1636 0 472 unless defined $address
1641 469 3 if ($address =~ /\@/u)
1651 0 229 unless defined $addresstxt
1658 233 6 if ($address =~ /\@/u)
1661 6 233 unless defined $domain
1683 0 1211 unless defined $Str
1685 22 1189 if ($Str eq "")
1699 19 2755 if ($Str =~ /\G\"(.*?)(?<!\\)(?:\"|\z)\s*/cgsu) { }
263 2492 elsif ($Str =~ /\G\<(.*?)(?<!\\)(?:[>,;]|\z)\s*/cgsu) { }
2 2490 elsif ($Str =~ /\G\((.*?)(?<!\\)\)\s*/cgsu) { }
28 2462 elsif ($Str =~ /\G[,;]\s*/cgu) { }
1189 1273 elsif ($Str =~ /\G$/cgu) { }
1273 0 elsif ($Str =~ /\G([^\s,;"<]*)\s*/cgu) { }
1725 1273 0 if (length $1)
1749 27 1530 if ($Type == 0 or $Type == 2 and defined $Email or $Type == 1 and defined $Email)
1752 38 17 if defined $Email
1757 1292 293 if ($Type == 1) { }
263 30 elsif ($Type == 2) { }
2 28 elsif ($Type == 3) { }
1764 945 347 if ($Token =~ /^$RFC_dotatom\@$IDNRE$/ou) { }
1771 0 945 if ($i + 1 < scalar @Tokens and $Types[$i + 1] == 2) { }
1772 0 0 defined $Phrase ? :
1776 0 945 if (defined $Email)
1785 157 190 defined $Phrase ? :
1793 0 2 defined $Comment ? :
1799 1170 19 if defined $Email
1801 19 1170 unless (@Addrs)
1810 0 1227 if $Address =~ /\@unspecified-domain$/u
1812 0 1227 if ($Address =~ /^mailto:(.*)$/u)
1828 0 1189 unless (@TidyAddresses)
1841 224 126 unless ($hostname)
1844 224 126 unless ($hostname)
1854 20 0 if (exists $config->{'authserv_id'} and $config->{'authserv_id'})
1868 0 43459 unless defined $key
1869 0 43459 unless defined $value
1872 28902 14557 if (exists $thischild->{'tracelog'})
1877 28783 14676 if ($priority == 7 and not $config->{'debug'})
1886 0 0 $priority == 0 ? :
0 0 $priority == 1 ? :
0 0 $priority == 2 ? :
96 0 $priority == 3 ? :
0 96 $priority == 4 ? :
0 96 $priority == 5 ? :
462 96 $priority == 6 ? :
14118 558 $priority == 7 ? :
1896 14676 0 if ($config->{'logtoerr'})
1901 886 13790 unless (exists $top_handler->{'dbgout'})
1912 282 14394 if ($self->get_symbol("i"))
1931 872 345 if (exists $top_handler->{'dbgout'})
1938 0 14403 if ($priority eq "debug" and not $config->{'debug'})
1975 971 0 if (ref $sa eq 'Mail::AuthenticationResults::Header::Entry') { }
1984 971 0 if (ref $sb eq 'Mail::AuthenticationResults::Header::Entry') { }
1993 40 931 if ($handler_a eq $handler_b)
1997 8 42 if ($handler->can_sort_header(lc $handler_a))
1998 8 0 if ($handler->can("handler_header_sort"))
2010 0 0 if (ref $header eq "Mail::AuthenticationResults::Header::Entry")
2022 82 185 if exists $top_handler->{'c_auth_headers'}
2023 226 41 if exists $top_handler->{'auth_headers'}
2032 0 267 if ($config->{'extended_log'})
2037 11 256 if (my $reason = $self->get_quarantine_mail)
2043 247 20 if (exists $top_handler->{'pre_headers'})
2051 4 263 if (exists $top_handler->{'add_headers'})
2066 81 166 if (exists $top_handler->{'c_auth_headers'}{$type})
2069 226 21 if (exists $top_handler->{'auth_headers'}{$type})
2072 247 0 if (@auth_headers) { }
0 0 elsif (not $config->{'hide_none'}) { }
2080 0 764 if (ref $header ne "Mail::AuthenticationResults::Header::Entry")
2084 0 764 if exists $header->{'parent'}
2089 0 247 if ($are_string_headers) { }
2099 0 247 if (exists $config->{'header_indent_style'}) { }
2105 0 247 if (exists $config->{'header_indent_by'}) { }
2111 0 247 if (exists $config->{'header_fold_at'})
2120 247 0 unless $config->{'extended_log'} and not $config->{'legacy_log'}
2121 0 247 if $config->{'extended_log'}
2141 247 136 unless (exists $top_handler->{'pre_headers'})
2156 225 400 unless exists $top_handler->{'auth_headers'}
2157 226 399 unless exists $top_handler->{'auth_headers'}{$header_name}
2167 81 58 unless exists $top_handler->{'c_auth_headers'}
2168 81 58 unless exists $top_handler->{'c_auth_headers'}{$header_name}
2176 4 14 unless (exists $top_handler->{'add_headers'})
2229 0 18 if $config->{'dryrun'}
2238 4 379 if $config->{'dryrun'}
2247 0 26 if $config->{'dryrun'}