File Coverage

lib/Sisimai/Reason/SecurityError.pm
Criterion Covered Total %
statement 23 23 100.0
branch 3 4 75.0
condition 2 2 100.0
subroutine 8 8 100.0
pod 2 4 50.0
total 38 41 92.6


line stmt bran cond sub pod time code
1             package Sisimai::Reason::SecurityError;
2 34     34   2662 use v5.26;
  34         93  
3 34     34   148 use strict;
  34         73  
  34         734  
4 34     34   123 use warnings;
  34         87  
  34         1560  
5 34     34   174 use Sisimai::String;
  34         52  
  34         6931  
6              
7 1     1 1 16 sub text { 'securityerror' }
8 4     4 0 43 sub description { 'Email rejected due to security violation was detected on a destination host' }
9             sub match {
10             # Try to match that the given text and regular expressions
11             # @param [String] argv1 String to be matched with regular expressions
12             # @return [Integer] 0: Did not match
13             # 1: Matched
14             # @since v4.0.0
15 448     448 1 1469 my $class = shift;
16 448   100     1027 my $argv1 = shift // return 0;
17              
18 447         539 state $index = [
19             "account not subscribed to ses",
20             "authentication credentials invalid",
21             "authentication failure",
22             "authentication required",
23             "authentication turned on in your email client",
24             "could not retrieve credentials", # OpenSMTPD/smtpd/mta.c
25             "unauthenticated senders not allowed",
26             "verification failure",
27             "you are not authorized to send mail, authentication is required",
28             "you don't authenticate or the domain isn't in my list of allowed rcpthosts",
29             ];
30 447         673 state $pairs = [
31             ["authentication failed; server ", " said: "], # Postfix
32             ["authentification invalide", "305"],
33             ["authentification requise", "402"],
34             ["user ", " is not authorized to perform ses:sendrawemail on resource"],
35             ];
36              
37 447 100       724 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  4470         5850  
38 436 50       706 return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
  1744         2520  
39 436         846 return 0;
40             }
41              
42             sub true {
43             # The bounce reason is security error or not
44             # @param [Sisimai::Fact] argvs Object to be detected the reason
45             # @return [Integer] 1: is security error
46             # 0: is not security error
47             # @see http://www.ietf.org/rfc/rfc2822.txt
48 2     2 0 10 return 0;
49             }
50              
51             1;
52             __END__