On 15/9/05 10:18, Alexandre Jousset <[EMAIL PROTECTED]> wrote:

> Hello list,
> 
> Is there a way to know if an attribute is binary, even in the case of a
> new attribute (i.e. when I build it from Net::LDAP::Entry->new so I
> can't rely on the ';binary' suffix) ?

The ;binary suffix doesn't indicate the value contains 8-bit values. It is
rather misnamed, as it *actually* means that the value is the BER encoding
of the underlying attribute value instead of the LDAP string representation
of the underlying attribute value.

BER-encoded values are almost always going to contain 8-bit values.

However there are also attribute syntaxes that don't define that the
attribute values are "text". The common here is the octet string syntax,
which is used by things like jpegPhoto and userPassword.

Lots of people get confused about this :-)

> For the moment I check the attribute name in the schema, get the
> syntax, and from the syntax I check the 'x-not-human-readable' field (I
> prefer it over 'x-binary-transfer-required' because I want to display
> it). I know I can do this for OpenLDAP, and it works well, but as it is
> a 'x-' field I suppose it is not standard.

Obviously it is non-standard, as all fields starting x- are non-standard.

> Do most LDAP servers on the market provide this field ? Can you tell me
> your experience ?

It isn't quite the right way to do it IMHO.

What you *should* be doing is teaching your script about the syntaxes that
are being used by the server. You will need to know that syntax
"octetstring", or "1.3.6.1.4.1.1466.115.121.1.40" (some servers use names
and some use the OIDs) is not text, and then use the information in your
schema object to find out what syntax an attribute is using.

It is basically an extra layer of indirection, which avoids having to hack a
server to support non-standard schema information.

Cheers,

Chris


Reply via email to