Skip to content

Commit

Permalink
reject bare carriage-returns in addition to the bare line-feeds
Browse files Browse the repository at this point in the history
(based on a patch from Robert James Kaes, thanks!)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@209 958fd67b-6ff1-0310-b445-bb7760255be9
  • Loading branch information
abh committed Mar 4, 2004
1 parent 87802c4 commit 22523ea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
0.27

reject bare carriage-returns in addition to the bare line-feeds
(based on a patch from Robert James Kaes, thanks!)

Bugfix to the count_unrecognized_commands plugin so it works
under PPerl (it wasn't resetting the count properly).

Expand Down
21 changes: 14 additions & 7 deletions lib/Qpsmtpd/SMTP.pm
Expand Up @@ -289,7 +289,7 @@ sub help {
my $self = shift;
$self->respond(214,
"This is qpsmtpd " . $self->version,
"See http://develooper.com/code/qpsmtpd/",
"See http://smtpd.develooper.com/",
'To report bugs or send comments, mail to <ask@develooper.com>.');
}

Expand Down Expand Up @@ -348,16 +348,23 @@ sub data {
while (<STDIN>) {
$complete++, last if $_ eq ".\r\n";
$i++;
$_ eq ".\n"
and $self->respond(451, "See http://develooper.com/code/qpsmtpd/barelf.html")
and $self->disconnect;

# should probably use \012 and \015 in these checks instead of \r and \n ...

# Reject messages that have either bare LF or CR. rjkaes noticed a
# lot of spam that is malformed in the header.

($_ eq ".\n" or $_ eq ".\r")
and $self->respond(421, "See http://smtpd.develooper.com/barelf.html")
and return $self->disconnect;

# add a transaction->blocked check back here when we have line by line plugin access...
unless (($max_size and $size > $max_size)) {
s/\r\n$/\n/;
s/^\.\./\./;
if ($in_header and m/^\s*$/) {
$in_header = 0;
my @header = split /^/m, $buffer;
my @headers = split /^/m, $buffer;
# ... need to check that we don't reformat any of the received lines.
#
Expand All @@ -366,8 +373,8 @@ sub data {
# gateway MUST prepend a Received: line, but it MUST NOT alter in any
# way a Received: line that is already in the header.

$header->extract(\@header);
#$header->add("X-SMTPD", "qpsmtpd/".$self->version.", http://develooper.com/code/qpsmtpd/");
$header->extract(\@headers);
#$header->add("X-SMTPD", "qpsmtpd/".$self->version.", http://smtpd.develooper.com/");

$buffer = "";

Expand Down

0 comments on commit 22523ea

Please sign in to comment.