Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/SPF.pm
Criterion Covered Total %
branch 56 244 22.9


line true false branch
141 0 0 unless (defined $value and not $value =~ /^$/)
144 0 0 unless ($value =~ /^(?:\S+(?:\s+\S+)*)$/)
268 0 4 unless $scanner->{'spf_checked'}
274 4 0 unless $scanner->{'spf_checked'}
280 0 0 unless $scanner->{'spf_checked'}
286 0 4 unless $scanner->{'spf_checked'}
287 0 4 if ($scanner->{'spf_failure_comment'})
295 0 4 unless $scanner->{'spf_checked'}
301 0 0 unless $scanner->{'spf_checked'}
307 0 0 unless $scanner->{'spf_checked'}
313 0 4 unless $scanner->{'spf_helo_checked'}
319 4 0 unless $scanner->{'spf_helo_checked'}
325 0 0 unless $scanner->{'spf_helo_checked'}
331 0 4 unless $scanner->{'spf_helo_checked'}
332 0 4 if ($scanner->{'spf_helo_failure_comment'})
340 0 4 unless $scanner->{'spf_helo_checked'}
346 0 0 unless $scanner->{'spf_helo_checked'}
352 0 0 unless $scanner->{'spf_helo_checked'}
358 81 0 unless $scanner->{'spf_whitelist_from_checked'}
364 81 0 unless $scanner->{'def_spf_whitelist_from_checked'}
382 0 8 if ($scanner->{'conf'}{'ignore_received_spf_header'}) { }
4 4 elsif ($scanner->{'checked_for_received_spf_header'}) { }
391 0 4 if ($scanner->{'conf'}{'use_newest_received_spf_header'}) { }
400 0 17 if ($hdr =~ /^received-spf:/i) { }
0 17 elsif ($hdr =~ /^Authentication-Results:.*;\s*SPF\s*=\s*([^;]*)/i) { }
419 0 0 if ($hdr =~ /^received-spf:\s*(pass|neutral|(?:soft)?fail|(?:temp|perm)error|none)\b(?:.*\bidentity=(\S+?);?\b)?/i) { }
423 0 0 if (defined $2) { }
425 0 0 if ($identity eq 'mfrom' or $identity eq 'mailfrom') { }
0 0 elsif ($identity eq 'helo') { }
426 0 0 if $scanner->{'spf_checked'}
429 0 0 if $scanner->{'spf_helo_checked'}
436 0 0 if $scanner->{'spf_checked'}
452 0 0 $identity ? :
456 0 0 if $scanner->{'spf_checked'} and $scanner->{'spf_helo_checked'}
469 0 0 if ($tmphdr =~ /^(pass|neutral|(?:hard|soft)?fail|(?:temp|perm)error|none)(?:[^;]*?\bsmtp\.(\S+)\s*=[^;]+)?/i) { }
471 0 0 if $result eq "hardfail"
474 0 0 if (defined $2) { }
476 0 0 if ($identity eq 'mfrom' or $identity eq 'mailfrom') { }
0 0 elsif ($identity eq 'helo') { }
477 0 0 if $scanner->{'spf_checked'}
480 0 0 if $scanner->{'spf_helo_checked'}
487 0 0 if $scanner->{'spf_checked'}
503 0 0 $identity ? :
507 0 0 if $scanner->{'spf_checked'} and $scanner->{'spf_helo_checked'}
516 0 0 if $ishelo and $scanner->{'spf_helo_checked'} or not $ishelo and $scanner->{'spf_checked'}
520 0 8 unless $scanner->is_dns_available
521 0 8 if $self->{'no_spf_module'}
524 1 7 unless (defined $self->{'has_mail_spf'})
527 0 1 if $scanner->{'conf'}{'do_not_use_mail_spf'}
530 0 1 if (not defined $Mail::SPF::VERSION or $Mail::SPF::VERSION < "2.001")
531 0 0 defined $Mail::SPF::VERSION ? :
542 0 1 unless (eval {
543 0 0 $@ ne '' ? :
546 1 0 if (not defined $eval_stat) { }
558 0 0 if $scanner->{'conf'}{'do_not_use_mail_spf_query'}
561 0 0 if (not defined $Mail::SPF::Query::VERSION or $Mail::SPF::Query::VERSION < "1.996")
562 0 0 defined $Mail::SPF::Query::VERSION ? :
566 0 0 unless (eval {
567 0 0 $@ ne '' ? :
570 0 0 if (not defined $eval_stat) { }
586 0 8 if $scanner->check_for_from_dns
588 4 4 if ($ishelo) { }
613 8 0 unless (defined $lasthop)
614 4 4 $ishelo ? :
621 0 0 unless $scanner->{'sender_got'}
623 0 0 if ($ishelo) { }
624 0 0 unless ($helo)
630 0 0 unless $scanner->{'sender_got'}
637 0 0 unless ($scanner->{'sender'})
642 0 0 $helo ? :
647 0 0 if ($ishelo and $helo =~ /^[\[!]?\d+\.\d+\.\d+\.\d+[\]!]?$/ || $helo =~ /^[^.]+$/)
652 0 0 if ($helo and $scanner->server_failed_to_respond_for_domain($helo))
661 0 0 if ($self->{'has_mail_spf'}) { }
664 0 0 $ishelo ? :
666 0 0 unless ($identity)
667 0 0 $ishelo ? :
0 0 $ishelo ? :
675 0 0 $ishelo ? :
680 0 0 unless (eval {
681 0 0 $@ ne '' ? :
695 0 0 if $query->can("authority_explanation")
703 0 0 unless ($helo)
718 0 0 unless (eval {
719 0 0 $@ ne '' ? :
736 0 0 if ($err)
749 0 0 if ($ishelo) { }
750 0 0 if ($result eq 'pass') { }
0 0 elsif ($result eq 'neutral') { }
0 0 elsif ($result eq 'none') { }
0 0 elsif ($result eq 'fail') { }
0 0 elsif ($result eq 'softfail') { }
0 0 elsif ($result eq 'permerror') { }
0 0 elsif ($result eq 'temperror') { }
0 0 elsif ($result eq 'error') { }
759 0 0 if ($result eq "fail")
763 0 0 if ($result eq 'pass') { }
0 0 elsif ($result eq 'neutral') { }
0 0 elsif ($result eq 'none') { }
0 0 elsif ($result eq 'fail') { }
0 0 elsif ($result eq 'softfail') { }
0 0 elsif ($result eq 'permerror') { }
0 0 elsif ($result eq 'temperror') { }
0 0 elsif ($result eq 'error') { }
772 0 0 if ($result eq "fail")
795 14 63 if (defined $relay)
799 0 77 if ($sender) { }
805 28 49 if ($scanner->{'num_relays_trusted'} > 0 and not $scanner->{'conf'}{'always_trust_envelope_sender'})
817 48 1 unless ($sender)
833 4 77 if ($scanner->{'spf_checked'} and not $scanner->{'spf_pass'})
838 37 40 unless $scanner->{'sender_got'}
840 76 1 unless ($scanner->{'sender'})
846 1 0 unless ($scanner->{'spf_whitelist_from'})
851 0 1 if ($scanner->{'spf_whitelist_from'}) { }
852 0 0 if ($self->check_for_spf_pass($scanner)) { }
871 4 77 if ($scanner->{'spf_checked'} and not $scanner->{'spf_pass'})
876 40 37 unless $scanner->{'sender_got'}
878 76 1 unless ($scanner->{'sender'})
884 1 0 unless ($scanner->{'def_spf_whitelist_from'})
889 0 1 if ($scanner->{'def_spf_whitelist_from'}) { }
890 0 0 if ($self->check_for_spf_pass($scanner)) { }
903 0 4 if (defined $scanner->{'conf'}{$param}{$scanner->{'sender'}}) { }
908 0 0 if ($scanner->{'sender'} =~ qr/$regexp/i)