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

Re: [openldap 2.1.12] about use of ldap_add_s(...)



Helene.Lastennet@alcatel.fr wrote:

The value you store in the member modv_bvals of the LDAPMod structure
must not be base64 encoded. It doesn't matter how you declare your value
in the LDAPMod structure; its representation when displaying search results
is decided at the client's level (e.g. by ldapsearch) based on the chars
contained
in the berval that's returned (and on its judjement about their
printability).
Also, note that 'AABCDAA' is not a valid base64 string; I assume you mean
'AABCDAA='.



yes It's a mistake ...

but how can I do to store in my database my attribute 'optionvalues'
which is a string (size 100) whose its first characters can have like decimal
value the value 0 ???
I thought I had to encode my string in base64 format in order to resolve the
problem ...

Using JNDI (in java) it was not a problem because automatically it was
correctly added in database
but with C ldap library, I can't add this specific string because it doesn't
want to add a string attribute with a length equals to 0 ...



As I told you before, use modv_bvals, MOD_BVALUES flag, and store
the value (even if starting with a '\0') in a struct berval, by specifying
a pointer to your value and its length.  The API should not complain about
a zero-length attribute, since it's berval-driven and thus the length of a
value is not computed according to C string rules.

Pierangelo.