Hi,

On Tuesday 12 April 2005 18:09, Marc Chantreux wrote:
> The sample code that is in the FAQ to update a password in an Active
> directory  needs modules that are not in the standard perl distribution.
> I wrote one exemple which doesn't need those modules. Peraps you can add
> it in the FAQ ?
>
> Regards,
> mc
>
> package Net::LDAP::AD;
> use strict;
> use warnings;
> use Encode;
> use base qw(
>     Net::LDAP
> );
>
>
> sub passwd {
>
>     my ( $ldap , $user , $password );
>
>     # $ldap   : a Net::LDAPS  object
>     # SSL is *required* by Active Directory to change the password
>     # $user   : DN of the user
>     # $password : plaintext for the new password
>
>     $ldap->modify(
>       $user , replace => {
>           unicodePwd => Encode::encode('UTF-16LE',qq("$password") )
>       }
>     );
>
> }

I may be mistaken, but I think Encode is only available with Perl 5.8.
In addition to that I think that your function only works with passwords in 
the Latin1 (aka ISO-8859-1) character set.

The solution in the FAQ works for earlier versions of Perl and and passwords
in other character sets too (provided the Unicode::Map8 character map is
created propely).

Peter
-- 
Peter Marschall
eMail: [EMAIL PROTECTED]

Reply via email to