[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Base 64 encoded ldapsearch results



Pierre Roth:
> Hi all,
> 
> requesting my ldap server with the following cmd line :
> ldapsearch -x -b 'o=CHAMBAGRI' '(objectclass=*)'
> I can see that the content of :
> givenName attribute is Base64 encoded
> sn attribute is Base64 encoded too
> 
> requesting my ldap server with the following cmd line :
> ldapsearch -x -b 'o=CHAMBAGRI' '(objectclass=*)' -t
> the content of these attributes are decoded and stored in tmp files.
> 
> I would like to know how to deactivate the encoding for these attributes 
> / or (better) how to make the ldapsearch result be decoded ?

do your ldapsearch via perl,python,php or your favourite language which
supports base64-encode/decode or make your own program in C which does
the same trick.

Python-example:
import base64
s = "foobar"
encoded = base64.encodestring(s)
decoded = base64.decodestring(encoded)

In general, you get UTF8 if you do a ldapsearch from e.g. PHP
Then you use the utf8_decode function.

Best regards

Bjørn Ove Grøtan