File: 03_oo.t

package info (click to toggle)
libauthen-ntlm-perl 1.09-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 833; makefile: 4
file content (54 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (3)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /usr/bin/perl

use strict;
use warnings;
use Test::More tests => 12;

use Authen::NTLM;
use MIME::Base64;

my $user = "test";
my $domain = "test";
my $passwd = "test";
my $msg1 = "TlRMTVNTUAABAAAAB7IAAAQABAAgAAAABAAEACQAAAB0ZXN0dGVzdA==";
my $challenge = "TlRMTVNTUAACAAAABAAEADAAAAAFggEAQUJDREVGR0gAAAAAAAAAAAAAAAAAAAAAdGVzdA==";
my $msg2 = "TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAQABABwAAAACAAIAHQAAAAIAAgAfAAAAAAAAABEAAAABYIBAJ7/TlMo4HLg0gOk6iKq4bv2vk35ozHEKKoqG8nTkQ5S82zyqpJzxPDJHUMynnKsBHRlc3R0AGUAcwB0AHQAZQBzAHQA";

my $a = Authen::NTLM-> new(
	user     => $user,
	domain   => $domain,
	password => $passwd,
);

# 2: username

ok($a->user eq $user, 'ntlm_user');

# 3: domain

ok($a->domain eq $domain, 'ntlm_domain');

# 4: password

ok($a->password eq $passwd, 'ntlm_password');

# 5: initial message

my $reply1 = $a-> challenge;
ok($reply1 eq $msg1, 'reply 1');

# 6-12: decode challenge - not normally user accessed

my $c = &Authen::NTLM::decode_challenge(decode_base64($challenge));
ok($c->{ident} eq "NTLMSSP", 'header');
ok($c->{type} == 2, 'type');
ok($c->{flags} == 0x00018205, 'flags');
ok($c->{data} eq "ABCDEFGH", 'data');
ok($c->{domain}{len} == 4, 'domain length');
ok($c->{domain}{offset} == 48, 'domain offset');
ok($c->{buffer} eq "test", 'contents');

# 13: challenge response

my $reply2 = $a-> challenge($challenge);
ok($reply2 eq $msg2, 'reply 2');