File: auth_flat_file

package info (click to toggle)
qpsmtpd 0.40-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,024 kB
  • ctags: 393
  • sloc: perl: 6,462; sh: 383; makefile: 54
file content (27 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*-perl-*- [emacs]

sub register_tests {
    my $self = shift;
    $self->register_test("test_authsql", 3);
}

my @u_list = qw ( good bad none );
my %u_data = (
	      good => [ 'good@example.com', OK, 'good_pass' ],
	      bad => [ 'bad@example.com', DENY, 'not_bad_pass' ],
	      none => [ 'none@example.com', DECLINED, '' ],
	      );

sub test_authsql {
    my $self = shift;
    my ($tran, $ret, $note, $u, $r, $p, $a );
    $tran = $self->qp->transaction;
    for $u ( @u_list ) {
	( $a,$r,$p ) = @{$u_data{$u}};
	($ret, $note) = $self->authsql($tran,'CRAMMD5',$a,$p);
	defined $note or $note='No-Message';
	is ($ret, $r, $note);
	# - for debugging.
	# warn "$note\n";
    }
}