Fix for when a regular DATA packet starts with "." but isn't End-of-data

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@875 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2008-04-14 12:24:18 +00:00
parent d0d7412f22
commit e93284caaa

View File

@ -16,6 +16,7 @@ use fields qw(
start_time start_time
cmd_timeout cmd_timeout
conn conn
prev_crlf
_auth _auth
_auth_mechanism _auth_mechanism
_auth_state _auth_state
@ -208,6 +209,7 @@ sub data_respond {
$self->{header_lines} = ''; $self->{header_lines} = '';
$self->{data_size} = 0; $self->{data_size} = 0;
$self->{in_header} = 1; $self->{in_header} = 1;
$self->{prev_crlf} = 0;
$self->{max_size} = ($self->config('databytes'))[0] || 0; $self->{max_size} = ($self->config('databytes'))[0] || 0;
$self->log(LOGDEBUG, "max_size: $self->{max_size} / size: $self->{data_size}"); $self->log(LOGDEBUG, "max_size: $self->{max_size} / size: $self->{data_size}");
@ -225,7 +227,11 @@ sub got_data {
my $done = 0; my $done = 0;
my $remainder; my $remainder;
if ($data =~ s/^\.\r\n(.*)\z//ms) { if ($data =~ s/\r\n\.\r\n(.*)\z/\r\n/ms
||
($self->{prev_crlf} && $data =~ s/^\.\r\n(.*)\z//ms)
)
{
$remainder = $1; $remainder = $1;
$done = 1; $done = 1;
} }
@ -268,6 +274,7 @@ sub got_data {
$self->transaction->body_write(\$data); $self->transaction->body_write(\$data);
$self->{data_size} += length $data; $self->{data_size} += length $data;
$self->{prev_crlf} = $data =~ /\r\n\z/;
} }