dspam: catch error where QP user lacks x on dspam

x = execute privileges
This commit is contained in:
Matt Simerson 2013-03-27 19:37:40 -04:00
parent eeacf83e3a
commit e7ea7a0949

View File

@ -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;