Sisimai/Reason/Blocked.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 8 / 8 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 9 / 9 Podpod 50.0% 2 / 4 totaltotal 96.7% 59 / 61 CC 8 SCAR 11.0
CC
8
Cov
100%
true
5.0
match
4.0
BEGIN
1.0
CRAP 3.0
« Sisimai/Reason/AuthFailure.pm ↑ Summary Sisimai/Order.pm »
1 package Sisimai::Reason::Blocked;
2 55 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 55 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 55 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 55 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 55 ▶use Sisimai::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 101 ▶sub text { $Sisimai::Eb::ReBLOC }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
9 4 ▶sub description { 'Email rejected due to client IP address or a hostname' }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
10 1271 ▶sub match {
Subroutine match: called CC=4 SCAR=13.9
Pod documented
11 # Try to match that the given text and regular expressions
12 # @param [String] argv1 String to be matched with regular expressions
13 # @return [Integer] 0: Did not match
14 # 1: Matched
15 # @since v4.0.0
16 1271 my $class = shift;
17 1271 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
12701
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
18  
19 1270 state $index = [
20 "bad sender ip address",
21 "banned sending ip", # Office365
22 "blacklisted by",
23 "dnsbl:attrbl",
24 "client host rejected: abus detecte gu_eib_02", # SFR
25 "client host rejected: abus detecte gu_eib_04", # SFR
26 "client host rejected: may not be mail exchanger",
27 "connection refused by",
28 "currently sending spam see: ",
29 "domain does not exist:",
30 "domain isn't in my list of allowed rcpthosts",
31 "error: no valid recipients from ",
32 "esmtp not accepting connections", # icloud.com
33 "extreme bad ip profile",
34 "found on one or more dnsbls", # comcast.net
35 "helo command rejected:",
36 "host network not allowed",
37 "invalid ip for sending mail of domain",
38 "is in a black list",
39 "is not allowed to send mail from",
40 "no access from mail server",
41 "part of their network is on our block list",
42 "please use the smtp server of your isp",
43 "rejected because the sending mta or the sender has not passed validation",
44 "rejecting open proxy", # Sendmail(srvrsmtp.c)
45 "sender ip address rejected",
46 "server access forbidden by your ip ",
47 "smtp error from remote mail server after initial connection:", # Exim
48 "you are not allowed to connect",
49 "your ip address is listed in the rbl",
50 "your network is temporary blacklisted",
51 "your remotehost looks suspiciously like spammer",
52 "your server requires confirmation",
53 ];
54 1270 state $pairs = [
55 ["(", "@", ":blocked)"],
56 ["access from ip address ", " blocked"],
57 ["blocked by ", " dnsbl"],
58 ["client ", " blocked using"],
59 ["connection ", "dropped"],
60 ["client host ", " blocked using"],
61 ["connections will not be accepted from ", " because the ip is in spamhaus's list"],
62 ["dynamic", " ip"],
63 ["email blocked by ", ".barracudacentral.org"],
64 ["email blocked by ", "spamhaus"],
65 ["from ", " ip address"],
66 ["host ", " said: ", "550 blocked"],
67 ["host ", " refused to talk to me: ", " blocked"],
68 ["ip ", " is blocked by earthlink"], # Earthlink
69 ["is in an ", "rbl on "],
70 ["mail server at ", " is blocked"],
71 ["mail from "," refused"],
72 ["message from ", " rejected based on blacklist"],
73 ["messages from ", " temporarily deferred due to user complaints"], # Yahoo!
74 ["server ip ", " listed as abusive"],
75 ["sorry! your ip address", " is blocked by rbl"], # junkemailfilter.com
76 ["the ", " is blacklisted"], # the email, the domain, the ip
77 ["veuillez essayer plus tard. service refused, please try later. ", "103"],
78 ["veuillez essayer plus tard. service refused, please try later. ", "510"],
79 ["your access ip", " has been rejected"],
80 ["your sender's ip address is listed at ", ".abuseat.org"],
81 ];
82 1270 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 66 1204 1270
83 1204 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 35 1169 1204
84 1169 return 0;
85 }
86  
87 737 ▶sub true {
Subroutine true: called CC=5 SCAR=16.1
Pod undocumented
88 # Rejected due to client IP address or hostname
89 # @param [Sisimai::Fact] argvs Object to be detected the reason
90 # @return [Integer] 1: is Blocked
91 # [Integer] 0: is not Blocked by the client
92 # @see http://www.ietf.org/rfc/rfc2822.txt
93 # @since v4.0.0
94 737 my $class = shift;
95 737 ▶ my $argvs = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
7361
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
96  
97 736 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReBLOC;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReBLOC 1 735 736
98 735 ▶ return 1 if (Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || '') eq $Sisimai::Eb::ReBLOC;
Branch: 1 branch
BranchTrueFalseTotal
if ("Sisimai::SMTP::Status"->name($argvs->{"deliverystatus"}) || "") eq $Sisimai::Eb::ReBLOC 5 730 735
Condition100%2/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
l!l
298437
MC/DC100%1/1
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})
Aresult
11
00
99 730 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
100 }
101  
102 55 1;
103 __END__
« Sisimai/Reason/AuthFailure.pm ↑ Summary Sisimai/Order.pm »