| 1 | package Net::LDAP::Extension::eDirectoryPassword; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | require Net::LDAP::Extension; | |||||||||
| 4 | 1 | require Convert::ASN1; | |||||||||
| 5 | 1 | ▶ | use constant NMASLDAP_GET_PASSWORD_REQUEST => "2.16.840.1.113719.1.39.42.100.13"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use constant NMASLDAP_GET_PASSWORD_RESPONSE => "2.16.840.1.113719.1.39.42.100.14"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use constant NMAS_LDAP_EXT_VERSION => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | $VERSION = "0.00_01"; | |||||||||
| 10 | 1 | @ISA = qw(Net::LDAP::Extension); | |||||||||
| 11 | |||||||||||
| 12 | # prepare to BER encode the request | ||||||||||
| 13 | 1 | my $passwdRequest = Convert::ASN1->new; | |||||||||
| 14 | 1 | $passwdRequest->prepare (q<SEQUENCE { nmasver INTEGER, reqdn OCTET STRING } >); | |||||||||
| 15 | |||||||||||
| 16 | # prepare to BER decode the response | ||||||||||
| 17 | 1 | my $passwdResponse = Convert::ASN1->new; | |||||||||
| 18 | 1 | $passwdResponse->prepare (q<SEQUENCE { nmasver INTEGER, err INTEGER, passwd OCTET STRING }>); | |||||||||
| 19 | |||||||||||
| 20 | # get an universal password | ||||||||||
| 21 | 0 | ▶ | sub Net::LDAP::get_edir_password { | ||||||||
|
Subroutine
get_edir_password: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 22 | 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 | 0 | ▶ | sub edir_password { | ||||||||
|
Subroutine
edir_password: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 38 | 0 | my $self = shift; | |||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | if ($self->response_name() eq NMASLDAP_GET_PASSWORD_RESPONSE) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | my $output = $passwdResponse->decode ($self->response()); | |||||||||
| 42 | 0 | ▶ | if (!$output->{'err'}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | return $output->{'passwd'}; | |||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | 0 | return undef; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 1 | 1; | |||||||||
| 50 | |||||||||||
| 51 | __END__ | ||||||||||