Branch Coverage

blib/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
Criterion Covered Total %
branch 294 408 72.0


line true false branch
64 49 53 if ref $suppl_attrib
99 82 20 unless ($did_user_specify_trust and $did_user_specify_internal)
100 44 38 if (not $did_user_specify_trust || $did_user_specify_internal) { }
36 2 elsif (not $did_user_specify_internal) { }
131 344 4 unless $str and $str =~ /($IP_ADDRESS)/
142 0 71 if ($self->{'qmail_scanner_env_from'})
150 0 71 unless (defined $relay)
156 5 66 unless ($relay)
157 1 4 if $in_trusted
158 1 4 if $in_internal
164 0 66 if ($qms_env_from)
171 46 20 if ($in_trusted and not $found_msa)
172 37 9 if ($did_user_specify_trust or $did_user_specify_internal) { }
178 4 5 if ($relay->{'ip_private'})
185 0 9 if ($relay->{'auth'})
193 5 4 unless ($inferred_as_trusted)
201 7 30 if (not $relay->{'auth'} || $trusted->contains_ip($relay->{'ip'})) { }
202 7 0 if (not $originating) { }
209 0 0 !$in_internal ? :
214 6 24 if ($in_internal and not $relay->{'auth'} and not $internal->contains_ip($relay->{'ip'}))
218 3 27 if ($msa->contains_ip($relay->{'ip'}))
219 3 0 $in_trusted ? :
2 1 $in_internal ? :
232 37 29 $in_trusted ? :
30 36 $in_internal ? :
3 63 $relay->{'msa'} ? :
241 37 29 if ($in_trusted) { }
250 30 36 if ($in_internal) { }
274 102 0 if ($self->{'msg'}->can('delete_header'))
280 102 0 if ($self->{'msg'}->can('put_metadata'))
360 2 214 unless /^\(?from /i
364 0 214 if /\bwith local for\b/
369 1 213 if (/^from (\S+) by [^\s;]+ ?;/i and not $1 =~ /^\[[\d.]+\]$/)
388 112 101 if (/ id <?([^\s<>;]{3,})/)
392 9 204 if (m[\bhelo=([-A-Za-z0-9\.\^+_&:=?!\@%*\$\\/]+)(?:[^-A-Za-z0-9\.\^+_&:=?!\@%*\$\\/]|$)]) { }
17 187 elsif (m[\b(?:HELO|EHLO) ([-A-Za-z0-9\.\^+_&:=?!\@%*\$\\/]+)(?:[^-A-Za-z0-9\.\^+_&:=?!\@%*\$\\/]|$)]) { }
398 207 6 if (/ by (\S+)(?:[^-A-Za-z0-9\;\.]|$)/)
412 14 199 if (/ by / and / with ((?:ES|L|UTF8S|UTF8L)MTPS?A|ASMTP|HTTP[SU]?)(?: |;|$)/i) { }
0 199 elsif (/ by mx\.google\.com with ESMTPS id [a-z0-9]{1,4}sm[0-9]{2,9}[a-z]{3}\.[0-9]{1,3}\.[0-9]{4}\.(?:[0-6][0-9]\.){4}[0-6][0-9]/ and /\(version=([^ ]+) cipher=([^\)]+)\)/) { }
4 195 elsif (/^from .*?(?:\]\)|\)\]) \(AUTH: (LOGIN|PLAIN|DIGEST-MD5|CRAM-MD5) \S+(?:, .*?)?\) by /) { }
6 189 elsif (/authenticated/ and /^from .*?(?:\](?: \([^)]*\))?\)|\)\]) .*?\(.*?authenticated.*?\).*? by/) { }
1 188 elsif (/from \S* \((?:HELO|EHLO) (\S*)\) \[($IP_ADDRESS)\] by (mail\.gmx\.(?:net|com)) \([^\)]+\) with ((?:ESMTP|SMTP))/) { }
3 185 elsif (/ \(authenticated as / and /\) by .+ \(\d{1,2}\.\d\.\d{3}(?:\.\d{1,3})?\) \(authenticated as .+\) id /) { }
1 184 elsif (/\) \(Authenticated sender: \S+\) by \S+ \(([^\)]+)\) with /) { }
0 184 elsif (/CommuniGate Pro (HTTP|SMTP|XIMSS|IMAP)/ and / \(account /) { }
0 184 elsif (/ with Microsoft Exchange Server HTTP-DAV\b/) { }
1 189 elsif (/ by / and / \(via (HTTP.?)\)(?: |;|$)/i) { }
439 1 0 $1 eq 'Postfix' ? :
457 206 7 if (s/^from //) { }
2 5 elsif (s/^FROM //) { }
5 0 elsif (s/^\(from //) { }
459 6 200 if (/(?:return-path:? |envelope-(?:sender|from)[ =])(\S+)\b/i)
466 3 203 if (/ \((?:SquirrelMail|NaSMail) authenticated user /)
468 3 0 if (/($IP_ADDRESS)\b(?![.-]).{10,80}by (\S+) with HTTP/)
474 0 203 if (/aol\.com/ and /with HTTP \(WebMailUI\)/)
476 0 0 if (/($IP_ADDRESS) by (\S+) \($IP_ADDRESS\) with HTTP \(WebMailUI\)/)
482 7 196 if (/ SMTPSVC/) { }
0 196 elsif (/ with (?:Microsoft SMTP Server|mapi id) (?:\([^\)]+\) )?\d+\.\d+\.\d+\.\d+(?:$| )/) { }
2 194 elsif (/\[XMail /) { }
3 191 elsif (/\(ecelerity\b/) { }
11 180 elsif (/Exim/) { }
20 160 elsif (/ \(Postfix\) with/) { }
1 159 elsif (/\(Scalix SMTP Relay/) { }
0 159 elsif (/ \(Lotus Domino /) { }
495 5 2 if (/^(\S*) \(\[($IP_ADDRESS)\][^\)]{0,40}\) by (\S+) with Microsoft SMTPSVC/)
501 1 1 if (/^mail pickup service by (\S+) with Microsoft SMTPSVC$/)
516 0 0 if (/^(\S+) \(\[?($IP_ADDRESS)(?:%[A-Z0-9._~-]*)?\]?\) by (\S+) /)
524 2 0 if (/^(\S+) \((\[?$IP_ADDRESS\]?)(?::\d+)\) by (\S+)(?: \(\S+\))? with \[XMail/)
527 2 0 if / id <(\S+)>/
528 2 0 if / from <(\S+)>/
537 2 1 if (/^\(\[($IP_ADDRESS):\d+\] helo=(\S+)\) by (\S+) /)
542 1 0 if (/^\S+ \(\[($IP_ADDRESS):\d+\]\) by (\S+) /)
557 0 11 if (/\bwith local(?:-\S+)? /)
561 1 10 if (/^\[($IP_ADDRESS)\] \((.*?)\) by (\S+) /)
563 0 1 if $sub =~ s/helo=(\S+)//
564 0 1 if $sub =~ s/ident=(\S*)//
577 7 3 if (/^(\S+) \(\[($IP_ADDRESS)\](.*?)\) by (\S+) /)
580 5 2 if $sub =~ s/helo=(\S+)//
581 0 7 if $sub =~ s/ident=(\S*)//
588 0 3 if (/^(\S+) \[($IP_ADDRESS)\](:\d+)? by (\S+) /)
597 3 0 if (/^(\S+) /)
600 2 1 if (/ \((\S+)\) /)
603 1 2 if (/ \[($IP_ADDRESS)(?:\.\d+)?\] /)
606 3 0 if (/by (\S+) /)
610 1 2 if ($ip)
620 17 3 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\]\) by (\S+) /)
623 4 13 if ($rdns eq 'unknown')
631 0 3 if (/^(\S+) \((\S+)\[($IP_ADDRESS)\]\) by (\S+) /)
634 0 0 if ($rdns eq 'unknown')
641 1 0 if (/^(\S+) \( ?($IP_ADDRESS)\) by (\S+)/)
648 0 0 if (/^(\S+) \(\[($IP_ADDRESS)\]\) by (\S+) \(Lotus/)
657 0 165 if (/\bwith HTTP\b/ and /^($IP_ADDRESS) \(\[$IP_ADDRESS\]\) by (\S+)/)
669 164 1 unless (/ by \S+ \(qmail-\S+\) with /)
677 27 137 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\].*\) by (\S+) \(/)
680 0 27 if $rdns =~ s/^IDENT:([^\@]*)\@//
681 0 27 if $rdns =~ s/^([^\@]*)\@//
693 2 136 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\]\) by (\S+) with \S+ \(/)
699 0 136 if (/^(\S+) \(\[($IP_ADDRESS)\] helo=(\S+)\) by (\S+) with /)
705 0 136 if (/^(\S+) \(<unknown\S*>\[($IP_ADDRESS)\]\) by (\S+) /)
711 0 136 if (/^(\S+) \((\S+\.\S+)\[($IP_ADDRESS)\]\) by (\S+) /)
719 0 136 if (/^(\S+) \((\S*)\@\[($IP_ADDRESS)\].*\) by (\S+) \(/)
728 1 135 if (/by (\S+\.hotmail\.msn\.com) /)
730 1 0 if /^($IP_ADDRESS) /
737 0 135 if (m[^(\S+) \((?:HELO|EHLO) (\S*)\) \(($IP_ADDRESS)\) by (\S+) \(qpsmtpd/\S+\) with (?:ESMTP|SMTP)])
742 1 134 if (/^(\S+) \(LHLO (\S*)\) \(($IP_ADDRESS)\) by (\S+) with LMTP/)
747 1 133 if (/^(\S+) \((?:HELO|EHLO) (\S*)\) \[($IP_ADDRESS)\] by (\S+) \([^\)]+\) with (?:ESMTP|SMTP)/)
757 0 133 if (/^(\S+) \(\[($IP_ADDRESS)\]\) by (\S+) via smtpd \(for \S+\) with SMTP\(/)
791 54 79 if (/^\S+( \((?:HELO|EHLO) \S*\))? \((\S+\@)?\[?$IP_ADDRESS\]?\)( \(envelope-sender <\S+>\))? by \S+( \(.+\))* with (.* )?(SMTP|QMQP)(?! id )/)
792 4 50 if (/^(\S+) \((?:HELO|EHLO) ([^ \(\)]*)\) \((\S*)\@\[?($IP_ADDRESS)\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { }
7 43 elsif (/^(\S+) \((?:HELO|EHLO) ([^ \(\)]*)\) \(\[?($IP_ADDRESS)\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { }
4 39 elsif (/^(\S+) \((\S*)\@\[?($IP_ADDRESS)\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { }
39 0 elsif (/^(\S+) \(\[?($IP_ADDRESS)\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { }
811 49 5 if ($rdns ne 'unknown') { }
823 0 79 if (/ via HTTP$/ and /^\[($IP_ADDRESS)\] by (\S+) via HTTP$/)
828 0 79 if (/^(\S+) \( \[($IP_ADDRESS)\]\).*? by (\S+) /)
834 0 79 if (/^\((\S+) \[($IP_ADDRESS)\]\) by (\S+) /)
839 1 78 if (/^\[($IP_ADDRESS)\] by (\S+) /)
846 4 74 if (/^\(\[?($IP_ADDRESS)\]?\) by (\S+) /)
851 0 74 if (/^(\S+) \[($IP_ADDRESS)\] by (\S+) \[$IP_ADDRESS\] with /)
858 0 74 if (/^(\S+) \[\(($IP_ADDRESS)\)\] by (\S+) \($IP_ADDRESS\) /)
866 4 70 if (/^(\S+) \(\[($IP_ADDRESS)\]\) by (\S+) \(/)
875 4 66 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\]\).*? by (\S+)\b/)
876 1 3 if ($2 eq 'softdnserr') { }
887 6 60 if (/^(\S+) \(\[($IP_ADDRESS)(?:[.:]\d+)?\]\).*? by (\S+) /)
896 0 60 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\]\)(?: \(authenticated bits=\d+\))? by (\S+) \(/)
911 4 56 if (/with (?:POP3|IMAP)/)
920 1 55 if (/^(\S+) \((?:HELO|EHLO) ([^\)]*)\) \((\S*@)?\[?($IP_ADDRESS)\]?\).* by (\S+) /)
925 1 0 defined $3 ? :
928 1 0 if ($ident)
935 4 51 if (/^(\S+) \((\S*@)?\[?($IP_ADDRESS)\]?\).* by (\S+) /)
939 0 4 defined $2 ? :
941 0 4 if ($ident)
947 0 51 if (/ with http for / and /^\[($IP_ADDRESS)\] by (\S+) with http for /)
953 0 51 if (/ via smap / and /^(\S+)\(($IP_ADDRESS)\) by (\S+) via smap /)
960 0 51 if (/^(\S+)\(($IP_ADDRESS), (?:HELO|EHLO) (\S*)\) by (\S+) via smap /)
968 0 51 if (/ \(Post/ and /^\[($IP_ADDRESS)\] by (\S+) \(Post/)
974 0 51 if (/ \(ArGoSoft/ and /^\[($IP_ADDRESS)\] by (\S+) \(ArGoSoft/)
981 1 50 if (/^($IP_ADDRESS) by (\S+) \((?:SMTPL|InterScan)\b/)
987 0 50 if (/ with BSMTP/ and /^\S+ by \S+ with BSMTP/)
993 0 50 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\]\) by (\S+) with /)
1001 0 50 if (/^(\S+) \((?:HELO|EHLO) (\S*)\) \((?:(\S+)\@)?($IP_ADDRESS).*?\) by (\S+) with /)
1004 0 0 if defined $3
1011 7 43 if (/^\[($IP_ADDRESS)\] \((?:account \S+ )?(?:HELO|EHLO) (\S*)\) by (\S+) \(/)
1018 4 39 if (/ \(CommuniGate Pro/ and /^(\S+) \(\[($IP_ADDRESS)\] verified\) by (\S+) \(/)
1025 0 39 if (/^\(\[($IP_ADDRESS)\]\) by (\S+) with /)
1031 0 39 if (/^([^\d]\S+) \(($IP_ADDRESS)\) by (\S+) /)
1037 0 39 if (/^\S+ \(\S+\) by \S+ \(Content Technologies /)
1043 0 39 if (/^(\S+) \(\[($IP_ADDRESS)\] \[(\S+)\]\) by (\S+) with /)
1051 1 38 if (/^($IP_ADDRESS) by (\S+) with /)
1059 0 38 if (/^(\S+) \((\S+)\[($IP_ADDRESS)\]\) by (\S+) /)
1065 0 38 if (/^\[($IP_ADDRESS)\]\S+ \((?:HELO|EHLO) (\S*)\) by (\S+) /)
1070 0 38 if (/^($IP_ADDRESS) \((?:HELO|EHLO) (\S*)\) by (\S+) /)
1075 0 38 if (/^(\S+) \[($IP_ADDRESS)\] by (\S+) /)
1080 0 38 if (/^(\S+)\(($IP_ADDRESS)\) by (\S+) /)
1086 0 38 if (/^\[($IP_ADDRESS)\] by (\S+) \(MailGate /)
1091 0 38 if (/^(\S+) \(unverified \[($IP_ADDRESS)\]\) by (\S+) /)
1099 0 38 if (/^($IP_ADDRESS) \([A-Za-z][^\)]+\) by (\S+) with /)
1110 3 35 if (/^\[($IP_ADDRESS)\] \(([^\)]+)\) by (\S+) /)
1112 1 2 if $sub =~ s/helo=(\S+)//
1113 0 3 if $sub =~ s/ident=(\S*)//
1118 0 35 if (/^(\S+) \((?:\S+\@)?($IP_ADDRESS)\) by (\S+) with /)
1127 2 33 if (/^(\S+)\(($IP_ADDRESS)\)(?:, claiming to be "(\S+)")? via \S+ by (\S+),/)
1128 1 1 defined $3 ? :
1129 2 0 if ($1 ne 'UNKNOWN')
1138 0 33 if (/^(\S+) \((\S+)@($IP_ADDRESS) with login\) by (\S+\.yahoo\.com) with SMTP/)
1144 4 29 if (/^X-Originating-IP: ($IP_ADDRESS)$/)
1154 1 28 if (/^\S+ \([^\s\@]+\@$LOCALHOST\) by \S+ \(/)
1159 0 28 if (/^\S+ \S+ by \S+ with local-e?smtp /)
1162 0 28 if (/^127\.0\.0\.1 \(AVG SMTP \S+ \[\S+\]\)/)
1165 1 27 if (/^\S+\@\S+ by \S+ by uid \S+ /)
1168 1 26 if (/^\S+\@\S+ by \S+ /)
1171 0 26 if (m[^Unknown/Local \(])
1177 0 26 if (/^$LOCALHOST \((?:\S+\@)?${LOCALHOST}[\)\[]/)
1181 0 26 if (/^\S+ \((?:\S+\@)?$LOCALHOST\) /)
1184 0 26 if (/^\S+ \(\S+\@\S+ \[$LOCALHOST\]\) /)
1187 0 26 if (/^\(AUTH: \S+\) by \S+ with /)
1191 0 26 if (/^localhost \(localhost \[\[UNIX: localhost\]\]\) by /)
1195 0 26 if (/^\S+\.amazon\.com by \S+\.amazon\.com with ESMTP \(peer crosscheck: /)
1198 0 26 if (/^[^\.]+ by \S+ with Novell_GroupWise/)
1206 0 26 if (/^no\.name\.available by \S+ via smtpd \(for /)
1212 1 25 if (/^\S+ by \S+ \(.{0,100}\) with qmail-scanner/)
1221 0 25 if (/^\S+ by \S+ with local/)
1226 0 25 if (/^\S+ \(\[unix socket\]\) by \S+ \(Cyrus v[0-9]*?\.[0-9]*?\.[0-9]*?\) with LMTPA/)
1237 20 5 if (/^\S+ by \S+ (?:with|via|for|\()/)
1241 2 3 if (/^\S+ (?:(?:with|via|for) \S+|\(unverified\)) by\b/)
1244 1 2 if (/\(LSMTP for/)
1247 0 2 if (/^\(\[$LOCALHOST\]\) with MailEnable /)
1251 0 2 if (/^facebook\.com \([^\)]+\) by facebook\.com with Thrift id \S+$/)
1254 0 2 if (/^\S+ named \S+ by gmailapi\.google\.com with HTTPREST$/)
1257 0 2 if (/^\S+ id \S+$/)
1261 0 2 if (/^\[<.*? \(Jetsend/)
1265 1 1 if (not $helo and /^(\S+)[^-A-Za-z0-9\.]/)
1280 2 0 if (/^(\S+) \((\S+) \[($IP_ADDRESS)\]\) BY (\S+) (?:\([^\)]+\) WITH SMTP )?ID <?(\S+?)>?(?: FOR <[^>]+>)?$/)
1283 0 2 if $rdns eq 'unverified'
1295 1 4 if (/^(\S*) \[($IP_ADDRESS)\]\) by (\S+) \(NAVGW .*?\) with /)
1303 4 0 if (/^\S+\@localhost\) by \S+ /)
1306 0 0 if (/^[^\s\@]+\@[^)]+\) by \S+\(jqueuemail\) id [^\s;]+/)
1313 2 0 if (not $ip and /\[($IP_ADDRESS)\]/)
1320 2 0 if ($ip and $by)
1332 0 177 if ($ip eq '')
1348 1 176 if ($rdns =~ /^unknown$/i or $rdns =~ /^\[/)
1389 61 116 if ($rdns eq '')
1390 15 46 if ($mta_looked_up_dns) { }
1431 1 3 if ($self->{'allow_mailfetch_markers'}) { }