Re: Extended response from Active Directory?

Guillaume Rousse <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
Robert Leibl a écrit :
> The unicode password must be surrounded by '"', each byte needs to be followed
> by a \0 (null) character, and the whole string must be base64 encoded.
> 
>    my $raw_pass = 'secret';
>    $raw_pass = '"' . $raw_pass . '"';
>    my $password = '';
>    map { $password .= "$_\000" } split( //, $raw_pass);
> 
>    $password = encode_base64($password);
> 
> (there are simpler ways, but this shows the idea)
Here is an alternative:
use Unicode::String qw(utf8);
my $unicodePwd = utf8('"' . $password . '"')->utf16le();

-- 
BOFH excuse #365:

parallel processors running perpendicular today
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.