Skip Menu |

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

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

People
Owner: x.guimard [...] free.fr
Requestors: cpan698301 [...] mstier.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.17
Fixed in: 0.18



Subject: Net::Server::Mail incorrectly processes incomplete lines during SMTP session
The author(s) assumed that <HANDLE> reads only complete lines, which is true in many cases, until it isn't. I run Net::Server::Mail::ESMTP via xinetd and additionally redirect via another stunnel4 xinetd service plain text sessions over SSL. This has the effect that the client command "AUTH" is transmitted as "A" and "UTH..." where Net::Server::Mail tells me that it does not understand the command "A". The attached patch is a quick fix that introduces a line buffer for incomplete received lines.
Subject: Net-Server-Mail.patch
--- /opt/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Mail.pm.orig 2012-02-28 01:14:57.000000000 +0100 +++ /opt/perl-5.14.2/lib/site_perl/5.14.2/Net/Server/Mail.pm 2012-02-28 01:24:55.000000000 +0100 @@ -474,7 +474,7 @@ { defined($in->blocking(0)) or die "Couldn't set nonblocking: $^E"; } - + my $linebuf = ''; while($sel->can_read($self->{options}->{idle_timeout} || undef)) { if ($^O eq 'MSWin32') @@ -491,6 +491,13 @@ { my @lines = <$in>; @lines = grep(defined, @lines); + if ( (scalar @lines > 0) && (length($linebuf) > 0) ) { + $lines[0] = $linebuf . $lines[0]; + $linebuf = ''; + } + if ( (scalar @lines > 0) && ($lines[$#lines] !~ /[\r\n]$/) ) { + $linebuf = pop @lines; + } if(scalar @lines) { $_ = join '', @lines; @@ -500,7 +507,7 @@ } # do not go into an infinit loop if client close the connection - last unless defined $_; + last unless (defined $_ || length($linebuf)); my $rv; if(defined $self->next_input_to())
Patch included in 0.18