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

Re: LDAP_MOD_BVALUES / "Binary option"



Peter Mogensen wrote:
Hi,

I'm trying to make sense of the use of "binary" in misc client API's.

Some API's (like perl Net::LDAPapi) seem to offer a "b" option do
add/modify operations which controls whether the ";binary"
AttributeOption is set on an attribute.
For Net::LDAPapi this translates (from what I see in the libldap source)
to LDAP_MOD_BVALUES

But when reading the sources and RFC it seems to me that
LDAP_MOD_BVALUES and ";binary" is two completely different things. (Also
";binary" has been removd from RFC4511).

Am I right in concluding that LDAP_MOD_BVALUES (and thus "b" in
Net::LDAPapi) only controls which BER type is used and as such is
completely orthogonal to whether one chooses to set the ";binary"
attributedescription options?

";binary" use often used with jpegPhoto, but does it have any influence
on which BER type the server uses to send data to the client?

I would assume that it would be completely safe to ignore ";binary" and
the only reason to set LDAP_MOD_BVALUES would be if the attribute value
data contained "\0" bytes. (which would prevent using a string)
Is this correct?

None of what you've discussed means what you have said.

The LDAP_MOD_BVALUES flag indicates whether the accompanying modifications are provided in the form of struct bervals, or in the form of regular C strings. That's all.

As a best practice for C programmers, you should always use struct bervals. For languages like perl, which don't give you access to the raw structures, the choice is moot.
--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/