Branch Coverage

blib/lib/Mail/Milter/Authentication/Handler/SPF.pm
Criterion Covered Total %
branch 68 100 68.0


line true false branch
42 0 65 if (my $error = $@)
79 8 115 if $self->is_local_ip_address
80 2 113 if $self->is_trusted_ip_address
81 0 113 if $self->is_authenticated
83 8 105 if ($config->{'spfu_detection'})
91 0 113 unless ($spf_server)
101 1 112 if $env_from eq "<>"
105 5 108 if (not $env_from) { }
115 0 113 unless ($identity)
132 113 0 unless $spf_results
141 14 99 if ($result_code eq "none")
142 0 14 if ($config->{'best_guess'})
143 0 0 if ($self->is_handler_loaded("DMARC"))
146 0 0 if ($domain)
149 0 0 if ($org_domain ne $domain)
161 0 0 unless $spf_results
174 0 113 if ($auth_domain)
179 109 4 unless ($config->{'hide_none'} and $result_code eq "none")
193 113 0 unless ($config->{'hide_received-spf_header'})
194 109 4 unless ($config->{'hide_none'} and $result_code eq "none")
203 0 113 if (my $error = $@)
216 1022 51 unless exists $self->{'spfu_chain'}
217 0 51 unless $self->{'dmarc_result'} eq "pass"
221 8 43 if ($lc_header eq "from")
223 8 0 if $spfu_from_domain =~ /\@/u
229 18 25 if ($lc_header eq "received-spf" or $lc_header eq "x-ms-exchange-authentication-results" or $lc_header eq "arc-authentication-results" or $lc_header =~ /authentication-results$/u)
240 109 14 if ($self->{'spf_header'})
247 113 10 if $self->{'spf_metric'}
253 101 8 unless exists $self->{'spfu_chain'}
254 0 8 unless exists $self->{'spfu_from_domain'}
255 0 8 unless $self->{'dmarc_result'} eq "pass"
257 8 0 if ($self->is_handler_loaded("DMARC"))
264 8 0 if ($dmarc_object)
270 0 8 unless lc $dmarc_domain eq $spfu_from_domain
274 2 10 if $self->{'spfu_detected'}
279 4 6 if ($header eq "received-spf")
283 0 4 unless $lc_value =~ /^fail /u
285 0 4 unless $for_value
287 0 4 if $failed_domain =~ /\@/u
289 4 0 if $dmarc_object
291 3 1 if ($failed_domain eq $spfu_from_domain)
303 2 4 if ($header eq 'x-ms-exchange-authentication-results') { }
2 2 elsif ($header eq 'arc-authentication-results') { }
2 0 elsif ($header =~ /authentication-results$/u) { }
307 2 0 unless ($ar_object)
323 0 6 unless $ar_object
332 6 0 if $dmarc_object
333 4 2 if (lc $mailfrom_domain eq $spfu_from_domain)
344 7 1 if ($self->{'spfu_detected'})
347 6 1 if ($config->{'spfu_detection'} == 1) { }