auth: eval 'use' so plugins can be enabled by default

and tested.
This commit is contained in:
Matt Simerson 2012-05-21 16:11:49 -04:00
parent 5a8a9be26c
commit 1a1dcc3e53
4 changed files with 15 additions and 3 deletions

View File

@ -45,6 +45,10 @@ check_spamhelo
# sender_permitted_from # sender_permitted_from
# greylisting p0f genre,windows # greylisting p0f genre,windows
auth/auth_checkpassword checkpw /usr/local/vpopmail/bin/vchkpw true /usr/bin/true
auth/auth_vpopmail
auth/auth_vpopmaild
auth/auth_vpopmail_sql
auth/auth_flat_file auth/auth_flat_file
auth/authdeny auth/authdeny

View File

@ -0,0 +1 @@
/usr/local/vpopmail/bin/vchkpw /bin/true

View File

@ -45,7 +45,7 @@ use warnings;
use Qpsmtpd::Auth; use Qpsmtpd::Auth;
use Qpsmtpd::Constants; use Qpsmtpd::Constants;
#use vpopmail; # we eval this in $test_vpopmail #use vpopmail; # we eval this in $test_vpopmail_module
sub register { sub register {
my ($self, $qp) = @_; my ($self, $qp) = @_;
@ -86,7 +86,7 @@ sub test_vpopmail_module {
my $self = shift; my $self = shift;
# vpopmail will not allow vauth_getpw to succeed unless the requesting user is vpopmail or root. # vpopmail will not allow vauth_getpw to succeed unless the requesting user is vpopmail or root.
# by default, qpsmtpd runs as the user 'qpsmtpd' and does not have permission. # by default, qpsmtpd runs as the user 'qpsmtpd' and does not have permission.
eval "use vpopmail"; eval 'use vpopmail';
if ( $@ ) { if ( $@ ) {
$self->log(LOGERROR, "skip: is vpopmail perl module installed?"); $self->log(LOGERROR, "skip: is vpopmail perl module installed?");
return; return;

View File

@ -69,11 +69,18 @@ use warnings;
use Qpsmtpd::Auth; use Qpsmtpd::Auth;
use Qpsmtpd::Constants; use Qpsmtpd::Constants;
use DBI; #use DBI; # done in ->register
sub register { sub register {
my ( $self, $qp ) = @_; my ( $self, $qp ) = @_;
eval 'use DBI';
if ( $@ ) {
warn "plugin disabled. is DBI installed?\n";
$self->log(LOGERROR, "skip: plugin disabled. is DBI installed?\n");
return;
};
$self->register_hook('auth-plain', 'auth_vmysql'); $self->register_hook('auth-plain', 'auth_vmysql');
$self->register_hook('auth-login', 'auth_vmysql'); $self->register_hook('auth-login', 'auth_vmysql');
$self->register_hook('auth-cram-md5', 'auth_vmysql'); $self->register_hook('auth-cram-md5', 'auth_vmysql');