Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/HeaderEval.pm
Criterion Covered Total %
branch 25 294 8.5


line true false branch
95 0 0 if (/ rly-[a-z][a-z]\d\d\./i)
96 0 0 if m[/AOL-\d+\.\d+\.\d+\)]
97 0 0 if /ESMTP id (?:RELAY|MAILRELAY|MAILIN)/
122 0 0 if grep {$_ eq 'all';} @locales
126 0 0 if ($#hdrs >= 0) { }
132 0 0 unless Mail::SpamAssassin::Locales::is_charset_ok_for_locales($1, @locales)
146 0 0 if (/[-_\.\s]{7,}([-a-z0-9]{4,})$/ or /\s{10,}(?:\S\s)?(\S+)$/ or /\s{3,}[-:\#\(\[]+([-a-z0-9]{4,})[\]\)]+$/ or /\s{3,}[:\#\(\[]*([a-f0-9]{4,})[\]\)]*$/ or /\s{3,}[-:\#]([a-z0-9]{5,})$/ or /[\s._]{3,}([^0\s._]\d{3,})$/ or /[\s._]{3,}\[(\S+)\]$/ or /\(([-\w]{7,}\@\d+)\)$/ or /\b(\d{7,})\s*$/ or /[!\?]\s*(\d{4,}|\w+(-\w+)+)\s*$/ or /(?:\w{2,3}:\s)?\w+\s+(\w{7,}-\w{7,}(-\w+)*)\s*$/ or /\s#\s*([a-f0-9]{4,})\s*$/)
173 0 0 if ($id =~ /\d{5,}/ and /(?:item|invoice|order|number|confirmation).{1,6}\Q$id\E\s*$/)
208 0 2 if $word =~ /[^a-z\']/
211 0 2 if $word eq 'ot'
212 0 2 if $word =~ /(?:linux|nix|bsd)/
213 0 2 if $word =~ /(?:whew|phew|attn|tha?nx)/
218 0 2 if $word_len < 3
220 2 0 unless ($triplets_loaded)
226 2 0 unless (defined $filename)
232 0 0 unless (open TRIPLETS, "<$filename")
240 0 0 $! == 9 ? :
0 0 unless defined $_ or $! == 0
243 0 0 unless close TRIPLETS
253 0 0 unless ($triplets{$triplet})
269 0 0 unless $header =~ /:raw$/
271 0 0 if not defined $str or $str eq ''
278 0 0 if ($illegal > 0 and lc $header eq 'subject:raw')
281 0 0 if $exempt == 1
284 0 0 if $str eq ''
294 0 0 if (defined $txt and $txt =~ /^contact \S+\@\S+\; run by ezmlm$/)
299 0 0 if ($dlto =~ /^mailing list \S+\@\S+/ and $rcvd =~ /qmail \d+ invoked (?:from network|by .{3,20})\); \d+ ... \d+/)
307 0 0 unless (defined $rcvd)
313 0 0 if ($rcvd =~ /from groups\.msn\.com \(\S+\.msn\.com /)
324 0 0 if (defined $pms->{'hotmail_addr_but_no_hotmail_received'})
332 0 0 if $rcvd =~ /from mail pickup service by hotmail\.com with Microsoft SMTPSVC;/
336 0 0 if $self->check_for_msn_groups_headers($pms)
343 0 0 if (defined $ip and $ip =~ /$IP_ADDRESS/) { }
344 0 0 if (defined $orig and $orig =~ /$ORIGINATOR/) { }
352 0 0 if ($self->gated_through_received_hdr_remover($pms))
354 0 0 if ($rcvd =~ /from (?:\S*\.)?hotmail.com \(\S+\.hotmail(?:\.msn)?\.com[ \)]/ and $ip)
356 0 0 if ($rcvd =~ /from \S*\.outbound\.protection\.outlook\.com \(\S+\.outbound\.protection\.outlook\.com[ \)]/ and $orig)
358 0 0 if ($rcvd =~ /from \S*\.hotmail.com \(\[$IP_ADDRESS\][ \):]/ and $ip)
360 0 0 if ($rcvd =~ /from \S+ by \S+\.hotmail(?:\.msn)?\.com with HTTP\;/ and $ip)
362 0 0 if ($rcvd =~ /from \[66\.218.\S+\] by \S+\.yahoo\.com/ and $ip)
365 0 0 if ($rcvd =~ /(?:from |HELO |helo=)\S*hotmail\.com\b/) { }
371 0 0 unless ($from =~ /\bhotmail\.com$/i)
395 0 0 unless $to =~ /<(\S+)\@groups\.msn\.com>/i
401 0 0 unless $pms->get('Received') =~ /from mail pickup service by ((?:p\d\d\.)groups\.msn\.com)\b/
405 0 0 if ($listname =~ /^notifications$/) { }
406 0 0 unless $pms->get('Message-Id') =~ /^<\S+\@$server>/
408 0 0 unless $pms->get('Message-Id') =~ /^<$listname-\S+\@groups\.msn\.com>/
409 0 0 unless $pms->get('EnvelopeFrom:addr') =~ /$listname-bounce\@groups\.msn\.com/
462 0 0 unless ($from =~ /\beudoramail\.com$/i)
469 0 0 if (defined $ip and $ip =~ /$IP_ADDRESS/) { }
479 0 0 if ($self->gated_through_received_hdr_remover($pms))
481 0 0 if ($rcvd =~ /by \S*whowhere.com\;/ and $ip)
492 81 0 unless ($from =~ /\byahoo\.com$/i)
496 0 0 if ($pms->get('Resent-From') ne '' and $pms->get('Resent-To') ne '')
498 0 0 if $xrcvd ne ''
505 0 0 if ($self->gated_through_received_hdr_remover($pms))
514 0 0 if ($pms->{'relays_trusted_str'} =~ / rdns=\S+\.yahoo\.com / or $pms->{'relays_untrusted_str'} =~ /^[^\]]+ rdns=\S+\.yahoo\.com /)
518 0 0 if ($rcvd =~ /by web\S+\.mail\S*\.yahoo\.com via HTTP/)
519 0 0 if ($rcvd =~ /by sonic\S+\.consmr\.mail\S*\.yahoo\.com with HTTP/)
520 0 0 if ($rcvd =~ /by smtp\S+\.yahoo\.com with SMTP/)
522 0 0 if ($rcvd =~ /from \[$IP_ADDRESS\] by \S+\.(?:groups|scd|dcn)\.yahoo\.com with NNFMP/)
535 0 0 if ($rcvd =~ /\bmailer\d+\.bulk\.scd\.yahoo\.com\b/ and $from =~ /\@reply\.yahoo\.com$/i)
538 0 0 if ($rcvd =~ m[by \w+\.\w+\.yahoo\.com \(\d+\.\d+\.\d+/\d+\.\d+\.\d+\)(?: with ESMTP)? id \w+])
550 0 0 unless ($from =~ /\bjuno\.com$/i)
552 0 0 if ($self->gated_through_received_hdr_remover($pms))
559 0 0 if ($xorig ne '') { }
561 0 0 unless ($rcvd =~ /from.*\b(?:juno|untd)\.com.*[\[\(]${IP_ADDRESS}[\]\)].*by/ or $rcvd =~ / cookie\.(?:juno|untd)\.com /)
563 0 0 unless ($xmailer =~ /Juno /)
565 0 0 if ($rcvd =~ /from.*\bmail\.com.*\[$IP_ADDRESS\].*by/) { }
0 0 elsif ($rcvd =~ /from (webmail\S+\.untd\.com) \(\1 \[$IP_ADDRESS\]\) by/) { }
566 0 0 unless ($xmailer =~ /\bmail\.com/)
568 0 0 unless ($xmailer =~ /^Webmail Version \d/)
572 0 0 unless ($xorig =~ /$IP_ADDRESS/)
584 0 0 unless ($from =~ /\bgmail\.com$/i)
591 0 0 if ($xreceived =~ /by 10\.\S+ with SMTP id \S+/)
592 0 0 if ($xreceived =~ /by 2002\:a\d\d\:\w+\:\S+ with SMTP id \S+/)
593 0 0 if ($received =~ /by smtp\.googlemail\.com with ESMTPSA id \S+/)
596 0 0 if (length $xgms >= 60 and length $xss >= 60)
613 39 42 unless (exists $pms->{'tocc_sorted'})
622 42 39 unless (exists $pms->{'tocc_similar'})
644 1 160 if scalar @inputs >= 5
651 55 0 if lc $current ne lc $previous
652 0 55 if @address == 256
664 1 80 if (scalar @address >= 5)
672 62 1066 if $user[$i] eq $user[$j]
673 303 825 if $host[$i] eq $host[$j] and $fqhn[$i] ne $fqhn[$j]
685 0 0 if $hdr eq ''
686 0 0 if $hdr eq ''
703 0 0 if (defined $h1 and defined $h2 and not $h2 =~ /\./)
715 0 0 unless (exists $pms->{'date_diff'})
726 0 0 unless (exists $pms->{'date_received'})
733 0 0 if (!defined($min) || $min eq 'undef' || $diff >= 31556952 * ($min / 12) and !defined($max) || $max eq 'undef' || $diff < 31556952 * ($max / 12)) { }
751 0 0 if (defined $date and length $date)
755 0 0 if defined $time
758 0 0 if (defined $time) { }
774 0 0 if ($received ne '')
779 0 0 unless (scalar @received)
785 0 0 if ($received[0] =~ /\bfrom (?:localhost\s|(?:\S+ ){1,2}\S*\b127\.0\.0\.1\b)/ or $received[0] =~ /qmail \d+ invoked by uid \d+/)
790 0 0 if (scalar @received and $received[0] =~ /\bby localhost with \w+ \(fetchmail-[\d.]+/) { }
0 0 elsif (scalar @local) { }
798 0 0 if (scalar @local)
801 0 0 if ($rcvd =~ /(\s.?\d+ \S\S\S \d+ \d+:\d+:\d+ \S+)/)
805 0 0 if (defined $time and time >= $time)
811 0 0 if (scalar @fetchmail_times > 1) { }
0 0 elsif (scalar @fetchmail_times) { }
821 0 0 if ($rcvd =~ /(\s.?\d+ \S\S\S \d+ \d+:\d+:\d+ \S+)/)
825 0 0 if (defined $time)
832 0 0 if (scalar @header_times) { }
846 0 0 unless (exists $pms->{'date_header_time'})
850 0 0 if (defined $pms->{'date_header_time'})
854 0 0 unless (exists $pms->{'received_header_times'})
858 0 0 if (scalar @received_header_times)
861 0 0 if (defined $pms->{'received_fetchmail_time'})
865 0 0 if (defined $pms->{'date_header_time'} and scalar @received_header_times)
866 0 0 unless (exists $pms->{'date_diff'})
872 0 0 if (scalar @dates_poss) { }
887 0 0 unless (exists $pms->{'date_header_time'})
891 0 0 unless (defined $pms->{'date_header_time'})
895 0 0 unless (exists $pms->{'received_header_times'})
900 0 0 unless (scalar @header_times)
908 0 0 if ($#diffs > 0 and $diffs[$#diffs] == 0)
926 0 0 unless $subject =~ /\s/
927 0 0 if length $subject < 10
935 0 0 if ($subjraw =~ /=\?$CLTFAC\?/i)
946 0 0 unless $full_to ne ''
950 0 0 if ($test eq 'address') { }
0 0 elsif ($test eq 'user') { }
975 80 1 unless $id =~ /^<[0-9a-f]{4}([0-9a-f]{8})\$[0-9a-f]{8}\$[0-9a-f]{8}\@/
987 0 1 if abs $diff < $fudge
1004 0 0 if /<mailto:(?:leave-\S+|\S+-unsubscribe)\@\S+>$/i
1007 0 0 if ($self->gated_through_received_hdr_remover($pms))
1011 0 0 if m[/CWT/DCE\)]
1014 0 0 if /iPlanet Messaging Server/
1034 0 0 if ($header =~ /%[A-Z][A-Z_-]/ and not $header =~ /^(?:X-VMS-To|X-UIDL|X-Face|To|Cc|From|Subject|References|In-Reply-To|(?:X-|Resent-|X-Original-)?Message-Id):/i)
1048 0 0 if ($mid =~ /<[A-Z]{28}\.([^>]+?)>/)
1049 0 0 if ($from =~ /\"[^\"]+\"\s*<\Q$1\E>/)
1062 0 0 if $from eq '' or $to eq ''
1063 0 0 if $from =~ /^SRS\d[=+-]/i
1065 0 0 if ($to =~ /^([^\@]+)\@(.+)$/)
1069 0 0 unless $self->{'main'}{'registryboundaries'}->is_domain_valid($dom)
1071 0 0 if $from =~ /\b\Q$dom\E.\Q$user\E@/i
1087 0 0 if $from =~ /\@([^\@]*)\z/
1089 0 0 if $fromdomain eq ''
1092 0 0 if $envfrom =~ /\@([^\@]*)\z/
1094 0 0 if $envfromdomain eq ''
1098 0 0 if lc $fromdomain ne lc $envfromdomain
1108 0 0 if (would_log('dbg', 'eval') == 2)