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

Missing something with filters and/or attributes



So I'm having a little trouble understanding why I can't filter an attribute in one DN, but I can filter an attribute in another DN:

Here's the first search, to show the dn and attribute (o: example.com) actually exists:

# ldapsearch -x -D "cn=Manager,dc=example,dc=ca" -W -b 'ou=hosting,ou=mail,dc=example,dc=ca' -s one o
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <ou=hosting,ou=mail,dc=example,dc=ca> with scope oneLevel
# filter: (objectclass=*)
# requesting: o
#


# example.com, hosting, mail, example.com
dn: o=example.com,ou=hosting,ou=mail,dc=example,dc=ca
o: example.com

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

If I try a more specific search, filtering for the same attribute that was returned in the previous search, and only requesting the o attribute, it comes up with nothing and I don't understand why. I've tried one, sub and children, off chance I just don't understand my own directory hierarchy, but it seems I do:

# ldapsearch -x -D "cn=Manager,dc=example,dc=ca" -W -b 'ou=hosting,ou=mail,dc=example,dc=ca' -s one '(o=example.com)' o
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <ou=hosting,ou=mail,dc=example,dc=ca> with scope oneLevel
# filter: (o=example.com)
# requesting: o
#


# search result
search: 2
result: 0 Success

# numResponses: 1

I can perform the same search, save a different filter, attribute and scope and get the results returned back no problem, but I can't see the differences between the two, unless there is something below the surface that I'm not understanding:

# ldapsearch -x -D "cn=Manager,dc=example,dc=ca" -W -b 'ou=hosting,ou=mail,dc=example,dc=ca' -s sub '(uid=jlixfeld)' uid
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <ou=hosting,ou=mail,dc=example,dc=ca> with scope subtree
# filter: (uid=jlixfeld)
# requesting: uid
#


# jlixfeld, example.com, hosting, mail, example.com
dn: uid=jlixfeld,o=example.com,ou=hosting,ou=mail,dc=example,dc=ca
uid: jlixfeld

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1