From 87802c45055f07d0c1cb9648d1851c3a5734ef6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ask=20Bj=C3=B8rn=20Hansen?= Date: Thu, 4 Mar 2004 04:14:09 +0000 Subject: [PATCH] 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 --- Changes | 3 +++ plugins/count_unrecognized_commands | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 45b6d99..3bfa060 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ 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 the Transaction objects DESTROY method is called. (Thanks to Robert James Kaes ) diff --git a/plugins/count_unrecognized_commands b/plugins/count_unrecognized_commands index 2a1f7e4..f08e78b 100644 --- a/plugins/count_unrecognized_commands +++ b/plugins/count_unrecognized_commands @@ -25,17 +25,19 @@ sub register { $self->{_unrec_cmd_max} = 4; } - $self->{_unrec_cmd_count} = 0; + $qp->connection->notes('unrec_cmd_count', 0); + } sub check_unrec_cmd { - my ($self, $transaction, $cmd) = @_; + my ($self, $cmd) = @_[0,2]; $self->log(5, "Unrecognized command '$cmd'"); - $self->{_unrec_cmd_count}++; - - my $badcmdcount = $self->{_unrec_cmd_count}; + my $badcmdcount = + $self->qp->connection->notes('unrec_cmd_count', + $self->qp->connection->notes('unrec_cmd_count') + 1 + ); if ($badcmdcount >= $self->{_unrec_cmd_max}) { $self->log(5, "Closing connection. Too many unrecognized commands.");