2012-05-05 05:33:50 +02:00
|
|
|
#!perl -w
|
2012-04-07 23:52:44 +02:00
|
|
|
|
2012-05-07 09:35:59 +02:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
2012-04-07 23:52:44 +02:00
|
|
|
sub register_tests {
|
|
|
|
my $self = shift;
|
2012-05-07 09:35:59 +02:00
|
|
|
|
2012-05-22 00:06:22 +02:00
|
|
|
eval 'use DBI';
|
|
|
|
if ( $@ ) {
|
|
|
|
warn "skipping auth_vpopmail_sql tests, is DBI installed?\n";
|
|
|
|
return;
|
|
|
|
};
|
2014-09-17 08:16:53 +02:00
|
|
|
$self->register_test("auth_vpopmail_sql");
|
2012-04-07 23:52:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
sub auth_vpopmail_sql {
|
|
|
|
my $self = shift;
|
2012-05-07 09:35:59 +02:00
|
|
|
my ( $transaction, $method, $user, $passClear, $passHash, $ticket ) = @_;
|
|
|
|
|
|
|
|
my $dbh = $self->get_db_handle() or do {
|
|
|
|
foreach ( 0..2 ) {
|
2012-05-22 00:06:22 +02:00
|
|
|
ok( 1, "skipped (no DB)" );
|
2012-05-07 09:35:59 +02:00
|
|
|
};
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
ok( $dbh, "auth_vpopmail_sql, got a dbh" );
|
|
|
|
|
|
|
|
my $vuser = $self->get_vpopmail_user( $dbh, 'postmaster@example.com' );
|
|
|
|
if ( ! $vuser || ! $vuser->{pw_passwd} ) {
|
|
|
|
foreach ( 0..1 ) {
|
2012-05-22 00:06:22 +02:00
|
|
|
ok( 1, "no example.com domain" );
|
2012-05-07 09:35:59 +02:00
|
|
|
};
|
|
|
|
return;
|
|
|
|
};
|
2012-05-22 00:06:22 +02:00
|
|
|
ok( ref $vuser, "found example.com domain" );
|
2012-05-07 09:35:59 +02:00
|
|
|
|
|
|
|
ok( $self->auth_vmysql(
|
|
|
|
$self->qp->transaction,
|
|
|
|
'PLAIN',
|
|
|
|
'postmaster@example.com',
|
|
|
|
$vuser->{pw_clear_passwd},
|
|
|
|
$vuser->{pw_passwd},
|
|
|
|
$ticket,
|
|
|
|
),
|
2012-05-22 00:06:22 +02:00
|
|
|
"postmaster"
|
2012-05-07 09:35:59 +02:00
|
|
|
);
|
2012-04-07 23:52:44 +02:00
|
|
|
}
|