From: Norbert K. <nor...@da...> - 2002-04-24 16:08:58
|
--On Mittwoch, 24. April 2002 10:28 -0400 Jim Harle <ha...@us...> wrote: > Does anyone have a code snippet of changing passwords in Active Directory > via Net::LDAP? From what I can gather, you need 1) to have 128 bit SSL > connection Yes > 2) have either old and new password or be bound with Reset > Password rights Yes > 3) put things out correctly for changing the > unicodePwd attribute. I am unsure as to how to use an old password (is it > part of a modify or do we need to bind with it?) IIRC if you don't have reset password rights on the account, you do (in=20 LDIF notation): changetype: modify delete: unicodePwd unicodePwd: MakeUnicodePwd(OldPassword) - add: unicodePwd unicodePwd: MakeUnicodePwd(NewPassword) otherwise you do a simple_bind as someone who das reset password rights=20 (self) and do a replace. > and how to format the new > password correctly for unicodePwd. use Unicode::String qw(latin1 utf16); sub MakeUnicodePwd { my $u =3D latin1("\"".$_[0]."\""); $u->byteswap(); return $u->ucs2; } --=20 Norbert Klasen, Dipl.-Inform. DAASI International GmbH phone: +49 7071 29 70336 Wilhelmstr. 106 fax: +49 7071 29 5114 72074 T=FCbingen email: nor...@da... Germany web: http://www.daasi.de |