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

ldpsearch filter showing all records.



Hello list,

My filter on ldapsearch is not working as expected but showing all the
records.

If I simply do an search on object class like below it shows all records
belong to that object

````````````````````````````````````````````````````````````````````````````
 ldapsearch -h 127.0.0.1 -b "ou=people,dc=example,dc=com" -x
"objectclass=inetOrgPerson"  -D "cn=Manager,dc=example,dc=com" -W
Enter LDAP Password:

# extended LDIF
#
# LDAPv3
# base <ou=people,dc=example,dc=com> with scope subtree
# filter: objectclass=inetOrgPerson
# requesting: ALL
#

# test1, people, example.com
dn: cn=test1,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
cn: test1
sn: smith
uid: rjsmith
userPassword:: MTIzNDU2
carLicense: HISCAR 123
homePhone: 555-111-2222
description: swell guy
ou: Human Resources
mail: r.smith@example.com

# test2, people, example.com
dn: cn=test2,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
cn: test2
sn: Billy
uid: rbilly
userPassword:: MTIzNDU2
carLicense: HISCAR 123
homePhone: 555-111-2222
mail: billy@example.com
description: sales guy
ou: Sales

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2
``````````````````````````````````````````````````````````````````````````````````````

Now to redifine the filter.  Want to result where gid=rjsmith

` ` ` ` ` ` ` `
ldapsearch -h 127.0.0.1 -b "ou=people,dc=example,dc=com" -x
"objectclass=inetOrgPerson" uid=rjsmith  -D
"cn=Manager,dc=example,dc=com" -W
Enter LDAP Password:

# extended LDIF
#
# LDAPv3
# base <ou=people,dc=example,dc=com> with scope subtree
# filter: objectclass=inetOrgPerson
# requesting: uid=rjsmith
#

# test1, people, example.com
dn: cn=test1,ou=people,dc=example,dc=com

# test2, people, example.com
dn: cn=test2,ou=people,dc=example,dc=com

# search result
search: 2
result: 0 Success

# numResponses: 3
# numEntries: 2

` ` ` ` ` `

Again both the results are showing.   something wrong in my  filter  ?
Please enlighten me.

Thanks