From 98228cd38ca4e84fdd27cd81990fcd5c19ba92b0 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Wed, 27 Jun 2012 14:42:34 -0700 Subject: [PATCH] dspam: check for dspam_bin during register --- plugins/dspam | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/dspam b/plugins/dspam index a71ee9b..22ac794 100644 --- a/plugins/dspam +++ b/plugins/dspam @@ -213,6 +213,11 @@ sub register { $self->{_args} = { @_ }; $self->{_args}{reject} = 1 if ! defined $self->{_args}{reject}; $self->{_args}{reject_type} ||= 'perm'; + $self->{_args}{dspam_bin} ||= '/usr/local/bin/dspam'; + + if ( ! -x $self->{_args}{dspam_bin} ) { + $self->log(LOGERROR, "dspam not found: "); + }; $self->register_hook('data_post', 'data_post_handler'); } @@ -228,9 +233,9 @@ sub data_post_handler { return (DECLINED); }; - my $username = $self->select_username( $transaction ); - my $dspam_bin = $self->{_args}{dspam_bin} || '/usr/local/bin/dspam'; - my $filtercmd = "$dspam_bin --user $username --mode=tum --process --deliver=summary --stdout"; + my $user = $self->select_username( $transaction ); + my $bin = $self->{_args}{dspam_bin}; + my $filtercmd = "$bin --user $user --mode=tum --process --deliver=summary --stdout"; $self->log(LOGDEBUG, $filtercmd); my $response = $self->dspam_process( $filtercmd, $transaction );