From 6eefa970166db31538477cecf697b7c13c62d9ff Mon Sep 17 00:00:00 2001 From: Hanno Hecker Date: Mon, 25 Dec 2006 10:12:54 +0000 Subject: [PATCH] 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 --- lib/Qpsmtpd/SMTP.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index b684cce..8b47e90 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -85,7 +85,8 @@ sub unrecognized_command_respond { sub fault { my $self = shift; 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); } @@ -100,12 +101,12 @@ sub start_conversation { sub connect_respond { my ($self, $rc, $msg) = @_; - if ($rc == DENY) { + if ($rc == DENY || $rc == DENY_DISCONNECT) { $msg->[0] ||= 'Connection from you denied, bye bye.'; $self->respond(550, @$msg); $self->disconnect; } - elsif ($rc == DENYSOFT) { + elsif ($rc == DENYSOFT || $rc == DENYSOFT_DISCONNECT) { $msg->[0] ||= 'Connection from you temporarily denied, bye bye.'; $self->respond(450, @$msg); $self->disconnect; @@ -113,7 +114,7 @@ sub connect_respond { elsif ($rc != DONE) { my $greets = $self->config('smtpgreeting'); if ( $greets ) { - $greets .= " ESMTP"; + $greets .= " ESMTP" unless $greets =~ /(^|\W)ESMTP(\W|$)/; } else { $greets = $self->config('me')