Skip Menu |

This queue is for tickets about the Net-Server-Mail CPAN distribution.

Report information
The Basics
Id: 106949
Status: resolved
Priority: 0/
Queue: Net-Server-Mail

People
Owner: Nobody in particular
Requestors: nezumi [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: 0.22



Subject: LMTP server processes DATA callback multiple times
Hi, If Net::Server::Mail::LMTP sets DATA callback, it will be called multiple times by each recipient in one LMTP transaction. This behavior is inconsistent with other modules, SMTP and ESMTP. I suppose LMTP module behaves wrong. I checked Net::Server::Mail::LMTP 0.16 bundled in Net-Server-Mail 0.21. Regards, --- nezumi
Hi again, I confused a bit. The problem is that, LMTP module does not return multiline reply: It returns multiple single-line replys. Attached patch will fix this bug. Additionally, LMTP replys with 503 to DATA when there are no valid recipients. Regards, -- nezumi On 2015-9月-08 火 01:23:55, NEZUMI wrote: Show quoted text
> Hi, > > If Net::Server::Mail::LMTP sets DATA callback, it will be called > multiple times by each recipient in one LMTP transaction. > > This behavior is inconsistent with other modules, SMTP and ESMTP. I > suppose LMTP module behaves wrong. > > I checked Net::Server::Mail::LMTP 0.16 bundled in Net-Server-Mail > 0.21. > > > Regards, > > --- nezumi
Subject: Net-Server-Mail-0.21-lmtp-multiline-reply.patch
--- Net-Server-Mail-0.21/lib/Net/Server/Mail/LMTP.pm.orig 2013-09-05 19:54:19.000000000 +0900 +++ Net-Server-Mail-0.21/lib/Net/Server/Mail/LMTP.pm 2015-09-09 12:41:40.000000000 +0900 @@ -156,12 +156,25 @@ =cut +sub data { + my ( $self, $args ) = @_; + + unless ( ref $self->step_forward_path eq 'ARRAY' + and @{ $self->step_forward_path } ) { + $self->reply( 503, 'Bad sequence of commands' ); + return; + } + $self->SUPER::data( $args ); +} + sub data_finished { my ($self) = @_; - my $recipients = $self->step_forward_path(); + my @recipients = @{ $self->step_forward_path || [] }; - foreach my $forward_path (@$recipients) { + $self->{continuous_reply} = 1; + while ( my $forward_path = shift @recipients ) { + $self->{continuous_reply} = 0 unless @recipients; $self->make_event( name => 'DATA', arguments => [ \$self->{_data}, $forward_path ], @@ -169,6 +182,7 @@ failure_reply => [ 550, "$forward_path Failed" ], ); } + $self->{continuous_reply} = 0; # reinitiate the connection $self->step_reverse_path(1); @@ -178,6 +192,17 @@ return; } +sub reply { + my ( $self, $code, $msg ) = @_; + + if (not ref $msg and $self->{continuous_reply} ) { + my $out = $self->{out}; + print $out "$code-$msg\r\n"; + } else { + $self->SUPER::reply( $code, $msg ); + } +} + =pod =head1 SEE ALSO
Subject: Re: [rt.cpan.org #106949] LMTP server processes DATA callback multiple times
Date: Wed, 9 Sep 2015 13:51:00 +0200
To: bug-Net-Server-Mail [...] rt.cpan.org
From: Xavier <x.guimard [...] free.fr>
Hi, thanks a lot, I've uploaded a new 0.22 with yout patch (available in a few minutes) Le 09/09/2015 06:00, Hatuka*nezumi - IKEDA Soji via RT a écrit : Show quoted text
> Queue: Net-Server-Mail > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106949 > > > Hi again, > > I confused a bit. The problem is that, LMTP module does not return multiline reply: It returns multiple single-line replys. > > Attached patch will fix this bug. Additionally, LMTP replys with 503 to DATA when there are no valid recipients. > > Regards, > > -- nezumi > > On 2015-9月-08 火 01:23:55, NEZUMI wrote:
>> Hi, >> >> If Net::Server::Mail::LMTP sets DATA callback, it will be called >> multiple times by each recipient in one LMTP transaction. >> >> This behavior is inconsistent with other modules, SMTP and ESMTP. I >> suppose LMTP module behaves wrong. >> >> I checked Net::Server::Mail::LMTP 0.16 bundled in Net-Server-Mail >> 0.21. >> >> >> Regards, >> >> --- nezumi
> > >
Fixed by Hatuka Nezumi