2012-05-05 05:33:50 +02:00
|
|
|
#!perl -w
|
2012-04-07 23:52:44 +02:00
|
|
|
|
2012-05-22 22:54:47 +02:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Qpsmtpd::Constants;
|
|
|
|
|
2012-04-07 23:52:44 +02:00
|
|
|
sub register_tests {
|
|
|
|
my $self = shift;
|
2012-05-07 09:35:58 +02:00
|
|
|
|
2014-09-17 08:16:53 +02:00
|
|
|
$self->register_test("test_auth_vpopmail");
|
2012-04-07 23:52:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
my @u_list = qw ( good bad none );
|
|
|
|
my %u_data = (
|
|
|
|
good => [ 'postmaster@example.com', OK, 'Good Strong Passphrase' ],
|
2012-05-07 09:35:58 +02:00
|
|
|
bad => [ 'bad@example.com', DENY, 'not_bad_pass' ],
|
2012-04-07 23:52:44 +02:00
|
|
|
none => [ 'none@example.com', DECLINED, '' ],
|
|
|
|
);
|
|
|
|
|
|
|
|
sub test_auth_vpopmail {
|
|
|
|
my $self = shift;
|
2012-05-07 09:35:58 +02:00
|
|
|
|
|
|
|
if ( ! $self->test_vpopmail_module ) {
|
2012-05-22 22:54:47 +02:00
|
|
|
warn "vpopmail plugin not configured\n";
|
2012-05-22 00:06:22 +02:00
|
|
|
foreach ( 0..2) { ok( 1, "skipped") };
|
2012-05-07 09:35:58 +02:00
|
|
|
return;
|
|
|
|
};
|
|
|
|
|
2012-04-07 23:52:44 +02:00
|
|
|
my ($tran, $ret, $note, $u, $r, $p, $a );
|
|
|
|
$tran = $self->qp->transaction;
|
|
|
|
for $u ( @u_list ) {
|
2012-05-07 09:35:58 +02:00
|
|
|
( $a,$r,$p ) = @{$u_data{$u}};
|
|
|
|
($ret, $note) = $self->auth_vpopmail($tran,'CRAMMD5',$a,$p);
|
|
|
|
defined $note or $note='auth_vpopmail: No-Message';
|
|
|
|
is ($ret, $r, $note);
|
2012-04-07 23:52:44 +02:00
|
|
|
}
|
|
|
|
}
|