Override log function to use fileno(client) as pid will always be the same

Don't use exit() in response to bad LF end of DATA


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@195 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2003-11-19 23:01:43 +00:00
parent 91893ec62f
commit c1aa3ddb8a

View File

@ -27,6 +27,12 @@ our $QUIT = 0;
$SIG{INT} = $SIG{TERM} = sub { $QUIT++ }; $SIG{INT} = $SIG{TERM} = sub { $QUIT++ };
sub log {
my ($self, $trace, @log) = @_;
warn join(" ", fileno($self->client), @log), "\n"
if $trace <= Qpsmtpd::TRACE_LEVEL();
}
sub main { sub main {
my $class = shift; my $class = shift;
my %opts = (LocalPort => 25, Reuse => 1, Listen => SOMAXCONN, @_); my %opts = (LocalPort => 25, Reuse => 1, Listen => SOMAXCONN, @_);
@ -272,9 +278,11 @@ sub data_line {
# DATA is always the end of a "transaction" # DATA is always the end of a "transaction"
return $self->reset_transaction; return $self->reset_transaction;
} }
elsif ($_ eq ".\n") {
$self->respond(451, "See http://develooper.com/code/qpsmtpd/barelf.html"), exit $self->respond(451, "See http://develooper.com/code/qpsmtpd/barelf.html");
if $_ eq ".\n"; $self->{__quitting} = 1;
return;
}
# add a transaction->blocked check back here when we have line by line plugin access... # add a transaction->blocked check back here when we have line by line plugin access...
unless (($self->{__max_size} and $self->{__size} > $self->{__max_size})) { unless (($self->{__max_size} and $self->{__size} > $self->{__max_size})) {