Branch Coverage

blib/lib/Mail/Milter/Authentication/Handler/DMARC.pm
Criterion Covered Total %
branch 177 332 53.3


line true false branch
48 103 8 unless exists $config->{'whitelisted'}
55 0 10 if ($entry =~ /^dnswl:/u) { }
2 8 elsif ($entry =~ /^dkim:/u) { }
0 8 elsif ($entry =~ /^spf:/u) { }
57 0 0 if ($type eq 'spf') { }
0 0 elsif ($type eq 'dkim') { }
0 0 elsif ($type eq 'ip') { }
60 0 0 if ($spf)
62 0 0 if ($got_spf_result eq "pass")
64 0 0 if ($self->rbl_check_domain($got_spf_domain, $rbl))
76 0 0 if ($self->rbl_check_domain($dkim_domain, $rbl))
83 0 0 if ($self->rbl_check_ip($ip_obj, $rbl))
92 2 0 if (exists $dkim_handler->{'valid_domains'}{lc $dkim_domain})
101 0 0 if ($spf)
103 0 0 if ($got_spf_result eq "pass")
105 0 0 if (lc $got_spf_domain eq lc $spf_domain)
116 0 8 if (not $whitelisted_obj) { }
121 0 6 if ($is_overlap == $Mail::Milter::Authentication::Handler::DMARC::IP_A_IN_B_OVERLAP or $is_overlap == $Mail::Milter::Authentication::Handler::DMARC::IP_B_IN_A_OVERLAP or $is_overlap == $Mail::Milter::Authentication::Handler::DMARC::IP_PARTIAL_OVERLAP or $is_overlap == $Mail::Milter::Authentication::Handler::DMARC::IP_IDENTICAL)
133 4 6 if $whitelisted
143 0 37 if (exists $config->{'config_file'})
144 0 0 unless -e $config->{'config_file'}
149 37 0 if ($psl) { }
162 0 33 if (exists $config->{'config_file'})
163 0 0 unless -e $config->{'config_file'}
167 0 33 if ($now > $PSL_CHECKED_TIME + $check_time)
169 0 0 if ($dmarc->can('check_public_suffix_list')) { }
170 0 0 if ($dmarc->check_public_suffix_list) { }
193 0 10 if $config->{'no_report'}
214 2 0 if ($env_domain_from ne "")
218 0 2 if (my $error = $@)
226 2 0 unless ($config->{'hide_report_to'})
230 0 2 if (my $error = $@)
237 0 2 if (my $error = $@)
246 2 0 if ($spf) { }
248 0 2 if ($spf->{'dmarc_result'} eq 'pass' and lc $spf->{'dmarc_domain'} eq lc $header_domain) { }
1 1 elsif (my $arc_spf = $self->get_handler('ARC')->get_trusted_spf_results) { }
280 0 2 if (my $error = $@)
289 1 1 if ($arc_values)
296 0 2 if ($dkim_handler->{'has_dkim'})
298 0 0 if ($dkim_object)
313 0 111 if (exists $self->{'processed'}{"$env_domain_from $header_domain"})
319 0 111 if ($config->{'reject_on_multifrom'})
320 0 0 if (scalar keys %{$$self{'processed'}} == $config->{'reject_on_multifrom'}) { }
0 0 elsif (scalar keys %{$$self{'processed'}} > $config->{'reject_on_multifrom'}) { }
331 0 111 if ($config->{'quarantine_on_multifrom'})
332 0 0 if (scalar keys %{$$self{'processed'}} == $config->{'quarantine_on_multifrom'}) { }
0 0 elsif (scalar keys %{$$self{'processed'}} > $config->{'quarantine_on_multifrom'}) { }
343 0 111 if ($config->{'skip_on_multifrom'})
344 0 0 if (scalar keys %{$$self{"processed"}} >= $config->{'skip_on_multifrom'})
356 107 4 if ($env_domain_from ne "")
360 2 105 if (my $error = $@)
367 111 0 unless ($config->{'hide_report_to'})
371 0 111 if (my $error = $@)
379 0 111 if (my $error = $@)
391 10 101 if ($have_arc)
393 0 10 unless $self->get_handler("ARC")->can("get_trusted_arc_authentication_results")
395 101 10 unless $config->{'use_arc'}
400 111 0 if ($spf) { }
411 0 111 if (my $error = $@)
419 0 111 if ($dkim_handler->{'failmode'}) { }
41 70 elsif ($dkim_handler->{'has_dkim'}) { }
424 41 0 if ($dkim_object) { }
441 101 10 unless $dmarc_results
449 0 111 if (my $error = $@)
451 0 0 if ($dmarc_code ne "pass")
458 6 105 $is_subdomain ? :
463 39 72 unless $dmarc_policy
467 111 0 unless $dmarc_sub_policy
474 2 109 if ($have_arc and $dmarc_code eq "fail")
478 0 2 unless defined $arc_aware_result
484 30 81 if ($dmarc_code eq "fail")
486 1 29 if ($arc_aware_result eq 'pass') { }
4 25 elsif ($is_whitelisted) { }
0 25 elsif ($config->{'no_list_reject'} and $self->{'is_list'}) { }
495 1 0 if ($arc_handler)
496 1 0 if ($arc_handler->{'arc_result'} eq "pass")
505 0 2 if $signature->instance ne $instance
534 0 0 if ($config->{'arc_before_list'} and $have_arc and $self->get_handler('ARC')->get_trusted_arc_authentication_results) { }
547 14 16 if ($dmarc_disposition eq "reject")
548 2 12 if ($config->{'hard_reject'}) { }
562 12 99 if ($dmarc_disposition eq "quarantine")
570 0 0 if ($config->{'policy_rbl_lookup'} and $dmarc_code eq 'pass' || $arc_aware_result eq 'pass')
575 0 0 if ($rbl_result)
578 0 0 exists $rbl_data->{'results'}{'*'} ? :
0 0 exists $rbl_data->{'results'}{$rbl_result} ? :
587 111 0 if ($dmarc_policy)
591 0 111 if ($dmarc_sub_policy ne "default")
595 1 92 if ($config->{'detect_list_id'} and $self->{'is_list'})
598 111 0 if ($dmarc_disposition)
602 111 0 if ($dmarc_disposition_evaluated)
606 16 95 if ($policy_override)
610 2 109 if ($arc_aware_result)
615 111 0 if (@comments)
619 0 111 $is_subdomain && $dmarc_sub_policy ne 'default' ? :
630 1 110 $self->{'is_list'} ? :
4 107 $is_whitelisted ? :
2 109 $arc_aware_result ? :
6 105 $is_subdomain ? :
641 62 49 if ($rua)
642 62 0 if (not $config->{'no_report'}) { }
643 62 0 if (not $self->{'skip_report'}) { }
660 11 111 if ($dmarc)
677 0 219 if (exists $config->{'config_file'})
678 0 0 unless -e $config->{'config_file'}
681 219 0 if ($dmarc->can("set_resolver"))
685 82 0 if ($self->config->{'debug'} and $self->config->{'logtoerr'})
690 0 219 if (my $error = $@)
705 114 0 if not $self->{'report_queue'}
716 8 106 if $self->is_local_ip_address
717 2 104 if $self->is_trusted_ip_address
718 0 104 if $self->is_authenticated
725 1 103 if $env_from eq "<>"
727 0 104 unless ($self->is_handler_loaded("SPF"))
733 0 104 unless ($self->is_handler_loaded("DKIM"))
740 99 5 if ($env_from) { }
754 104 0 unless exists $config->{'report_skip_to'}
756 0 0 if (lc $address eq lc $env_to)
765 8 106 if $self->is_local_ip_address
766 2 104 if $self->is_trusted_ip_address
767 0 104 if $self->is_authenticated
775 117 896 if $self->is_local_ip_address
776 30 866 if $self->is_trusted_ip_address
777 0 866 if $self->is_authenticated
778 0 866 if $self->{'failmode'}
780 1 865 if (lc $header eq "list-id")
784 0 866 if (lc $header eq "list-post")
789 106 760 if (lc $header eq "from")
790 4 102 if (exists $self->{'from_header'})
796 106 0 if ($domain)
805 7 99 if ($org_domain and $org_domain ne $domain)
821 1 26 if ($self->is_handler_loaded("ARC"))
832 8 106 if $self->is_local_ip_address
833 2 104 if $self->is_trusted_ip_address
834 0 104 if $self->is_authenticated
835 0 104 if $self->{'failmode'}
839 5 99 unless @$env_domains_from
860 0 111 if (my $error = $@)
862 0 0 if ($error =~ /invalid header_from at /u) { }
879 101 3 if (@{$self->{'dmarc_ar_headers'};}) { }
881 102 5 unless ($config->{'hide_none'} and $dmarc_header->value eq "none")
897 8 0 if $header eq "dmarc"
910 4 4 if ($result_a ne $result_b)
911 0 4 if $result_a eq "fail"
912 4 0 if $result_b eq "fail"
913 0 0 if $result_a eq "none"
914 0 0 if $result_b eq "none"
918 2 2 if ($policy_a ne $policy_b)
919 0 2 if $policy_a eq "reject"
920 0 2 if $policy_b eq "reject"
921 2 0 if $policy_a eq "quarantine"
922 0 0 if $policy_b eq "quarantine"
937 4 107 if exists $unique_strings->{$as_string}
961 41 0 if ($report) { }
965 41 0 if ($report->can("set_resolver"))
975 0 41 if (exists $config->{'report_suppression_list'})
976 0 0 if ($self->rbl_check_domain($org_domain, $config->{'report_suppression_list'}))
988 0 41 if (my $Error = $@)
991 0 0 if ($Type)
992 0 0 if ($Type eq "Timeout")
994 0 0 if ($self->get_time_remaining > 0) { }
1018 43 75 unless $self->{'report_queue'}
1023 56 0 if ($report->can("set_resolver"))
1031 0 75 if (my $Error = $@)
1034 0 0 if ($Type)
1035 0 0 if ($Type eq "Timeout")
1037 0 0 if ($self->get_time_remaining > 0)