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 292 11030 unless defined $labels
70 1324 9998 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 9953 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 11029 unless defined $exception
228 10858 171 unless $exception
229 123 48 if ref $exception ne "Mail::Milter::Authentication::Exception"
237 0 11005 unless defined $exception
239 10981 24 unless $Type
240 24 0 if $Type eq "Timeout"
248 0 242 unless exists $top_handler->{'timeout_at'}
261 3974 3608 if ($microseconds == 0) { }
275 0 126 if ($remaining < $microseconds) { }
292 0 116 if ($remaining < 1)
326 3563 435 if ($$config{$type . "_timeout"})
334 878 3120 if (my $overall_timeout = $top_handler->{'overall_timeout'})
338 0 878 if ($remaining < 1)
344 878 3120 if ($remaining)
345 833 45 if ($timeout) { }
346 617 216 if ($remaining < $timeout)
355 3608 390 if $effective
366 132 10189 unless exists $top_handler->{'timeout_at'}
367 10189 0 if $top_handler->{'timeout_at'} >= $self->get_microseconds
377 140 390 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 260 if ($ip_remap)
422 0 8 if (not $ip_remap->{'ip'}) { }
440 0 10 if (my $error = $@)
462 268 0 if (my $timeout = $self->get_type_timeout("connect"))
473 1 350 if (my $error = $@)
484 1 267 if (my $error = $@)
485 1 0 if (my $type = $self->is_exception_type($error)) { }
502 262 0 if (not $self->{'helo_name'})
506 8 254 if ($ip_remap)
508 2 6 if ($self->{'ip_object'}->ip ne $ip_remap->{'ip'}->ip)
529 0 262 unless defined $helo_host
533 262 0 if (my $timeout = $self->get_type_timeout("command"))
538 262 0 if (not $self->{'seen_helo_name'}) { }
546 1 385 if (my $error = $@)
562 1 261 if (my $error = $@)
563 1 0 if (my $type = $self->is_exception_type($error)) { }
586 1 260 unless defined $env_from
590 261 0 if (my $timeout = $self->get_type_timeout("command"))
605 1 827 if (my $error = $@)
616 1 260 if (my $error = $@)
617 1 0 if (my $type = $self->is_exception_type($error)) { }
640 0 260 unless defined $env_to
644 260 0 if (my $timeout = $self->get_type_timeout("command"))
653 1 121 if (my $error = $@)
664 1 259 if (my $error = $@)
665 1 0 if (my $type = $self->is_exception_type($error)) { }
687 0 1577 unless defined $value
690 0 1577 if ($header eq "X-Authentication-Milter-Error" and $value eq "Generated Error Report")
696 1577 0 if (my $timeout = $self->get_type_timeout("content"))
699 0 1577 if (my $error = $@)
708 15 5602 if (my $error = $@)
719 15 1562 if (my $error = $@)
720 15 0 if (my $type = $self->is_exception_type($error)) { }
745 258 0 if (my $timeout = $self->get_type_timeout("content"))
754 1 389 if (my $error = $@)
765 1 257 if (my $error = $@)
766 1 0 if (my $type = $self->is_exception_type($error)) { }
792 256 0 if (my $timeout = $self->get_type_timeout("content"))
801 1 266 if (my $error = $@)
812 1 255 if (my $error = $@)
813 1 0 if (my $type = $self->is_exception_type($error)) { }
839 258 0 if (my $timeout = $self->get_type_timeout("content"))
848 1 512 if (my $error = $@)
859 1 257 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 390 if (my $timeout = $self->get_type_timeout("addheader"))
1028 0 432 if (my $error = $@)
1029 0 0 if (my $type = $self->is_exception_type($error)) { }
1048 1666 5642 if (exists $self->{'thischild'}{'smtp'})
1049 1666 0 if ($self->{'thischild'}{'smtp'}{'count'})
1053 7308 0 if ($status) { }
1071 0 3317 unless $type
1072 3317 0 if ($self->is_handler_loaded($type))
1076 0 3317 if (exists $config->{'_external_callback_processor'})
1077 0 0 if ($config->{'_external_callback_processor'}->can("handler_config"))
1091 0 3317 if ($type eq 'Mail::Milter::Authentication::Handler') { }
3317 0 elsif ($type =~ /^Mail::Milter::Authentication::Handler::(.*)/u) { }
1114 3 3560 if (defined $self->get_reject_mail) { }
9 3551 elsif (defined $self->get_defer_mail) { }
15 3536 elsif (defined $self->get_quarantine_mail) { }
1181 9136 3003 if (exists $config->{'handlers'}{$name})
1206 122 20 if $thischild->{'object_maker'}{$name}
1216 526 1301 unless ($object)
1218 56 470 if (exists $thischild->{'object_maker'}{$name}) { }
154 316 elsif ($name eq 'resolver') { }
1225 154 0 if (defined $TestResolver) { }
1237 0 0 if $config->{'dns_resolvers'} and @{$config->{'dns_resolvers'}}
1273 618 490 unless $thischild->{'object'}{$name}
1274 19 471 if ($name eq "resolver")
1275 0 19 if ($thischild->{'object'}{'resolver'}{'object'}->can("clear_error_cache"))
1279 35 455 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 19656 86637 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 886 1868 unless $self->is_handler_loaded("LocalIP")
1564 1094 2229 unless $self->is_handler_loaded("TrustedIP")
1571 0 4 unless $self->is_handler_loaded("TLS")
1578 888 1430 unless $self->is_handler_loaded("Auth")
1598 0 702 unless defined $text
1636 0 437 unless defined $address
1641 434 3 if ($address =~ /\@/u)
1651 0 211 unless defined $addresstxt
1658 215 6 if ($address =~ /\@/u)
1661 6 215 unless defined $domain
1683 0 1119 unless defined $Str
1685 22 1097 if ($Str eq "")
1699 19 2545 if ($Str =~ /\G\"(.*?)(?<!\\)(?:\"|\z)\s*/cgsu) { }
237 2308 elsif ($Str =~ /\G\<(.*?)(?<!\\)(?:[>,;]|\z)\s*/cgsu) { }
2 2306 elsif ($Str =~ /\G\((.*?)(?<!\\)\)\s*/cgsu) { }
28 2278 elsif ($Str =~ /\G[,;]\s*/cgu) { }
1097 1181 elsif ($Str =~ /\G$/cgu) { }
1181 0 elsif ($Str =~ /\G([^\s,;"<]*)\s*/cgu) { }
1725 1181 0 if (length $1)
1749 27 1412 if ($Type == 0 or $Type == 2 and defined $Email or $Type == 1 and defined $Email)
1752 38 17 if defined $Email
1757 1200 267 if ($Type == 1) { }
237 30 elsif ($Type == 2) { }
2 28 elsif ($Type == 3) { }
1764 883 317 if ($Token =~ /^$RFC_dotatom\@$IDNRE$/ou) { }
1771 0 883 if ($i + 1 < scalar @Tokens and $Types[$i + 1] == 2) { }
1772 0 0 defined $Phrase ? :
1776 0 883 if (defined $Email)
1785 157 160 defined $Phrase ? :
1793 0 2 defined $Comment ? :
1799 1082 15 if defined $Email
1801 15 1082 unless (@Addrs)
1810 0 1135 if $Address =~ /\@unspecified-domain$/u
1812 0 1135 if ($Address =~ /^mailto:(.*)$/u)
1828 0 1097 unless (@TidyAddresses)
1841 206 126 unless ($hostname)
1844 206 126 unless ($hostname)
1854 20 0 if (exists $config->{'authserv_id'} and $config->{'authserv_id'})
1868 0 40350 unless defined $key
1869 0 40350 unless defined $value
1872 27004 13346 if (exists $thischild->{'tracelog'})
1877 26885 13465 if ($priority == 7 and not $config->{'debug'})
1886 0 0 $priority == 0 ? :
0 0 $priority == 1 ? :
0 0 $priority == 2 ? :
92 0 $priority == 3 ? :
0 92 $priority == 4 ? :
0 92 $priority == 5 ? :
453 92 $priority == 6 ? :
12920 545 $priority == 7 ? :
1896 13465 0 if ($config->{'logtoerr'})
1901 856 12609 unless (exists $top_handler->{'dbgout'})
1912 282 13183 if ($self->get_symbol("i"))
1931 845 345 if (exists $top_handler->{'dbgout'})
1938 0 13198 if ($priority eq "debug" and not $config->{'debug'})
1975 949 0 if (ref $sa eq 'Mail::AuthenticationResults::Header::Entry') { }
1984 949 0 if (ref $sb eq 'Mail::AuthenticationResults::Header::Entry') { }
1993 40 909 if ($handler_a eq $handler_b)
1997 8 56 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 176 if exists $top_handler->{'c_auth_headers'}
2023 217 41 if exists $top_handler->{'auth_headers'}
2032 0 258 if ($config->{'extended_log'})
2037 11 247 if (my $reason = $self->get_quarantine_mail)
2043 238 20 if (exists $top_handler->{'pre_headers'})
2051 4 254 if (exists $top_handler->{'add_headers'})
2066 81 157 if (exists $top_handler->{'c_auth_headers'}{$type})
2069 217 21 if (exists $top_handler->{'auth_headers'}{$type})
2072 238 0 if (@auth_headers) { }
0 0 elsif (not $config->{'hide_none'}) { }
2080 0 737 if (ref $header ne "Mail::AuthenticationResults::Header::Entry")
2084 0 737 if exists $header->{'parent'}
2089 0 238 if ($are_string_headers) { }
2099 0 238 if (exists $config->{'header_indent_style'}) { }
2105 0 238 if (exists $config->{'header_indent_by'}) { }
2111 0 238 if (exists $config->{'header_fold_at'})
2120 238 0 unless $config->{'extended_log'} and not $config->{'legacy_log'}
2121 0 238 if $config->{'extended_log'}
2141 238 127 unless (exists $top_handler->{'pre_headers'})
2156 216 382 unless exists $top_handler->{'auth_headers'}
2157 217 381 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 361 if $config->{'dryrun'}
2247 0 26 if $config->{'dryrun'}