line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::LDAP::Extension::eDirectoryPassword; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require Net::LDAP::Extension; |
4
|
|
|
|
|
|
|
require Convert::ASN1; |
5
|
1
|
|
|
1
|
|
27472
|
use constant NMASLDAP_GET_PASSWORD_REQUEST => "2.16.840.1.113719.1.39.42.100.13"; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
76
|
|
6
|
1
|
|
|
1
|
|
5
|
use constant NMASLDAP_GET_PASSWORD_RESPONSE => "2.16.840.1.113719.1.39.42.100.14"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
7
|
1
|
|
|
1
|
|
5
|
use constant NMAS_LDAP_EXT_VERSION => 1; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
280
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = "0.00_01"; |
10
|
|
|
|
|
|
|
@ISA = qw(Net::LDAP::Extension); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# prepare to BER encode the request |
13
|
|
|
|
|
|
|
my $passwdRequest = Convert::ASN1->new; |
14
|
|
|
|
|
|
|
$passwdRequest->prepare (q); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# prepare to BER decode the response |
17
|
|
|
|
|
|
|
my $passwdResponse = Convert::ASN1->new; |
18
|
|
|
|
|
|
|
$passwdResponse->prepare (q); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# get an universal password |
21
|
|
|
|
|
|
|
sub Net::LDAP::get_edir_password { |
22
|
0
|
|
|
0
|
0
|
|
my $ldap = shift; |
23
|
0
|
|
|
|
|
|
my $requestdn = shift; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my $res = $ldap->extension ( |
26
|
|
|
|
|
|
|
name => NMASLDAP_GET_PASSWORD_REQUEST, |
27
|
|
|
|
|
|
|
value => $passwdRequest->encode ( |
28
|
|
|
|
|
|
|
'nmasver' => NMAS_LDAP_EXT_VERSION, |
29
|
|
|
|
|
|
|
'reqdn' => $requestdn, |
30
|
|
|
|
|
|
|
), |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
bless $res; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# return a previously fetched password |
37
|
|
|
|
|
|
|
sub edir_password { |
38
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
0
|
|
|
|
|
if ($self->response_name() eq NMASLDAP_GET_PASSWORD_RESPONSE) { |
41
|
0
|
|
|
|
|
|
my $output = $passwdResponse->decode ($self->response()); |
42
|
0
|
0
|
|
|
|
|
if (!$output->{'err'}) { |
43
|
0
|
|
|
|
|
|
return $output->{'passwd'}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
|
return undef; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |