Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^2: Net::LDAP q

by fisher (Priest)
on Sep 06, 2011 at 09:24 UTC ( #924338=note: print w/replies, xml ) Need Help??

in reply to Re: Net::LDAP q
in thread Net::LDAP q

No-no-no, that would be too trivial. Before posting I trying to search using attribute uidNumber,
attributetype ( NAME 'uidNumber' DESC 'An integer uniquely identifying a user in an administrati +ve domain' EQUALITY integerMatch SYNTAX SINGLE-VALUE )
with the filter 'uidNumber <= 1000' and still got no answers. Your supposition may be correct, but it does not answer the second question - how can I do a search with given filter, treating numbers as numbers?

Replies are listed 'Best First'.
Re^3: Net::LDAP q
by salva (Abbot) on Sep 06, 2011 at 09:57 UTC
    The LDAP protocol does not support setting the type of the arguments in comparison filters. It is up to the server to decide which one to use.

    Anyway, I would enable debugging on the Net::LDAP object and see what is being send and received by the script:

      Thank you for a tip.
      Searching for uids less than 1000 and gt 500... Net::LDAP=HASH(0x22d4e +e0) sending: 0000 82: SEQUENCE { 0002 1: INTEGER = 2 0005 77: [APPLICATION 3] { 0007 39: STRING = 'ou=slurm,dc=lomonosov,dc=parallel,dc=ru' 0030 1: ENUM = 2 0033 1: ENUM = 2 0036 1: INTEGER = 0 0039 1: INTEGER = 0 003C 1: BOOLEAN = FALSE 003F 17: [CONTEXT 6] { 0041 9: STRING = 'uidNumber' 004C 4: STRING = '1000' 0052 : } 0052 0: SEQUENCE { 0054 : } 0054 : } 0054 : } Net::LDAP=HASH(0x22d4ee0) received: 0000 12: SEQUENCE { 0002 1: INTEGER = 2 0005 7: [APPLICATION 5] { 0007 1: ENUM = 0 000A 0: STRING = '' 000C 0: STRING = '' 000E : } 000E : } Ok Found:
      I suppose that 'context 6' in this context means 'less or equal'; according to rfc,
      LDAPMessage ::= SEQUENCE { messageID MessageID, protocolOp CHOICE { bindRequest BindRequest, bindResponse BindResponse, unbindRequest UnbindRequest, searchRequest SearchRequest, searchResEntry SearchResultEntry, searchResDone SearchResultDone, [...] SearchRequest ::= [APPLICATION 3] SEQUENCE { baseObject LDAPDN, scope ENUMERATED { baseObject (0), singleLevel (1), wholeSubtree (2), ... }, derefAliases ENUMERATED { neverDerefAliases (0), derefInSearching (1), derefFindingBaseObj (2), derefAlways (3) }, sizeLimit INTEGER (0 .. maxInt), timeLimit INTEGER (0 .. maxInt), typesOnly BOOLEAN, filter Filter, attributes AttributeSelection } [...] Filter ::= CHOICE { [...] greaterOrEqual [5] AttributeValueAssertion, lessOrEqual [6] AttributeValueAssertion, [...] AttributeValueAssertion ::= SEQUENCE { attributeDesc AttributeDescription, assertionValue AssertionValue } AttributeDescription ::= LDAPString -- Constrained to <attributedescriptio +n> -- [RFC4512] AssertionValue ::= OCTET STRING
      Everything seems to be OK, but *why* console utility 'ldapsearch' returns ~200 entries, and Net::LDAP doesn't?
      answer has been found, thank you.

        What was the issue? Inquiring minds want to know. Adding information as to the source of the problem, solutions tried, and one that actually worked will help those who come after you.


        Net::LDAP::Gateway contains a sample LDAP server that can dump the packets it receives as almost-human-friendly Perl data structures. It has served me in the past to compare and validate requests made through Net::LDAP and ldapsearch and solve problems as the one you were facing.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://924338]
[ambrus]: That's what some of the "Black Friday" sales are about.
[Corion]: ambrus: Well, usually, these people don't have in their description "mail me at dodgy_reseller # g m a i l | co m" , replace the "#" by "@" :)
[Corion]: Oh, and the "o" in "com" is a zero
choroba orders a camera from Ole Scæmmer
[ambrus]: Corion: ah. that's different. the ones I mean are selling at reputable sites like ebay that usually filters scammers out pretty quickly (as well as filters a lot of legitimate users who then get annoyed that the biggest providers exclude them)
[Corion]: ambrus: Yeah, if you provide the plausible story of "got it as a gift", buying that via Ebay might somewhat work. But I consider Ebay another harbor of scammers ;)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2017-11-21 15:04 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (304 votes). Check out past polls.