Resolve Ppolicy constant bug #310433
This commit is contained in:
parent
59bbd54920
commit
a53c327ad1
|
@ -31,10 +31,10 @@ sub authenticate {
|
|||
|
||||
# require Perl module
|
||||
eval 'require Net::LDAP::Control::PasswordPolicy';
|
||||
die('Module Net::LDAP::Control::PasswordPolicy not found in @INC')
|
||||
if ($@);
|
||||
eval
|
||||
'use Net::LDAP::Constant qw( LDAP_CONTROL_PASSWORDPOLICY LDAP_PP_ACCOUNT_LOCKED LDAP_PP_PASSWORD_EXPIRED );';
|
||||
if ($@) {
|
||||
print STDERR "Module Net::LDAP::Control::PasswordPolicy not found in @INC\n";
|
||||
return PE_LDAPERROR;
|
||||
}
|
||||
no strict 'subs';
|
||||
|
||||
# Create Control object
|
||||
|
@ -51,15 +51,15 @@ sub authenticate {
|
|||
return PE_OK if ( $mesg->code == 0 );
|
||||
|
||||
# Get server control response
|
||||
my ($resp) = $mesg->control(LDAP_CONTROL_PASSWORDPOLICY);
|
||||
my ($resp) = $mesg->control("1.3.6.1.4.1.42.2.27.8.5.1");
|
||||
|
||||
if ( defined $resp ) {
|
||||
my $pp_error = $resp->error;
|
||||
if ( defined $pp_error ) {
|
||||
return PE_PP_ACCOUNT_LOCKED
|
||||
if ( $pp_error == LDAP_PP_ACCOUNT_LOCKED );
|
||||
if ( $pp_error == 1 );
|
||||
return PE_PP_PASSWORD_EXPIRED
|
||||
if ( $pp_error == LDAP_PP_PASSWORD_EXPIRED );
|
||||
if ( $pp_error == 0 );
|
||||
}
|
||||
else {
|
||||
return PE_BADCREDENTIALS;
|
||||
|
|
Loading…
Reference in New Issue
Block a user