On 29/11/03 5:53 pm, Diffenderfer, Randy <[EMAIL PROTECTED]> wrote:

> Folks,
> 
> This should be simple, but I can't find the answer in the FM's...
> 
> I do a search, get a set of entries as a result.  Now I want to "dump" them.
> When printing, how do I simply distinguish a binary attribute?  There are a
> bunch of these things in the AD schema...

The correct way is to look at the attribute definitions in the schema (ie
Net::LDAP::Schema) you download from AD, and then look at the syntax defined
for each attribute.

Your script needs to "know" that certain syntaxes are human-readable and
that certain syntaxes are not. There's no information in the downloaded
schema which tells you this, although RFC 2252 section 4.3.2 gives a list of
which standard syntaxes are human-readable or not. I suspect AD defines a
whole load of non-standard syntaxes, so you'll need to look through MSDN to
track down specs of each of these. AD might even change standard syntaxes.
(It changes standard object classes, so I wouldn't put it past them!)

You should also look at any attribute descriptions. In particular, the
";binary" description says that the value is BER-encoded (ie not just
binary) and that overrides any string representation of the attribute's
syntax.

There's some existing code which might also help.

Net::LDAP::Entry has a dump method which just prints each attribute value,
so probably isn't useful.

Net::LDAP::LDIF will however correctly write each attribute value, though
only based on what bytes are present in each value. It might be a useful
first cut at a safe 'dump' method.

Cheers,

Chris

Reply via email to