Permalink
Browse files

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

and tested.
  • Loading branch information...
1 parent 600b0db commit b8240fa220bc48377daf51ff71f551f2372e6820 @msimerson committed May 21, 2012
Showing with 15 additions and 3 deletions.
  1. +4 −0 config.sample/plugins
  2. +1 −0 config.sample/smtpauth-checkpassword
  3. +2 −2 plugins/auth/auth_vpopmail
  4. +8 −1 plugins/auth/auth_vpopmail_sql
View
4 config.sample/plugins
@@ -45,6 +45,10 @@ check_spamhelo
# sender_permitted_from
# 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/authdeny
View
1 config.sample/smtpauth-checkpassword
@@ -0,0 +1 @@
+/usr/local/vpopmail/bin/vchkpw /bin/true
View
4 plugins/auth/auth_vpopmail
@@ -45,7 +45,7 @@ use warnings;
use Qpsmtpd::Auth;
use Qpsmtpd::Constants;
-#use vpopmail; # we eval this in $test_vpopmail
+#use vpopmail; # we eval this in $test_vpopmail_module
sub register {
my ($self, $qp) = @_;
@@ -86,7 +86,7 @@ sub test_vpopmail_module {
my $self = shift;
# 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.
- eval "use vpopmail";
+ eval 'use vpopmail';
if ( $@ ) {
$self->log(LOGERROR, "skip: is vpopmail perl module installed?");
return;
View
9 plugins/auth/auth_vpopmail_sql
@@ -69,11 +69,18 @@ use warnings;
use Qpsmtpd::Auth;
use Qpsmtpd::Constants;
-use DBI;
+#use DBI; # done in ->register
sub register {
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-login', 'auth_vmysql');
$self->register_hook('auth-cram-md5', 'auth_vmysql');

0 comments on commit b8240fa

Please sign in to comment.