Skip to content

Commit

Permalink
Remove some .+ from regular expressions #411 #412 #413
Browse files Browse the repository at this point in the history
  • Loading branch information
azumakuniyuki committed Sep 27, 2020
1 parent 9970f89 commit cb961cb
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 29 deletions.
10 changes: 6 additions & 4 deletions lib/Sisimai/ARF.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ sub make {
state $startingof = { 'rfc822' => ['Content-Type: message/rfc822', 'Content-Type: text/rfc822-headers'] };
state $markingsof = {
'message' => qr{\A(?>
[Tt]his[ ]is[ ].+[ ]email[ ]abuse[ ]report
[Tt]his[ ]is[ ]a[ ][^ ]+[ ]email[ ]abuse[ ]report
|[Tt]his[ ]is[ ]an[ ]email[ ]abuse[ ]report
|[Tt]his[ ]is[ ](?:
an[ ]autogenerated[ ]email[ ]abuse[ ]complaint
|an?[ ].+[ ]report[ ]for
|a[ ].+[ ]authentication[ -]failure[ ]report[ ]for
a[ ][^ ]+[ ]authentication[ -]failure[ ]report
|an[ ]authentication[ -]failure[ ]report
|an[ ]autogenerated[ ]email[ ]abuse[ ]complaint
|an?[ ][^ ]+[ ]report[ ]for
)
)
}x,
Expand Down
2 changes: 1 addition & 1 deletion lib/Sisimai/Lhost/Exchange2007.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sub make {
'error' => qr/[ ]((?:RESOLVER|QUEUE)[.][A-Za-z]+(?:[.]\w+)?);/,
'rhost' => qr{\A(?:
Generating[ ]server # en-US
|Serveur[ ]de[ ]g.+ration[ ] # fr-FR/Serveur de génération
|Serveur[ ]de[ ]g[^ ]+ration[ ] # fr-FR/Serveur de génération
|Server[ ]di[ ]generazione # it-CH
):[ ]?(.*)
}x,
Expand Down
12 changes: 6 additions & 6 deletions lib/Sisimai/Lhost/Exim.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sub make {
$mhead->{'message-id'} =~ /\A[<]\w{7}[-]\w{6}[-]\w{2}[@]/;
$match++ if $mhead->{'subject'} =~ qr{(?:
Mail[ ]delivery[ ]failed(:[ ]returning[ ]message[ ]to[ ]sender)?
|Warning:[ ]message[ ].+[ ]delayed[ ]+
|Warning:[ ]message[ ][^ ]+[ ]delayed[ ]+
|Delivery[ ]Status[ ]Notification
|Mail[ ]failure
|Message[ ]frozen
Expand All @@ -40,7 +40,7 @@ sub make {
# deliver.c:6424|"------ This is a copy of the message, including all the headers. ------\n");
# deliver.c:6425| else fprintf(f,
# deliver.c:6426|"------ This is a copy of the message's headers. ------\n");
[-]+[ ]This[ ]is[ ]a[ ]copy[ ]of[ ](?:the|your)[ ]message.+?headers[.][ ][-]+
[-]+[ ]This[ ]is[ ]a[ ]copy[ ]of[ ](?:the|your)[ ]message,[ ]including[ ]all[ ]the[ ]headers[.][ ][-]+
|Content-Type:[ ]*message/rfc822\n(?:[\s\t]+.*?\n\n)?
)
}msx;
Expand Down Expand Up @@ -68,11 +68,11 @@ sub make {
This[ ]message[ ]was[ ]created[ ]automatically[ ]by[ ]mail[ ]delivery[ ]software[.]
|A[ ]message[ ]that[ ]you[ ]sent[ ]was[ ]rejected[ ]by[ ]the[ ]local[ ]scannning[ ]code
|A[ ]message[ ]that[ ]you[ ]sent[ ]contained[ ]one[ ]or[ ]more[ ]recipient[ ]addresses[ ]
|Message[ ].+[ ](?:has[ ]been[ ]frozen|was[ ]frozen[ ]on[ ]arrival)
|The[ ].+[ ]router[ ]encountered[ ]the[ ]following[ ]error[(]s[)]:
|Message[ ][^ ]+[ ](?:has[ ]been[ ]frozen|was[ ]frozen[ ]on[ ]arrival)
|The[ ][^ ]+[ ]router[ ]encountered[ ]the[ ]following[ ]error[(]s[)]:
)
}x,
'frozen' => qr/\AMessage .+ (?:has been frozen|was frozen on arrival)/,
'frozen' => qr/\AMessage [^ ]+ (?:has been frozen|was frozen on arrival)/,
};
state $recommands = [
# transports/smtp.c:564| *message = US string_sprintf("SMTP error from remote mail server after %s%s: "
Expand Down Expand Up @@ -276,7 +276,7 @@ sub make {
} else {
# Error message when email address above does not include '@'
# and domain part.
if( $e =~ m<\A[ ]+pipe[ ]to[ ][|]/.+> ) {
if( $e =~ m<\A[ ]+pipe[ ]to[ ][|]/[^ ]+> ) {
# pipe to |/path/to/prog ...
# generated by kijitora@example.com
$v->{'diagnosis'} = $e;
Expand Down
2 changes: 1 addition & 1 deletion lib/Sisimai/Lhost/MXLogic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sub make {
$match ||= 1 if index($mhead->{'from'}, 'Mail Delivery System') == 0;
$match ||= 1 if $mhead->{'subject'} =~ qr{(?:
Mail[ ]delivery[ ]failed(:[ ]returning[ ]message[ ]to[ ]sender)?
|Warning:[ ]message[ ].+[ ]delayed[ ]+
|Warning:[ ]message[ ][^ ]+[ ]delayed[ ]+
|Delivery[ ]Status[ ]Notification
)
}x;
Expand Down
16 changes: 8 additions & 8 deletions lib/Sisimai/Lhost/X4.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sub make {
#
# MTA module for qmail clones
'message' => qr{\A(?>
He/Her[ ]is[ ]not.+[ ]user
He/Her[ ]is[ ]not[ ].+[ ]user
|Hi[.][ ].+[ ]unable[ ]to[ ]deliver[ ]your[ ]message[ ]to[ ]the[ ]following[ ]addresses
|Su[ ]mensaje[ ]no[ ]pudo[ ]ser[ ]entregado
|This[ ]is[ ]the[ ](?:
Expand All @@ -62,29 +62,29 @@ sub make {
state $resmtp = {
# Error text regular expressions which defined in qmail-remote.c
# qmail-remote.c:225| if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
'conn' => qr/(?:Error:)?Connected to .+ but greeting failed[.]/,
'conn' => qr/(?:Error:)?Connected to [^ ]+ but greeting failed[.]/,
# qmail-remote.c:231| if (smtpcode() != 250) quit("ZConnected to "," but my name was rejected");
'ehlo' => qr/(?:Error:)?Connected to .+ but my name was rejected[.]/,
'ehlo' => qr/(?:Error:)?Connected to [^ ]+ but my name was rejected[.]/,
# qmail-remote.c:238| if (code >= 500) quit("DConnected to "," but sender was rejected");
# reason = rejected
'mail' => qr/(?:Error:)?Connected to .+ but sender was rejected[.]/,
'mail' => qr/(?:Error:)?Connected to [^ ]+ but sender was rejected[.]/,
# qmail-remote.c:249| out("h"); outhost(); out(" does not like recipient.\n");
# qmail-remote.c:253| out("s"); outhost(); out(" does not like recipient.\n");
# reason = userunknown
'rcpt' => qr/(?:Error:)?.+ does not like recipient[.]/,
'rcpt' => qr/(?:Error:)?[^ ]+ does not like recipient[.]/,
# qmail-remote.c:265| if (code >= 500) quit("D"," failed on DATA command");
# qmail-remote.c:266| if (code >= 400) quit("Z"," failed on DATA command");
# qmail-remote.c:271| if (code >= 500) quit("D"," failed after I sent the message");
# qmail-remote.c:272| if (code >= 400) quit("Z"," failed after I sent the message");
'data' => qr{(?:
(?:Error:)?.+[ ]failed[ ]on[ ]DATA[ ]command[.]
|(?:Error:)?.+[ ]failed[ ]after[ ]I[ ]sent[ ]the[ ]message[.]
(?:Error:)?[^ ]+[ ]failed[ ]on[ ]DATA[ ]command[.]
|(?:Error:)?[^ ]+[ ]failed[ ]after[ ]I[ ]sent[ ]the[ ]message[.]
)
}x,
};
state $rehost = qr{(?:
# qmail-remote.c:261| if (!flagbother) quit("DGiving up on ","");
Giving[ ]up[ ]on[ ](.+[0-9a-zA-Z])[.]?\z
Giving[ ]up[ ]on[ ]([^ ]+[0-9a-zA-Z])[.]?\z
|Connected[ ]to[ ]([-0-9a-zA-Z.]+[0-9a-zA-Z])[ ]
|remote[ ]host[ ]([-0-9a-zA-Z.]+[0-9a-zA-Z])[ ]said:
)
Expand Down
14 changes: 7 additions & 7 deletions lib/Sisimai/Lhost/qmail.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@ sub make {
state $resmtp = {
# Error text regular expressions which defined in qmail-remote.c
# qmail-remote.c:225| if (smtpcode() != 220) quit("ZConnected to "," but greeting failed");
'conn' => qr/(?:Error:)?Connected to .+ but greeting failed[.]/,
'conn' => qr/(?:Error:)?Connected to [^ ]+ but greeting failed[.]/,
# qmail-remote.c:231| if (smtpcode() != 250) quit("ZConnected to "," but my name was rejected");
'ehlo' => qr/(?:Error:)?Connected to .+ but my name was rejected[.]/,
'ehlo' => qr/(?:Error:)?Connected to [^ ]+ but my name was rejected[.]/,
# qmail-remote.c:238| if (code >= 500) quit("DConnected to "," but sender was rejected");
# reason = rejected
'mail' => qr/(?:Error:)?Connected to .+ but sender was rejected[.]/,
'mail' => qr/(?:Error:)?Connected to [^ ]+ but sender was rejected[.]/,
# qmail-remote.c:249| out("h"); outhost(); out(" does not like recipient.\n");
# qmail-remote.c:253| out("s"); outhost(); out(" does not like recipient.\n");
# reason = userunknown
'rcpt' => qr/(?:Error:)?.+ does not like recipient[.]/,
'rcpt' => qr/(?:Error:)?[^ ]+ does not like recipient[.]/,
# qmail-remote.c:265| if (code >= 500) quit("D"," failed on DATA command");
# qmail-remote.c:266| if (code >= 400) quit("Z"," failed on DATA command");
# qmail-remote.c:271| if (code >= 500) quit("D"," failed after I sent the message");
# qmail-remote.c:272| if (code >= 400) quit("Z"," failed after I sent the message");
'data' => qr{(?:
(?:Error:)?.+[ ]failed[ ]on[ ]DATA[ ]command[.]
|(?:Error:)?.+[ ]failed[ ]after[ ]I[ ]sent[ ]the[ ]message[.]
(?:Error:)?[^ ]+[ ]failed[ ]on[ ]DATA[ ]command[.]
|(?:Error:)?[^ ]+[ ]failed[ ]after[ ]I[ ]sent[ ]the[ ]message[.]
)
}x,
};
state $rehost = qr{(?:
# qmail-remote.c:261| if (!flagbother) quit("DGiving up on ","");
Giving[ ]up[ ]on[ ](.+[0-9a-zA-Z])[.]?\z
Giving[ ]up[ ]on[ ]([^ ]+[0-9a-zA-Z])[.]?\z
|Connected[ ]to[ ]([-0-9a-zA-Z.]+[0-9a-zA-Z])[ ]
|remote[ ]host[ ]([-0-9a-zA-Z.]+[0-9a-zA-Z])[ ]said:
)
Expand Down
4 changes: 2 additions & 2 deletions lib/Sisimai/MDA.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sub make {
# dovecot/src/deliver/deliver.c
# 11: #define DEFAULT_MAIL_REJECTION_HUMAN_REASON \
# 12: "Your message to <%t> was automatically rejected:%n%r"
'dovecot' => qr/\AYour message to .+ was automatically rejected:\z/,
'dovecot' => qr/\AYour message to [^ ]+ was automatically rejected:\z/,
'mail.local' => qr/\Amail[.]local: /,
'procmail' => qr/\Aprocmail: /,
'maildrop' => qr/\Amaildrop: /,
Expand All @@ -31,7 +31,7 @@ sub make {
};
state $markingsof = {
'message' => qr{\A(?>
Your[ ]message[ ]to[ ].+[ ]was[ ]automatically[ ]rejected:\z
Your[ ]message[ ]to[ ][^ ]+[ ]was[ ]automatically[ ]rejected:\z
|(?:mail[.]local|procmail|maildrop|vdelivermail|vdeliver):[ ]
)
}x,
Expand Down

0 comments on commit cb961cb

Please sign in to comment.