From 6b16704b4a4d11e3c685de17474fb41cc07036da Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 28 Mar 2013 17:30:25 -0400 Subject: [PATCH] karma,relay: karma plugin awards karma later by detecting during DATA if relay_client is set --- plugins/karma | 9 +++++++++ plugins/relay | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/karma b/plugins/karma index 6dce939..ae1bead 100644 --- a/plugins/karma +++ b/plugins/karma @@ -243,6 +243,7 @@ sub register { }; #$self->prune_db(); # keep the DB compact $self->register_hook('connect', 'connect_handler'); + $self->register_hook('data', 'data_handler' ); $self->register_hook('disconnect', 'disconnect_handler'); } @@ -316,6 +317,14 @@ sub connect_handler { return $self->get_reject( $mess, $karma ); } +sub data_handler { + my ($self, $transaction) = @_; + return DECLINED if ! $self->qp->connection->relay_client; + + $self->adjust_karma( 5 ); # big karma boost for authenticated user/IP + return DECLINED; +}; + sub disconnect_handler { my $self = shift; diff --git a/plugins/relay b/plugins/relay index 979ef94..7cba450 100644 --- a/plugins/relay +++ b/plugins/relay @@ -241,7 +241,6 @@ sub hook_connect { # 95586 (connect) relay: pass, octet match in relayclients (127.0.0.) if ( $self->is_in_cidr_block() || $self->is_octet_match() ) { - $self->adjust_karma( 2 ); # big karma boost! $self->qp->connection->relay_client(1); return (DECLINED); };