>
> On 27 Nov 2008, at 15:58, Clément OUDOT wrote:
>
>>>
>>> On Nov 26, 2008, at 4:28 AM, Clément OUDOT wrote:
>>>> Thanks for your answer. I have to translate java code to perl ;) But
>>>> another question, it seems the value we get from AD is binary, I use
>>>> the
>>>> "raw" attribute in Net::LDAP search but the value I get is not what
>>>> I can
>>>> see with an ldapsearch... Is there a better way to manage binary
>>>> data in
>>>> perl-ldap ?
>>>
>>> ldapsearch is outputing in LDIF and binary data will be base64
>>> encoded. You can tell this by the double : after the attribute name
>>>
>>> you should see the same result if you use Net::LDAP::LDIF to output
>>> your entry
>>>
>>> my $ldif = Net::LDAP::LDIF->new('-','w');
>>> $ldif->write_entry($entry);
>>
>>
>> Yes you are right!
>>
>> The problem is now that the value is outputed as utf-8, and if you
>> want to
>> manage such attribute, you have to convert it into bytes :
>> http://www.ahfb2000.com/webmaster_help_desk/showthread.php?t=4735
>>
>> This page helps me to convert the utf-8 into hexadecimal. Then you can
>> easily transform hexa to binary.
>>
>> Did someone on this list use this kind of attributes in his perl code?
>
> The rfc822mailbox (aka "mail") attribute uses the IA5string syntax. I
> bet a few people use that attribute.


Hello,

a piece of answer, with $value being the value of logonHours after a search:

-----------
# See string as binary
print unpack("B*", $value);

# See string as hex
print unpack("H*", $value);
-----------

And use the pack function so store the string into the Directory.

Clément.

Reply via email to