As Cox, Todd (NIH/NCI) once put it so eloquently:
> I have been working for sometime on putting a web page together that users
> can go to change their passwords. We have two directories, NDS and AD, and
> the NDS part works great. I have read just about every post I can find but
> nothing is helping at this point. The pseudo code is as follows:
There's a couple things going on here...
> $res = $ldap->bind($user,password => $oldPwd, version => 3 ); # use
> for changes/edits
Note that to change passwords in AD, you *MUST* use LDAPS, not LDAP.
> $r1 = $ldap->modify($user,changes => [ delete =>
> [unicodePwd => $adOldPass],
> add
> => [unicodePwd => $adNewPass]
You left out the code that transforms the password into "unicode"; the
code I use to do it looks like this:
my $opw = $entry->get_value('unicodePwd');
if (defined $opw) {
my $upw = pack "v*", unpack "C*", qq("$opw");
&change_changes($entry, 'replace', 'unicodePwd', $upw);
}
Note that it has to be in double quotes as well.
I don't think you're allowed to "delete" then "add"; I think you have
to "replace".
%% Christopher A. Bongaarts %% [EMAIL PROTECTED] %%
%% Internet Services %% http://umn.edu/~cab %%
%% University of Minnesota %% +1 (612) 625-1809 %%