File: cram_md5.t

package info (click to toggle)
libauthen-sasl-perl 2.1900-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 328 kB
  • sloc: perl: 2,249; makefile: 7
file content (41 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!perl

BEGIN {
  eval { require Digest::HMAC_MD5 }
}

use Test::More ($Digest::HMAC_MD5::VERSION ? (tests => 6) : (skip_all => 'Need Digest::HMAC_MD5'));

use Authen::SASL qw(Perl);

my $sasl = Authen::SASL->new(
  mechanism => 'CRAM-MD5',
  callback => {
    user => 'gbarr',
    pass => 'fred',
    authname => 'none'
  },
);
ok($sasl, 'new');

is($sasl->mechanism, 'CRAM-MD5', 'sasl mechanism');

my $conn = $sasl->client_new("ldap","localhost", "noplaintext noanonymous");

is($conn->mechanism, 'CRAM-MD5', 'conn mechanism');


is($conn->client_start, '', 'client_start');

is($conn->client_step("xyz"), 'gbarr 36c931fe47f3fe9c7adbf810b3c7c4ad', 'client_step');

$sasl = Authen::SASL->new(
  mechanism => 'CRAM-MD5',
  callback => {
    pass => 'fred',
    authname => 'none'
  },
);
$conn = $sasl->client_new("ldap","localhost", "noplaintext noanonymous");
is($conn->client_step("xyz"), ' 36c931fe47f3fe9c7adbf810b3c7c4ad', 'client_step no user');