karma,relay: karma plugin awards karma later
by detecting during DATA if relay_client is set
This commit is contained in:
parent
00a6d61c43
commit
cd48146c28
@ -243,6 +243,7 @@ sub register {
|
|||||||
};
|
};
|
||||||
#$self->prune_db(); # keep the DB compact
|
#$self->prune_db(); # keep the DB compact
|
||||||
$self->register_hook('connect', 'connect_handler');
|
$self->register_hook('connect', 'connect_handler');
|
||||||
|
$self->register_hook('data', 'data_handler' );
|
||||||
$self->register_hook('disconnect', 'disconnect_handler');
|
$self->register_hook('disconnect', 'disconnect_handler');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,6 +317,14 @@ sub connect_handler {
|
|||||||
return $self->get_reject( $mess, $karma );
|
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 {
|
sub disconnect_handler {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
|
@ -241,7 +241,6 @@ sub hook_connect {
|
|||||||
# 95586 (connect) relay: pass, octet match in relayclients (127.0.0.)
|
# 95586 (connect) relay: pass, octet match in relayclients (127.0.0.)
|
||||||
|
|
||||||
if ( $self->is_in_cidr_block() || $self->is_octet_match() ) {
|
if ( $self->is_in_cidr_block() || $self->is_octet_match() ) {
|
||||||
$self->adjust_karma( 2 ); # big karma boost!
|
|
||||||
$self->qp->connection->relay_client(1);
|
$self->qp->connection->relay_client(1);
|
||||||
return (DECLINED);
|
return (DECLINED);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user