Skip to content

Commit

Permalink
Bugfix to the count_unrecognized_commands plugin so it works
Browse files Browse the repository at this point in the history
  under PPerl (it wasn't resetting the count properly).


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@208 958fd67b-6ff1-0310-b445-bb7760255be9
  • Loading branch information
abh committed Mar 4, 2004
1 parent 9523d55 commit 87802c4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions 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 <rjkaes@flarenet.com>)
Expand Down
12 changes: 7 additions & 5 deletions plugins/count_unrecognized_commands
Expand Up @@ -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.");
Expand Down

0 comments on commit 87802c4

Please sign in to comment.