some fixes from Michael C. Toren:

- Treat DENY(|SOFT)_DISCONNECT from connect hooks the same as DENY(|SOFT)
 - only append ESMTP to smtpgreeting if it's not already in there
 - Qpsmtpd::SMTP::fault(): parsing now unambigous and just first "word" of $0
see also http://www.nntp.perl.org/group/perl.qpsmtpd/5905


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@699 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Hanno Hecker 2006-12-25 10:12:54 +00:00
parent dcb86d5a72
commit 6eefa97016

View File

@ -85,7 +85,8 @@ sub unrecognized_command_respond {
sub fault { sub fault {
my $self = shift; my $self = shift;
my ($msg) = shift || "program fault - command not performed"; my ($msg) = shift || "program fault - command not performed";
print STDERR "$0[$$]: $msg ($!)\n"; my ($name) = split /\s+/, $0, 2;
print STDERR $name,"[$$]: $msg ($!)\n";
return $self->respond(451, "Internal error - try again later - " . $msg); return $self->respond(451, "Internal error - try again later - " . $msg);
} }
@ -100,12 +101,12 @@ sub start_conversation {
sub connect_respond { sub connect_respond {
my ($self, $rc, $msg) = @_; my ($self, $rc, $msg) = @_;
if ($rc == DENY) { if ($rc == DENY || $rc == DENY_DISCONNECT) {
$msg->[0] ||= 'Connection from you denied, bye bye.'; $msg->[0] ||= 'Connection from you denied, bye bye.';
$self->respond(550, @$msg); $self->respond(550, @$msg);
$self->disconnect; $self->disconnect;
} }
elsif ($rc == DENYSOFT) { elsif ($rc == DENYSOFT || $rc == DENYSOFT_DISCONNECT) {
$msg->[0] ||= 'Connection from you temporarily denied, bye bye.'; $msg->[0] ||= 'Connection from you temporarily denied, bye bye.';
$self->respond(450, @$msg); $self->respond(450, @$msg);
$self->disconnect; $self->disconnect;
@ -113,7 +114,7 @@ sub connect_respond {
elsif ($rc != DONE) { elsif ($rc != DONE) {
my $greets = $self->config('smtpgreeting'); my $greets = $self->config('smtpgreeting');
if ( $greets ) { if ( $greets ) {
$greets .= " ESMTP"; $greets .= " ESMTP" unless $greets =~ /(^|\W)ESMTP(\W|$)/;
} }
else { else {
$greets = $self->config('me') $greets = $self->config('me')