cvs commit: qpsmtpd/lib/Qpsmtpd SMTP.pm
[email protected] (Ask "Bj?rn" Hansen)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/03/03 20:29:45
Modified: lib/Qpsmtpd SMTP.pm
Log:
reject bare carriage-returns in addition to the bare line-feeds
(based on a patch from Robert James Kaes, thanks!)
Revision Changes Path
1.24 +14 -7 qpsmtpd/lib/Qpsmtpd/SMTP.pm
Index: SMTP.pm
===================================================================
RCS file: /cvs/public/qpsmtpd/lib/Qpsmtpd/SMTP.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -w -r1.23 -r1.24
--- SMTP.pm 24 Feb 2004 10:31:12 -0000 1.23
+++ SMTP.pm 4 Mar 2004 04:29:45 -0000 1.24
@@ -289,7 +289,7 @@
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 <[email protected]>.');
}
@@ -348,16 +348,23 @@
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.
#
@@ -366,8 +373,8 @@
# 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 = "";