Re: strange behaviour of SetPassword
Kurt Zeilenga <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.ldap |
|---|---|
| Message-ID | <[email protected]> |
On Mar 20, 2009, at 7:36 AM, Dieter Kluenter wrote:
> Hi,
> i just test PasswordPolicy and want to modify passwords with
> Net::LDAP::Extension::SetPassword, but when i run this script,
> $msg->gen_password() creats a random password and modifies
> newpassword=> with the radom generated value instead of the defined
> password. Is this a bug or is my script bogus. The docs say
>
> gen_password ( )
> Return the password generated in the previous
> "set_password()"
> call.
>
My guess is that the documentation is wrong. The LDAP extended
operation used returns the server generated password. In your use of
the operation, the server didn't generate a password, so the generated
password field should not be present in the server's response.
-- Kurt
>
> ,----[ password.pl ]
> | use Net::LDAP;
> | use Net::LDAP::Extension::SetPassword;
> | my ($ldap,$msg);
> | my $host = 'ldap://localhost';
> |
> | $ldap = Net::LDAP->new( $host );
> | $ldap->bind('cn=Foo Bar,ou=Mitarbeiter,o=avci,c=de',
> | password=> '0J2zrRpD');
> | $msg = $ldap->set_password(
> | oldpassword=> '0J2zrRpD',
> | newpassword=> 'RfgZzU2'
> | );
> | die "Fehler: ",$msg->code(), ":",$msg->error() if ($msg->code());
> |
> | print "new password is: ", $msg->gen_password() , "\n";
> | $ldap->unbind();
> `----
>
> -Dieter
> --
> Dieter Klünter | Systemberatung
> http://www.dpunkt.de/buecher/2104.html
> sip: +49.180.1555.7770535
> GPG Key ID:8EF7B6C6
> 53°08'09,95"N
> 10°08'02,42"E