Log the connecting client hostname/address, rather than waiting for the

SMTP greeting.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@283 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Devin Carraway 2004-08-01 06:56:33 +00:00
parent 0a77877ced
commit 15c90f04fa

View File

@ -18,6 +18,7 @@ sub start_connection {
my $remote_host = $ENV{TCPREMOTEHOST} || ( $ENV{TCPREMOTEIP} ? "[$ENV{TCPREMOTEIP}]" : "[noip!]"); my $remote_host = $ENV{TCPREMOTEHOST} || ( $ENV{TCPREMOTEIP} ? "[$ENV{TCPREMOTEIP}]" : "[noip!]");
my $remote_info = $ENV{TCPREMOTEINFO} ? "$ENV{TCPREMOTEINFO}\@$remote_host" : $remote_host; my $remote_info = $ENV{TCPREMOTEINFO} ? "$ENV{TCPREMOTEINFO}\@$remote_host" : $remote_host;
my $remote_ip = $ENV{TCPREMOTEIP}; my $remote_ip = $ENV{TCPREMOTEIP};
$self->log(LOGNOTICE, "Connection from $remote_info [$remote_ip]");
# if the local dns resolver doesn't filter it out we might get # if the local dns resolver doesn't filter it out we might get
# ansi escape characters that could make a ps axw do "funny" # ansi escape characters that could make a ps axw do "funny"
@ -67,7 +68,7 @@ sub respond {
my ($self, $code, @messages) = @_; my ($self, $code, @messages) = @_;
while (my $msg = shift @messages) { while (my $msg = shift @messages) {
my $line = $code . (@messages?"-":" ").$msg; my $line = $code . (@messages?"-":" ").$msg;
$self->log(LOGDEBUG, "$line"); $self->log(LOGDEBUG, $line);
print "$line\r\n" or ($self->log(LOGERROR, "Could not print [$line]: $!"), return 0); print "$line\r\n" or ($self->log(LOGERROR, "Could not print [$line]: $!"), return 0);
} }
return 1; return 1;