Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

This sounds very much like an XY Problem. What are you actually trying to accomplish? Which said, I'm game to try and answer the question you asked ...

The allowed content of an LDAP (v3) attribute is defined in the LDAP Schema. You can use Net::LDAP::Schema to retrieve this from the server.

Unfortunately, this may or may not help you, as there are several "kinds" of binary data which can exist even in the Standard Types, let alone any custom extensions which you may have. For example, the RFC mentions the Audio, Binary, JEPG and Octet String syntaxes. You could probably implement a lookup table to specify which comparison method should be used, based upon the OID of the syntax for each attribute's value. This would be the route to take if you are (for example) trying to compare two different LDAP directories.

If, OTOH, you are trying to find partially matching entries in a single LDAP, you might be able to make the server do the work and just use a filter to pull out entries which match your desired attribute/value pairs. Since you don't seem to be to rigorous about comparing the binary values, this may be "good enough".

my $filter = "(&"; foreach my $attr (keys %lookingfor) { $filter .= "($attr=\" . escape_filter_value($lookingfor{$attr}) . "\")"; } $filter .= ")"; $ldap = Net::LDAP->new($server); $mesg = $ldap->bind; $mesg = $ldap->search( base => $base, filter => $filter ); $mesg->code && die $mesg->error; foreach $entry ($mesg->entries) { $entry->dump; } $mesg = $ldap->unbind;

The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon

In reply to Re: how to handle comparison of binary type attributes in LDAP by idsfa
in thread how to handle comparison of binary type attributes in LDAP by perlknight

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (14)
    As of 2014-04-18 21:54 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (472 votes), past polls