[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#5711) Password Modify Exop don't return ppolicy control in case of error



Full_Name: Guillaume Rousse
Version: 2.4.11
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (193.55.250.67)


When Password Modify ExOp fails, due to ppolicy restrictions, it doesn't return
any ppolicy control. The following test case is enough to demonstrate it with
any policy defining minimum password length to 2:

#!/usr/bin/perl
use Net::LDAP;
use Net::LDAP::Extension::SetPassword;
use Net::LDAP::Control::PasswordPolicy;
use Data::Dumper;

my $ldap = Net::LDAP->new('ldap.domain.com')
    or die "impossible to connect: $@";

my $result = $ldap->bind('cn=foo,dc=domain,dc=com', password => 'bar');
die 'impossible to bind: ' . $result->error() if $result->code();

my $pp = Net::LDAP::Control::PasswordPolicy->new();
$result = $ldap->set_password(
    newpasswd => 'a',
    control   => [ $pp ]
);

my $control = $result->control(LDAP_CONTROL_PASSWORDPOLICY);
print Dumper($control);