Subject: | Adress parsing failure in MAIL FROM and RCPT TO |
Hi!
In Version 0.18, adress parsing in the MAIL FROM command fails if the
mail address is NOT encased in <>
While the new version handles RFC6409 better, this update seems to break
quite a few older clients.
I attached a patch that should fix handling of all kinds of "MAIL FROM:"
and "RCPT TO:" formats.
LG
Rene
Subject: | mailfix.patch |
diff -rupN Net-Server-Mail-0.18_orig/lib/Net/Server/Mail/SMTP.pm Net-Server-Mail-0.18/lib/Net/Server/Mail/SMTP.pm
--- Net-Server-Mail-0.18_orig/lib/Net/Server/Mail/SMTP.pm 2012-05-13 12:03:52.000000000 +0200
+++ Net-Server-Mail-0.18/lib/Net/Server/Mail/SMTP.pm 2012-05-29 12:30:32.014081944 +0200
@@ -385,7 +385,16 @@ sub mail
}
my($address, $rest, @options);
- unless (($address, $rest) = $args =~ /^<(.*?)>(?: (\S.*))?$/) {
+ if($args =~ /\ /) {
+ my @tmp = split/\ /, $args;
+ $address = shift @tmp;
+ $rest = join(' ', @tmp);
+ $address =~ s/^.*<//;
+ $address =~ s/>.*$//;
+ } else {
+ $address = $args;
+ }
+ if(!defined($address) || $address eq "") {
$self->reply(501, 'Syntax error in parameters or arguments');
return;
}
@@ -441,7 +450,16 @@ sub rcpt
}
my($address, $rest, @options);
- unless (($address, $rest) = $args =~ /^<(.*?)>(?: (\S.*))?$/) {
+ if($args =~ /\ /) {
+ my @tmp = split/\ /, $args;
+ $address = shift @tmp;
+ $rest = join(' ', @tmp);
+ $address =~ s/^.*<//;
+ $address =~ s/>.*$//;
+ } else {
+ $address = $args;
+ }
+ if(!defined($address) || $address eq "") {
$self->reply(501, 'Syntax error in parameters or arguments');
return;
}