Branch Coverage

blib/lib/Mail/Milter/Authentication/Handler/DMARC.pm
Criterion Covered Total %
branch 139 272 51.1


line true false branch
47 49 8 unless exists $config->{'whitelisted'}
54 0 10 if ($entry =~ /^dnswl:/) { }
2 8 elsif ($entry =~ /^dkim:/) { }
0 8 elsif ($entry =~ /^spf:/) { }
56 0 0 if ($type eq 'spf') { }
0 0 elsif ($type eq 'dkim') { }
0 0 elsif ($type eq 'ip') { }
59 0 0 if ($spf)
61 0 0 if ($got_spf_result eq 'pass')
63 0 0 if ($self->rbl_check_domain($got_spf_domain, $rbl))
75 0 0 if ($self->rbl_check_domain($dkim_domain, $rbl))
82 0 0 if ($self->rbl_check_ip($ip_obj, $rbl))
91 2 0 if (exists $dkim_handler->{'valid_domains'}{lc $dkim_domain})
100 0 0 if ($spf)
102 0 0 if ($got_spf_result eq 'pass')
104 0 0 if (lc $got_spf_domain eq lc $spf_domain)
116 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)
127 4 6 if $whitelisted
137 0 25 if (exists $config->{'config_file'})
138 0 0 unless exists $config->{'config_file'}
143 25 0 if ($psl) { }
157 0 24 if (exists $config->{'config_file'})
158 0 0 unless exists $config->{'config_file'}
162 0 24 if ($now > $PSL_CHECKED_TIME + $check_time)
164 0 0 if ($dmarc->can('check_public_suffix_list')) { }
165 0 0 if ($dmarc->check_public_suffix_list) { }
193 0 0 if ($env_domain_from ne '')
197 0 0 if (my $error = $@)
207 0 0 if (my $error = $@)
213 0 0 if (my $error = $@)
221 0 0 if ($spf) { }
223 0 0 if ($spf->{'dmarc_result'} eq 'pass' and lc $spf->{'dmarc_domain'} eq lc $header_domain) { }
0 0 elsif (my $arc_spf = $self->get_handler('ARC')->get_trusted_spf_results) { }
255 0 0 if (my $error = $@)
264 0 0 if ($arc_values)
271 0 0 if ($dkim_handler->{'has_dkim'})
273 0 0 if ($dkim_object)
294 55 2 if ($env_domain_from ne '')
298 0 55 if (my $error = $@)
300 0 0 if ($error =~ /invalid envelope_from at /) { }
324 0 57 if (my $error = $@)
331 0 57 if (my $error = $@)
343 0 57 if ($have_arc)
345 0 0 unless $self->get_handler('ARC')->can('get_trusted_arc_authentication_results')
347 57 0 unless $config->{'use_arc'}
352 57 0 if ($spf) { }
363 0 57 if (my $error = $@)
371 0 57 if ($dkim_handler->{'failmode'}) { }
28 29 elsif ($dkim_handler->{'has_dkim'}) { }
376 28 0 if ($dkim_object) { }
400 0 57 if (my $error = $@)
402 0 0 if ($dmarc_code ne 'pass')
409 0 57 $is_subdomain ? :
414 11 46 unless $dmarc_policy
418 57 0 unless $dmarc_sub_policy
425 0 57 if ($have_arc and $dmarc_code eq 'fail')
433 24 33 if ($dmarc_code eq 'fail')
435 0 24 if ($arc_aware_result eq 'pass') { }
4 20 elsif ($is_whitelisted) { }
0 20 elsif ($config->{'no_list_reject'} and $self->{'is_list'}) { }
449 0 0 if ($config->{'arc_before_list'} and $have_arc and $self->get_handler('ARC')->get_trusted_arc_authentication_results) { }
462 9 15 if ($dmarc_disposition eq 'reject')
463 2 7 if ($config->{'hard_reject'}) { }
477 7 50 if ($dmarc_disposition eq 'quarantine')
483 57 0 unless ($config->{'hide_none'} and $dmarc_code eq 'none')
487 57 0 if ($dmarc_policy)
491 0 57 if ($dmarc_sub_policy ne 'default')
495 1 56 if ($config->{'detect_list_id'} and $self->{'is_list'})
498 57 0 if ($dmarc_disposition)
502 57 0 if ($dmarc_disposition_evaluated)
506 11 46 if ($policy_override)
510 0 57 if ($arc_aware_result)
515 57 0 if (@comments)
519 0 57 $is_subdomain && $dmarc_sub_policy ne 'default' ? :
531 1 56 $self->{'is_list'} ? :
4 53 $is_whitelisted ? :
0 57 $arc_aware_result ? :
0 57 $is_subdomain ? :
542 46 11 if ($rua)
543 46 0 if (not $config->{'no_report'}) { }
544 46 0 if (not $self->{'skip_report'}) { }
563 4 79 if ($dmarc)
580 0 153 if (exists $config->{'config_file'})
581 0 0 unless exists $config->{'config_file'}
584 153 0 if ($dmarc->can('set_resolver'))
588 0 0 if ($config->{'debug'} and $config->{'logtoerr'})
593 0 153 if (my $error = $@)
608 82 0 unless $self->{'report_queue'}
620 8 74 if $self->is_local_ip_address
621 2 72 if $self->is_trusted_ip_address
622 0 72 if $self->is_authenticated
628 1 71 if $env_from eq '<>'
630 0 72 unless ($self->is_handler_loaded('SPF'))
636 0 72 unless ($self->is_handler_loaded('DKIM'))
643 67 5 if ($env_from) { }
659 72 0 unless exists $config->{'report_skip_to'}
661 0 0 if (lc $address eq lc $env_to)
671 8 74 if $self->is_local_ip_address
672 2 72 if $self->is_trusted_ip_address
673 0 72 if $self->is_authenticated
683 117 610 if $self->is_local_ip_address
684 30 580 if $self->is_trusted_ip_address
685 0 580 if $self->is_authenticated
686 0 580 if $self->{'failmode'}
688 1 579 if (lc $header eq 'list-id')
692 0 580 if (lc $header eq 'list-post')
697 74 506 if (lc $header eq 'from')
698 4 70 if (exists $self->{'from_header'})
704 74 0 if ($domain)
712 4 70 if ($org_domain and $org_domain ne $domain)
728 0 17 if ($self->is_handler_loaded('ARC'))
739 8 74 if $self->is_local_ip_address
740 2 72 if $self->is_trusted_ip_address
741 0 72 if $self->is_authenticated
742 0 72 if $self->{'failmode'}
746 5 67 unless @$env_domains_from
767 22 57 if (my $error = $@)
769 0 22 if ($error =~ /invalid header_from at /) { }
786 69 3 if (@{$self->{'dmarc_ar_headers'};}) { }
804 8 0 if $header eq 'dmarc'
817 4 4 if ($result_a ne $result_b)
818 0 4 if $result_a eq 'fail'
819 4 0 if $result_b eq 'fail'
820 0 0 if $result_a eq 'none'
821 0 0 if $result_b eq 'none'
825 2 2 if ($policy_a ne $policy_b)
826 0 2 if $policy_a eq 'reject'
827 0 2 if $policy_b eq 'reject'
828 2 0 if $policy_a eq 'quarantine'
829 0 0 if $policy_b eq 'quarantine'
844 4 75 if exists $unique_strings->{$as_string}
866 36 61 unless $self->{'report_queue'}
876 1 60 if (my $Error = $@)
879 1 0 if ($Type)
880 1 0 if ($Type eq 'Timeout')
882 1 0 if ($self->get_time_remaining > 0)