Bugfix to the count_unrecognized_commands plugin so it works

under PPerl (it wasn't resetting the count properly).


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@208 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Ask Bjørn Hansen 2004-03-04 04:14:09 +00:00
parent 9523d55cd7
commit 87802c4505
2 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,8 @@
0.27 0.27
Bugfix to the count_unrecognized_commands plugin so it works
under PPerl (it wasn't resetting the count properly).
reset_transaction is called after disconnect plugins are called so reset_transaction is called after disconnect plugins are called so
the Transaction objects DESTROY method is called. (Thanks to Robert the Transaction objects DESTROY method is called. (Thanks to Robert
James Kaes <rjkaes@flarenet.com>) James Kaes <rjkaes@flarenet.com>)

View File

@ -25,17 +25,19 @@ sub register {
$self->{_unrec_cmd_max} = 4; $self->{_unrec_cmd_max} = 4;
} }
$self->{_unrec_cmd_count} = 0; $qp->connection->notes('unrec_cmd_count', 0);
} }
sub check_unrec_cmd { sub check_unrec_cmd {
my ($self, $transaction, $cmd) = @_; my ($self, $cmd) = @_[0,2];
$self->log(5, "Unrecognized command '$cmd'"); $self->log(5, "Unrecognized command '$cmd'");
$self->{_unrec_cmd_count}++; my $badcmdcount =
$self->qp->connection->notes('unrec_cmd_count',
my $badcmdcount = $self->{_unrec_cmd_count}; $self->qp->connection->notes('unrec_cmd_count') + 1
);
if ($badcmdcount >= $self->{_unrec_cmd_max}) { if ($badcmdcount >= $self->{_unrec_cmd_max}) {
$self->log(5, "Closing connection. Too many unrecognized commands."); $self->log(5, "Closing connection. Too many unrecognized commands.");