| 1 | package Sisimai::Reason::HostUnknown; | ||||||||||||||||||||
| 2 | 45 | ▶ | use v5.26; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 45 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 45 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 45 | ▶ | use Sisimai::Eb; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 45 | ▶ | use Sisimai::String; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 117 | ▶ | sub text { $Sisimai::Eb::ReHOST } | ||||||||||||||||||
|
Subroutine
text: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 9 | 4 | ▶ | sub description { "Delivery failed due to a domain part of a recipient's email address does not exist" } | ||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 10 | 829 | ▶ | 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 | 829 | my $class = shift; | |||||||||||||||||||
| 17 | 829 | ▶ | my $argv1 = shift // return 0; | ||||||||||||||||||
|
Condition100%2/2
shift() // (return 0)
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 828 | state $index = [ | |||||||||||||||||||
| 20 | "all host address lookups failed", # Exim/transports/smtp.c:3524 | ||||||||||||||||||||
| 21 | "couldn't find any host ", # qmail-remote.c:78 | ||||||||||||||||||||
| 22 | "dns server returned answer with no data", | ||||||||||||||||||||
| 23 | "domain is not reachable", | ||||||||||||||||||||
| 24 | "domain mentioned in email address is unknown", | ||||||||||||||||||||
| 25 | "domain must exist", | ||||||||||||||||||||
| 26 | "domain name not found", | ||||||||||||||||||||
| 27 | "host or domain name not found", | ||||||||||||||||||||
| 28 | "host unknown", | ||||||||||||||||||||
| 29 | "host unreachable", | ||||||||||||||||||||
| 30 | "illegal host/domain name found", | ||||||||||||||||||||
| 31 | "invalid domain name", # OpenSMTPD/smtpd/mta.c:976 | ||||||||||||||||||||
| 32 | "mx records point to non-existent hosts", # Exim/routers/dnslookup.c:331 | ||||||||||||||||||||
| 33 | "name or service not known", | ||||||||||||||||||||
| 34 | "no such domain", | ||||||||||||||||||||
| 35 | "recipient address rejected: unknown domain name", | ||||||||||||||||||||
| 36 | "responded with code nxdomain", | ||||||||||||||||||||
| 37 | "unknown host", | ||||||||||||||||||||
| 38 | ]; | ||||||||||||||||||||
| 39 | 828 | state $pairs = [ | |||||||||||||||||||
| 40 | ["domain ", "not exist"], | ||||||||||||||||||||
| 41 | ["host ", " not found"], | ||||||||||||||||||||
| 42 | ["unrout", "able ", "address"], | ||||||||||||||||||||
| 43 | ]; | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 828 | ▶ | return 1 if grep { rindex($argv1, $_) > -1 } @$index; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 46 | 779 | ▶ | return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | 753 | return 0; | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 895 | ▶ | sub true { | ||||||||||||||||||
|
Subroutine
true: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||
| 51 | # Whether the host is unknown or not | ||||||||||||||||||||
| 52 | # @param [Sisimai::Fact] argvs Object to be detected the reason | ||||||||||||||||||||
| 53 | # @return [Integer] 1: is unknown host | ||||||||||||||||||||
| 54 | # [Integer] 0: is not unknown host. | ||||||||||||||||||||
| 55 | # @since v4.0.0 | ||||||||||||||||||||
| 56 | # @see http://www.ietf.org/rfc/rfc2822.txt | ||||||||||||||||||||
| 57 | 895 | my $class = shift; | |||||||||||||||||||
| 58 | 895 | ▶ | my $argvs = shift // return 0; | ||||||||||||||||||
|
Condition100%2/2
shift() // (return 0)
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 894 | require Sisimai::SMTP::Command; | |||||||||||||||||||
| 61 | 894 | ▶ | return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReHOST; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 62 | 893 | ▶ | return 0 if grep { $argvs->{'command'} eq $_ } Sisimai::SMTP::Command->BeforeRCPT->@*; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 776 | ▶ | my $statuscode = $argvs->{'deliverystatus'} // ''; | ||||||||||||||||||
|
Condition50%1/2
$argvs->{"deliverystatus"} // ""
MC/DC0%0/1
$argvs->{"deliverystatus"} // ""
$argvs->{"deliverystatus"}
Truth table50%1/2
A
A= $argvs->{"deliverystatus"}
| |||||||||||||||||||||
| 65 | 776 | ▶ | my $issuedcode = lc $argvs->{'diagnosticcode'} // ''; | ||||||||||||||||||
|
Condition50%1/2
lc $argvs->{"diagnosticcode"} // ""
MC/DC0%0/1
lc $argvs->{"diagnosticcode"} // ""
lc $argvs->{"diagnosticcode"}
Truth table50%1/2
A
A= lc $argvs->{"diagnosticcode"}
| |||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 776 | ▶ | if( (Sisimai::SMTP::Status->name($statuscode) || '') eq $Sisimai::Eb::ReHOST ) { | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
'Sisimai::SMTP::Status'->name($statuscode) || ''
MC/DC100%1/1
'Sisimai::SMTP::Status'->name($statuscode) || ''
'Sisimai::SMTP::Status'->name($statuscode)
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->name($statuscode)
| |||||||||||||||||||||
| 68 | # To prevent classifying DNS errors as "HostUnknown" | ||||||||||||||||||||
| 69 | 51 | require Sisimai::Reason::NetworkError; | |||||||||||||||||||
| 70 | 51 | ▶ | return 1 unless Sisimai::Reason::NetworkError->match($issuedcode); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | } else { | ||||||||||||||||||||
| 73 | # Status: 5.1.2 | ||||||||||||||||||||
| 74 | # Diagnostic-Code: SMTP; 550 Host unknown | ||||||||||||||||||||
| 75 | 725 | return __PACKAGE__->match($issuedcode); | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | 5 | return 0; | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 45 | 1; | |||||||||||||||||||
| 81 | __END__ | ||||||||||||||||||||