The unrecognized_command hook now understands the DENY_DISCONNECT return

and the DENY return is deprecated.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@473 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Ask Bjørn Hansen 2005-07-06 21:52:45 +00:00
parent d48cd2e37e
commit 4f0c4d94a1
4 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,8 @@
qpsmtpd-forkserver: --listen-address may now be given more than once, to qpsmtpd-forkserver: --listen-address may now be given more than once, to
request listening on multiple local addresses (Devin Carraway) request listening on multiple local addresses (Devin Carraway)
(also: no more signal problems making qpsmtpd-forkserver crash/loop
when forking).
qpsmtpd-forkserver: add an option for writing a PID file (pjh) qpsmtpd-forkserver: add an option for writing a PID file (pjh)
@ -12,6 +14,11 @@
when disconncting with a temporary failure, return 421 rather than when disconncting with a temporary failure, return 421 rather than
450 or 451. (Peter J. Holzer) 450 or 451. (Peter J. Holzer)
The unrecognized_command hook now understands the DENY_DISCONNECT return
and the DENY return is deprecated.
Updated documentation
0.30 - 2005/07/05 0.30 - 2005/07/05

View File

@ -189,7 +189,7 @@ Works like the "connect" hook.
Called when we get a command that isn't recognized. Called when we get a command that isn't recognized.
DENY - Return 521 and disconnect the client DENY_DISCONNECT - Return 521 and disconnect the client
DONE - Qpsmtpd won't do anything; the plugin responded DONE - Qpsmtpd won't do anything; the plugin responded
Anything else - Return '500 Unrecognized command' Anything else - Return '500 Unrecognized command'

View File

@ -52,7 +52,9 @@ sub dispatch {
if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1}) { if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1}) {
my ($rc, $msg) = $self->run_hooks("unrecognized_command", $cmd); my ($rc, $msg) = $self->run_hooks("unrecognized_command", $cmd);
if ($rc == DENY) { if ($rc == DENY_DISCONNECT or $rc == DENY) {
$self->log(LOGWARN, "Returning DENY for the unrecognized_command hook is deprecated; use DENY_DISCONNECT")
if $rc == DENY;
$self->respond(521, $msg); $self->respond(521, $msg);
$self->disconnect; $self->disconnect;
} }

View File

@ -42,7 +42,7 @@ sub check_unrec_cmd {
if ($badcmdcount >= $self->{_unrec_cmd_max}) { if ($badcmdcount >= $self->{_unrec_cmd_max}) {
$self->log(LOGINFO, "Closing connection. Too many unrecognized commands."); $self->log(LOGINFO, "Closing connection. Too many unrecognized commands.");
return (DENY, "Closing connection. $badcmdcount unrecognized commands. Perhaps you should read RFC 2821?"); return (DENY_DISCONNECT, "Closing connection. $badcmdcount unrecognized commands. Perhaps you should read RFC 2821?");
} }
return DECLINED; return DECLINED;