| 1 | package Sisimai::LDA; | ||||||||||||||||||||||||||||
| 2 | 87 | ▶ | use v5.26; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 87 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 87 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 87 | ▶ | use Sisimai::Eb; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 87 | state $LocalAgent = { | |||||||||||||||||||||||||||
| 8 | # Each error message should be a lower-cased string | ||||||||||||||||||||||||||||
| 9 | # dovecot/src/deliver/deliver.c | ||||||||||||||||||||||||||||
| 10 | # 11: #define DEFAULT_MAIL_REJECTION_HUMAN_REASON \ | ||||||||||||||||||||||||||||
| 11 | # 12: "Your message to <%t> was automatically rejected:%n%r" | ||||||||||||||||||||||||||||
| 12 | "dovecot" => ["Your message to <", "> was automatically rejected:"], | ||||||||||||||||||||||||||||
| 13 | "mail.local" => ["mail.local: "], | ||||||||||||||||||||||||||||
| 14 | "procmail" => ["procmail: ", "/procmail "], | ||||||||||||||||||||||||||||
| 15 | "maildrop" => ["maildrop: "], | ||||||||||||||||||||||||||||
| 16 | "vpopmail" => ["vdelivermail: "], | ||||||||||||||||||||||||||||
| 17 | "vmailmgr" => ["vdeliver: "], | ||||||||||||||||||||||||||||
| 18 | }; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 87 | state $MessagesOf = { | |||||||||||||||||||||||||||
| 21 | # Each error message should be a lower-cased string | ||||||||||||||||||||||||||||
| 22 | "dovecot" => { | ||||||||||||||||||||||||||||
| 23 | # dovecot/src/deliver/mail-send.c:94 | ||||||||||||||||||||||||||||
| 24 | $Sisimai::Eb::ReFULL => [ | ||||||||||||||||||||||||||||
| 25 | "not enough disk space", | ||||||||||||||||||||||||||||
| 26 | "quota exceeded", # Dovecot 1.2 dovecot/src/plugins/quota/quota.c | ||||||||||||||||||||||||||||
| 27 | "quota exceeded (mailbox for user is full)", # dovecot/src/plugins/quota/quota.c | ||||||||||||||||||||||||||||
| 28 | ], | ||||||||||||||||||||||||||||
| 29 | $Sisimai::Eb::ReUSER => ["mailbox doesn't exist: "], | ||||||||||||||||||||||||||||
| 30 | }, | ||||||||||||||||||||||||||||
| 31 | "mail.local" => { | ||||||||||||||||||||||||||||
| 32 | $Sisimai::Eb::ReFULL => ["disc quota exceeded", "mailbox full or quota exceeded"], | ||||||||||||||||||||||||||||
| 33 | $Sisimai::Eb::RePROC => ["temporary file write error"], | ||||||||||||||||||||||||||||
| 34 | $Sisimai::Eb::ReUSER => [ | ||||||||||||||||||||||||||||
| 35 | ": invalid mailbox path", | ||||||||||||||||||||||||||||
| 36 | ": unknown user:", | ||||||||||||||||||||||||||||
| 37 | ": user missing home directory", | ||||||||||||||||||||||||||||
| 38 | ": user unknown", | ||||||||||||||||||||||||||||
| 39 | ], | ||||||||||||||||||||||||||||
| 40 | }, | ||||||||||||||||||||||||||||
| 41 | "procmail" => { | ||||||||||||||||||||||||||||
| 42 | $Sisimai::Eb::ReFULL => ["quota exceeded while writing", "user over quota"], | ||||||||||||||||||||||||||||
| 43 | $Sisimai::Eb::RePROC => ["service unavailable"], | ||||||||||||||||||||||||||||
| 44 | $Sisimai::Eb::ReDISK => ["no space left to finish writing"], | ||||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||
| 46 | "maildrop" => { | ||||||||||||||||||||||||||||
| 47 | $Sisimai::Eb::ReFULL => ["maildir over quota."], | ||||||||||||||||||||||||||||
| 48 | $Sisimai::Eb::ReUSER => ["invalid user specified.", "cannot find system user"], | ||||||||||||||||||||||||||||
| 49 | }, | ||||||||||||||||||||||||||||
| 50 | "vpopmail" => { | ||||||||||||||||||||||||||||
| 51 | $Sisimai::Eb::ReFILT => ["user does not exist, but will deliver to "], | ||||||||||||||||||||||||||||
| 52 | $Sisimai::Eb::ReFULL => ["domain is over quota", "user is over quota"], | ||||||||||||||||||||||||||||
| 53 | $Sisimai::Eb::ReQUIT => ["account is locked email bounced"], | ||||||||||||||||||||||||||||
| 54 | $Sisimai::Eb::ReUSER => ["sorry, no mailbox here by that name."], | ||||||||||||||||||||||||||||
| 55 | }, | ||||||||||||||||||||||||||||
| 56 | "vmailmgr" => { | ||||||||||||||||||||||||||||
| 57 | $Sisimai::Eb::ReFULL => ["delivery failed due to system quota violation"], | ||||||||||||||||||||||||||||
| 58 | $Sisimai::Eb::ReUSER => [ | ||||||||||||||||||||||||||||
| 59 | "invalid or unknown base user or domain", | ||||||||||||||||||||||||||||
| 60 | "invalid or unknown virtual user", | ||||||||||||||||||||||||||||
| 61 | "user name does not refer to a virtual user" | ||||||||||||||||||||||||||||
| 62 | ], | ||||||||||||||||||||||||||||
| 63 | }, | ||||||||||||||||||||||||||||
| 64 | }; | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 3373 | ▶ | sub find { | ||||||||||||||||||||||||||
|
Subroutine
find: called CC=11 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 67 | # Decode the message body and return a bounce reason detected by the error message of LDA | ||||||||||||||||||||||||||||
| 68 | # @param [Sisimai::Fact] argvs Decoded email object | ||||||||||||||||||||||||||||
| 69 | # @return [String] The value of bounce reason | ||||||||||||||||||||||||||||
| 70 | 3373 | my $class = shift; | |||||||||||||||||||||||||||
| 71 | 3373 | ▶ | my $argvs = shift // return ""; | ||||||||||||||||||||||||||
|
Condition100%2/2
shift() // (return "")
MC/DC100%1/1
shift() // (return "")
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 3372 | ▶ | return "" unless length $argvs->{"diagnosticcode"}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 3362 | ▶ | return "" unless $argvs->{"command"} eq "" || $argvs->{"command"} eq $Sisimai::Eb::CeDATA; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$argvs->{"command"} eq "" or $argvs->{"command"} eq $Sisimai::Eb::CeDATA
MC/DC100%2/2
$argvs->{"command"} eq "" or $argvs->{"command"} eq $Sisimai::Eb::CeDATA
$argvs->{"command"} eq ""
$argvs->{"command"} eq $Sisimai::Eb::CeDATA
Truth table100%3/3
A or B
A= $argvs->{"command"} eq ""B= $argvs->{"command"} eq $Sisimai::Eb::CeDATA
| |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 2355 | my $deliversby = ""; # [String] Local Delivery Agent name | |||||||||||||||||||||||||||
| 77 | 2355 | my $reasontext = ""; # [String] Detected bounce reason | |||||||||||||||||||||||||||
| 78 | 2355 | my $issuedcode = lc $argvs->{"diagnosticcode"}; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 2355 | for my $e ( keys %$LocalAgent ) { | |||||||||||||||||||||||||||
| 81 | # Find a local delivery agent name from the lower-cased error message | ||||||||||||||||||||||||||||
| 82 | 14060 | ▶ | next unless grep { index($issuedcode, $_) > -1 } $LocalAgent->{ $e }->@*; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 37 | $deliversby = $e; last; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | 2355 | ▶ | return "" unless $deliversby; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 37 | for my $e ( keys $MessagesOf->{ $deliversby }->%* ) { | |||||||||||||||||||||||||||
| 88 | # The key nane is a bounce reason name | ||||||||||||||||||||||||||||
| 89 | 82 | ▶ | next unless grep { index($issuedcode, $_) > -1 } $MessagesOf->{ $deliversby }->{ $e }->@*; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 25 | $reasontext = $e; last; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 37 | ▶ | $reasontext ||= $Sisimai::Eb::ReUNIX; # procmail: Couldn't create "/var/mail/tmp.nekochan.22" | ||||||||||||||||||||||||||
|
Condition66%2/3
$reasontext ||= $Sisimai::Eb::ReUNIX
MC/DC0%0/2
$reasontext ||= $Sisimai::Eb::ReUNIX
$reasontext
$Sisimai::Eb::ReUNIX
Truth table66%2/3
A ||= B
A= $reasontextB= $Sisimai::Eb::ReUNIX
| |||||||||||||||||||||||||||||
| 94 | 37 | return $reasontext; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 87 | 1; | |||||||||||||||||||||||||||
| 98 | __END__ | ||||||||||||||||||||||||||||