dspam: catch error where QP user lacks x on dspam
x = execute privileges
This commit is contained in:
parent
eae10519ee
commit
b9501855ff
@ -217,14 +217,26 @@ sub register {
|
|||||||
$self->{_args}{reject_type} ||= 'perm';
|
$self->{_args}{reject_type} ||= 'perm';
|
||||||
$self->{_args}{dspam_bin} ||= '/usr/local/bin/dspam';
|
$self->{_args}{dspam_bin} ||= '/usr/local/bin/dspam';
|
||||||
|
|
||||||
if ( ! -x $self->{_args}{dspam_bin} ) {
|
$self->get_dspam_bin() or return DECLINED;
|
||||||
$self->log(LOGERROR, "dspam CLI binary not found: install dspam and/or set dspam_bin");
|
|
||||||
return DECLINED;
|
|
||||||
};
|
|
||||||
|
|
||||||
$self->register_hook('data_post', 'data_post_handler');
|
$self->register_hook('data_post', 'data_post_handler');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_dspam_bin {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
my $bin = $self->{_args}{dspam_bin};
|
||||||
|
if ( ! -e $bin ) {
|
||||||
|
$self->log(LOGERROR, "error, dspam CLI binary not found: install dspam and/or set dspam_bin");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
if ( ! -x $bin ) {
|
||||||
|
$self->log(LOGERROR, "error, no permission to run $bin");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
return $bin;
|
||||||
|
};
|
||||||
|
|
||||||
sub data_post_handler {
|
sub data_post_handler {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $transaction = shift || $self->qp->transaction;
|
my $transaction = shift || $self->qp->transaction;
|
||||||
|
Loading…
Reference in New Issue
Block a user