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 21     21   2660 use v5.26;
  21         75  
3 21     21   107 use strict;
  21         69  
  21         533  
4 21     21   101 use warnings;
  21         45  
  21         1014  
5 21     21   111 use Sisimai::String;
  21         44  
  21         5266  
6              
7 1     1 1 7 sub text { 'securityerror' }
8 4     4 0 18 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 267     267 1 1149 my $class = shift;
16 267   100     941 my $argv1 = shift // return 0;
17              
18 266         627 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             "unauthenticated senders not allowed",
25             "verification failure",
26             "you are not authorized to send mail, authentication is required",
27             "you don't authenticate or the domain isn't in my list of allowed rcpthosts",
28             ];
29 266         554 state $pairs = [
30             ["authentication failed; server ", " said: "], # Postfix
31             ["authentification invalide", "305"],
32             ["authentification requise", "402"],
33             ["user ", " is not authorized to perform ses:sendrawemail on resource"],
34             ];
35              
36 266 100       603 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  2394         4471  
37 255 50       1134 return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
  1020         2169  
38 255         814 return 0;
39             }
40              
41             sub true {
42             # The bounce reason is security error or not
43             # @param [Sisimai::Fact] argvs Object to be detected the reason
44             # @return [Integer] 1: is security error
45             # 0: is not security error
46             # @see http://www.ietf.org/rfc/rfc2822.txt
47 2     2 0 9 return 0;
48             }
49              
50             1;
51             __END__