karma,relay: karma plugin awards karma later
by detecting during DATA if relay_client is set
This commit is contained in:
parent
ce0d2b80ef
commit
6b16704b4a
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user