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

RE: Base 64 encoded data...

> -----Original Message-----
> From: owner-openldap-software@OpenLDAP.org
> [mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of Ray Jackson

> Hi all,
> I have a text file (including new lines) which I want to store on the
> LDAP server.  I understand that to do this I need to treat the data as
> Base 64 encoded data.  However, how do I convert my data to base 64
> encoded data and more importantly how do I convert is back to the
> original format after I retrieve the base 64 encoded data via an
> ldapsearch?

If you're using the ldapadd or ldapmodify command to store the entry, you
can use the "-b" option to have this taken care of for you - instead of
including the contents of your text file in the add request, you specify the
pathname of the text file and the ldap client command will read your file
and base64 encode it as necessary. When retrieving the entry using the
ldapsearch command, use the "-t" option and the decoded file will be stored
in a temporary directory for you.

For example, this command will add an entry with the description coming
from a file named "/tmp/myfile"
  ldapadd -b
dn: cn=Joe Doe,ou=users,o=my company
objectclass: inetorgperson
cn: Joe Doe
description: /tmp/myfile

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc