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 eq 'ALL' or $header =~ /:raw$/
271 0 0 if not defined $str or $str eq ''
274 0 0 if ($header eq 'ALL')
285 0 0 if ($illegal > 0 and lc $header eq 'subject:raw')
288 0 0 if $exempt == 1
291 0 0 if $str eq ''
301 0 0 if (defined $txt and $txt =~ /^contact \S+\@\S+\; run by ezmlm$/)
306 0 0 if ($dlto =~ /^mailing list \S+\@\S+/ and $rcvd =~ /qmail \d+ invoked (?:from network|by .{3,20})\); \d+ ... \d+/)
314 0 0 unless (defined $rcvd)
320 0 0 if ($rcvd =~ /from groups\.msn\.com \(\S+\.msn\.com /)
331 0 0 if (defined $pms->{'hotmail_addr_but_no_hotmail_received'})
339 0 0 if $rcvd =~ /from mail pickup service by hotmail\.com with Microsoft SMTPSVC;/
343 0 0 if $self->check_for_msn_groups_headers($pms)
350 0 0 if (defined $ip and $ip =~ /$IP_ADDRESS/) { }
351 0 0 if (defined $orig and $orig =~ /$ORIGINATOR/) { }
359 0 0 if ($self->gated_through_received_hdr_remover($pms))
361 0 0 if ($rcvd =~ /from (?:\S*\.)?hotmail.com \(\S+\.hotmail(?:\.msn)?\.com[ \)]/ and $ip)
363 0 0 if ($rcvd =~ /from \S*\.outbound\.protection\.outlook\.com \(\S+\.outbound\.protection\.outlook\.com[ \)]/ and $orig)
365 0 0 if ($rcvd =~ /from \S*\.hotmail.com \(\[$IP_ADDRESS\][ \):]/ and $ip)
367 0 0 if ($rcvd =~ /from \S+ by \S+\.hotmail(?:\.msn)?\.com with HTTP\;/ and $ip)
369 0 0 if ($rcvd =~ /from \[66\.218.\S+\] by \S+\.yahoo\.com/ and $ip)
372 0 0 if ($rcvd =~ /(?:from |HELO |helo=)\S*hotmail\.com\b/) { }
378 0 0 unless ($from =~ /\bhotmail\.com$/i)
402 0 0 unless $to =~ /<(\S+)\@groups\.msn\.com>/i
408 0 0 unless $pms->get('Received') =~ /from mail pickup service by ((?:p\d\d\.)groups\.msn\.com)\b/
412 0 0 if ($listname =~ /^notifications$/) { }
413 0 0 unless $pms->get('Message-Id') =~ /^<\S+\@$server>/
415 0 0 unless $pms->get('Message-Id') =~ /^<$listname-\S+\@groups\.msn\.com>/
416 0 0 unless $pms->get('EnvelopeFrom:addr') =~ /$listname-bounce\@groups\.msn\.com/
469 0 0 unless ($from =~ /\beudoramail\.com$/i)
476 0 0 if (defined $ip and $ip =~ /$IP_ADDRESS/) { }
486 0 0 if ($self->gated_through_received_hdr_remover($pms))
488 0 0 if ($rcvd =~ /by \S*whowhere.com\;/ and $ip)
499 77 0 unless ($from =~ /\byahoo\.com$/i)
503 0 0 if ($pms->get('Resent-From') ne '' and $pms->get('Resent-To') ne '')
505 0 0 if $xrcvd ne ''
512 0 0 if ($self->gated_through_received_hdr_remover($pms))
521 0 0 if ($pms->{'relays_trusted_str'} =~ / rdns=\S+\.yahoo\.com / or $pms->{'relays_untrusted_str'} =~ /^[^\]]+ rdns=\S+\.yahoo\.com /)
525 0 0 if ($rcvd =~ /by web\S+\.mail\S*\.yahoo\.com via HTTP/)
526 0 0 if ($rcvd =~ /by smtp\S+\.yahoo\.com with SMTP/)
528 0 0 if ($rcvd =~ /from \[$IP_ADDRESS\] by \S+\.(?:groups|scd|dcn)\.yahoo\.com with NNFMP/)
541 0 0 if ($rcvd =~ /\bmailer\d+\.bulk\.scd\.yahoo\.com\b/ and $from =~ /\@reply\.yahoo\.com$/i)
544 0 0 if ($rcvd =~ m[by \w+\.\w+\.yahoo\.com \(\d+\.\d+\.\d+/\d+\.\d+\.\d+\)(?: with ESMTP)? id \w+])
556 0 0 unless ($from =~ /\bjuno\.com$/i)
558 0 0 if ($self->gated_through_received_hdr_remover($pms))
565 0 0 if ($xorig ne '') { }
567 0 0 unless ($rcvd =~ /from.*\b(?:juno|untd)\.com.*[\[\(]${IP_ADDRESS}[\]\)].*by/ or $rcvd =~ / cookie\.(?:juno|untd)\.com /)
569 0 0 unless ($xmailer =~ /Juno /)
571 0 0 if ($rcvd =~ /from.*\bmail\.com.*\[$IP_ADDRESS\].*by/) { }
0 0 elsif ($rcvd =~ /from (webmail\S+\.untd\.com) \(\1 \[$IP_ADDRESS\]\) by/) { }
572 0 0 unless ($xmailer =~ /\bmail\.com/)
574 0 0 unless ($xmailer =~ /^Webmail Version \d/)
578 0 0 unless ($xorig =~ /$IP_ADDRESS/)
590 0 0 unless ($from =~ /\bgmail\.com$/i)
597 0 0 if ($xreceived =~ /by 10\.\S+ with SMTP id \S+/)
598 0 0 if ($xreceived =~ /by 2002\:\w\:\S+ with SMTP id \S+/)
599 0 0 if ($received =~ /by smtp\.googlemail\.com with ESMTPSA id \S+/)
602 0 0 if (length $xgms >= 60 and length $xss >= 60)
619 36 41 unless (exists $pms->{'tocc_sorted'})
628 41 36 unless (exists $pms->{'tocc_similar'})
650 1 152 if scalar @inputs >= 5
657 52 0 if lc $current ne lc $previous
658 0 52 if @address == 256
670 1 76 if (scalar @address >= 5)
678 62 1066 if $user[$i] eq $user[$j]
679 303 825 if $host[$i] eq $host[$j] and $fqhn[$i] ne $fqhn[$j]
691 0 0 if $hdr eq ''
692 0 0 if $hdr eq ''
709 0 0 if (defined $h1 and defined $h2 and not $h2 =~ /\./)
721 0 0 unless (exists $pms->{'date_diff'})
732 0 0 unless (exists $pms->{'date_received'})
739 0 0 if (!defined($min) || $min eq 'undef' || $diff >= 31556952 * ($min / 12) and !defined($max) || $max eq 'undef' || $diff < 31556952 * ($max / 12)) { }
757 0 0 if (defined $date and length $date)
761 0 0 if defined $time
764 0 0 if (defined $time) { }
780 0 0 if ($received ne '')
785 0 0 unless (scalar @received)
791 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+/)
796 0 0 if (scalar @received and $received[0] =~ /\bby localhost with \w+ \(fetchmail-[\d.]+/) { }
0 0 elsif (scalar @local) { }
804 0 0 if (scalar @local)
807 0 0 if ($rcvd =~ /(\s.?\d+ \S\S\S \d+ \d+:\d+:\d+ \S+)/)
811 0 0 if (defined $time and time >= $time)
817 0 0 if (scalar @fetchmail_times > 1) { }
0 0 elsif (scalar @fetchmail_times) { }
827 0 0 if ($rcvd =~ /(\s.?\d+ \S\S\S \d+ \d+:\d+:\d+ \S+)/)
831 0 0 if (defined $time)
838 0 0 if (scalar @header_times) { }
852 0 0 unless (exists $pms->{'date_header_time'})
856 0 0 if (defined $pms->{'date_header_time'})
860 0 0 unless (exists $pms->{'received_header_times'})
864 0 0 if (scalar @received_header_times)
867 0 0 if (defined $pms->{'received_fetchmail_time'})
871 0 0 if (defined $pms->{'date_header_time'} and scalar @received_header_times)
872 0 0 unless (exists $pms->{'date_diff'})
878 0 0 if (scalar @dates_poss) { }
893 0 0 unless (exists $pms->{'date_header_time'})
897 0 0 unless (defined $pms->{'date_header_time'})
901 0 0 unless (exists $pms->{'received_header_times'})
906 0 0 unless (scalar @header_times)
914 0 0 if ($#diffs > 0 and $diffs[$#diffs] == 0)
932 0 0 unless $subject =~ /\s/
933 0 0 if length $subject < 10
941 0 0 if ($subjraw =~ /=\?$CLTFAC\?/i)
952 0 0 unless $full_to ne ''
956 0 0 if ($test eq 'address') { }
0 0 elsif ($test eq 'user') { }
981 76 1 unless $id =~ /^<[0-9a-f]{4}([0-9a-f]{8})\$[0-9a-f]{8}\$[0-9a-f]{8}\@/
993 0 1 if abs $diff < $fudge
1010 0 0 if /<mailto:(?:leave-\S+|\S+-unsubscribe)\@\S+>$/i
1013 0 0 if ($self->gated_through_received_hdr_remover($pms))
1017 0 0 if m[/CWT/DCE\)]
1020 0 0 if /iPlanet Messaging Server/
1041 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)
1055 0 0 if ($mid =~ /<[A-Z]{28}\.([^>]+?)>/)
1056 0 0 if ($from =~ /\"[^\"]+\"\s*<\Q$1\E>/)
1069 0 0 if $from eq '' or $to eq ''
1070 0 0 if $from =~ /^SRS\d=/
1072 0 0 if ($to =~ /^([^\@]+)@(.+)$/)
1076 0 0 unless $self->{'main'}{'registryboundaries'}->is_domain_valid($dom)
1078 0 0 if $from =~ /\b\Q$dom\E.\Q$user\E@/i
1094 0 0 if $from =~ /\@([^\@]*)\z/
1096 0 0 if $fromdomain eq ''
1099 0 0 if $envfrom =~ /\@([^\@]*)\z/
1101 0 0 if $envfromdomain eq ''
1105 0 0 if lc $fromdomain ne lc $envfromdomain
1115 0 0 if (would_log('dbg', 'eval') == 2)