diff --git a/lib/Qpsmtpd/PollServer.pm b/lib/Qpsmtpd/PollServer.pm index 81f0d6d..2f75a7f 100644 --- a/lib/Qpsmtpd/PollServer.pm +++ b/lib/Qpsmtpd/PollServer.pm @@ -16,6 +16,7 @@ use fields qw( start_time cmd_timeout conn + prev_crlf _auth _auth_mechanism _auth_state @@ -208,6 +209,7 @@ sub data_respond { $self->{header_lines} = ''; $self->{data_size} = 0; $self->{in_header} = 1; + $self->{prev_crlf} = 0; $self->{max_size} = ($self->config('databytes'))[0] || 0; $self->log(LOGDEBUG, "max_size: $self->{max_size} / size: $self->{data_size}"); @@ -225,7 +227,11 @@ sub got_data { my $done = 0; 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; $done = 1; } @@ -268,6 +274,7 @@ sub got_data { $self->transaction->body_write(\$data); $self->{data_size} += length $data; + $self->{prev_crlf} = $data =~ /\r\n\z/; }