From e2cc2f746476c20c70e2daab7409caa6167983d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Sun, 21 Apr 2002 03:28:20 +0000 Subject: [PATCH] If the connection fails while in DATA we would just accept the message. Ouch! Thanks to Devin Carraway for the patch. bumped version number to 0.07 git-svn-id: https://svn.perl.org/qpsmtpd/trunk@16 958fd67b-6ff1-0310-b445-bb7760255be9 --- Changes | 6 ++++++ qpsmtpd | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 9e78a7d..2d64829 100644 --- a/Changes +++ b/Changes @@ -1,9 +1,15 @@ 2002/04/20 + Bumped version number to 0.07 + Support comments in configuration files (prefix the line with #) Support RELAYCLIENT like qmail-smtpd (thanks to Marius Kjeldahl ) ) + If the connection fails while in DATA we would just accept the + message. Ouch! Thanks to Devin Carraway for the + patch. + 2002/01/26 Allow [1.2.3.4] for the hostname when checking if the dns resolves diff --git a/qpsmtpd b/qpsmtpd index d5c4f7b..fe52680 100755 --- a/qpsmtpd +++ b/qpsmtpd @@ -11,7 +11,7 @@ # package QPsmtpd; -$QPsmtpd::VERSION = "0.06"; +$QPsmtpd::VERSION = "0.07"; use strict; $| = 1; use Mail::Address (); @@ -178,18 +178,19 @@ sub data { respond(503, "MAIL first"), return 1 unless $state{transaction}->{from}; respond(503, "RCPT first"), return 1 unless $state{transaction}->{rcpt}; respond(354, "go ahead"); - my $buffer; + my $buffer = ''; my $size = 0; my $i = 0; my $max_size = (get_config('databytes'))[0] || 0; my $blocked = ""; my %matches; my $header = 1; + my $complete = 0; warn "$$ max_size: $max_size / size: $size" if $TRACE > 5; while () { - last if $_ eq ".\r\n"; + $complete++, last if $_ eq ".\r\n"; $i++; respond(451, "See http://develooper.com/code/qpsmtpd/barelf.html"), exit if $_ eq ".\n"; @@ -223,6 +224,10 @@ sub data { warn "$$ max_size: $max_size / size: $size" if $TRACE > 5; + # if we get here without seeing a terminator, the connection is + # probably dead. + respond(451, "Incomplete DATA"), return 1 unless $complete; + respond(550, $blocked),return 1 if $blocked; respond(552, "Message too big!"),return 1 if $max_size and $size > $max_size;