1NTLM(3) User Contributed Perl Documentation NTLM(3)
2
3
4
6 Authen::NTLM - An NTLM authentication module
7
9 use Mail::IMAPClient;
10 use Authen::NTLM;
11 my $imap = Mail::IMAPClient->new(Server=>'imaphost');
12 ntlm_user($username);
13 ntlm_password($password);
14 $imap->authenticate("NTLM", Authen::NTLM::ntlm);
15 :
16 $imap->logout;
17 ntlm_reset;
18 :
19
20 or
21
22 ntlmv2(1);
23 ntlm_user($username);
24 ntlm_host($host);
25 ntlm_password($password);
26 :
27
28 or
29
30 my $ntlm = Authen::NTLM-> new(
31 host => $host,
32 user => $username,
33 domain => $domain,
34 password => $password,
35 version => 1,
36 );
37 $ntlm-> challenge;
38 :
39 $ntlm-> challenge($challenge);
40
42 This module provides methods to use NTLM authentication. It can
43 be used as an authenticate method with the Mail::IMAPClient module
44 to perform the challenge/response mechanism for NTLM connections
45 or it can be used on its own for NTLM authentication with other
46 protocols (eg. HTTP).
47
48 The implementation is a direct port of the code from F<fetchmail>
49 which, itself, has based its NTLM implementation on F<samba>. As
50 such, this code is not especially efficient, however it will still
51 take a fraction of a second to negotiate a login on a PII which is
52 likely to be good enough for most situations.
53
54 FUNCTIONS
55 ntlm_domain()
56 Set the domain to use in the NTLM authentication messages.
57 Returns the new domain. Without an argument, this function
58 returns the current domain entry.
59
60 ntlm_user()
61 Set the username to use in the NTLM authentication messages.
62 Returns the new username. Without an argument, this function
63 returns the current username entry.
64
65 ntlm_password()
66 Set the password to use in the NTLM authentication messages.
67 Returns the new password. Without an argument, this function
68 returns the current password entry.
69
70 ntlm_reset()
71 Resets the NTLM challenge/response state machine so that the next
72 call to C<ntlm()> will produce an initial connect message.
73
74 ntlm()
75 Generate a reply to a challenge. The NTLM protocol involves an
76 initial empty challenge from the server requiring a message
77 response containing the username and domain (which may be empty).
78 The first call to C<ntlm()> generates this first message ignoring
79 any arguments.
80
81 The second time it is called, it is assumed that the argument is
82 the challenge string sent from the server. This will contain 8
83 bytes of data which are used in the DES functions to generate the
84 response authentication strings. The result of the call is the
85 final authentication string.
86
87 If C<ntlm_reset()> is called, then the next call to C<ntlm()> will
88 start the process again allowing multiple authentications within
89 an application.
90
91 ntlmv2()
92 Use NTLM v2 authentication.
93
94 OBJECT API
95 new %options
96 Creates an object that accepts the following options: "user",
97 "host", "domain", "password", "version".
98
99 challenge [$challenge]
100 If $challenge is not supplied, first-stage challenge string is
101 generated. Otherwise, the third-stage challenge is generated,
102 where $challenge is assumed to be extracted from the second stage
103 of NTLM exchange. The result of the call is the final
104 authentication string.
105
107 David (Buzz) Bussenschutt <davidbuzz@gmail.com> - current maintainer
108 Dmitry Karasik <dmitry@karasik.eu.org> - nice ntlmv2 patch, OO extensions.
109 Andrew Hobson <ahobson@infloop.com> - initial ntlmv2 code
110 Mark Bush <Mark.Bush@bushnet.demon.co.uk> - perl port
111 Eric S. Raymond - author of fetchmail
112 Andrew Tridgell and Jeremy Allison for SMB/Netbios code
113
115 perl, Mail::IMAPClient, LWP::Authen::Ntlm
116
118 1.09 - fix CPAN ticket # 70703
119 1.08 - fix CPAN ticket # 39925
120 1.07 - not publicly released
121 1.06 - relicense as GPL+ or Artistic
122 1.05 - add OO interface by Dmitry Karasik
123 1.04 - implementation of NTLMv2 by Andrew Hobson/Dmitry Karasik
124 1.03 - fixes long-standing 1 line bug L<http://rt.cpan.org/Public/Bug/Display.html?id=9521> - released by David Bussenschutt 9th Aug 2007
125 1.02 - released by Mark Bush 29th Oct 2001
126
127
128
129perl v5.28.1 2011-09-09 NTLM(3)