File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes Searching down an LDAP tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Searching down an LDAP tree" Watch "Searching down an LDAP tree" New topic

Searching down an LDAP tree

Steve Wood
Ranch Hand

Joined: Jan 08, 2003
Posts: 137
Hi guys,

We have the following query:

(&(objectcategory=group)(member=cn=User Name,ou=MyCompany,dc=mycompany,dc=com))

But when we run it (against Active Directory), it only searches for users in root ou folder (i.e. MyCompany). We have a whole bunch of ou's under this, but it doesn't search down the tree - it only searches that immediate folder.

Any ideas?

As a result, if the user isn't in MyCompany, but perhaps in a sub-folder, they aren't found - which is a bit limiting!

I'm not sure if this is active directory or just plain LDAP.

Help is greatly appreciated.


Nitesh Kant

Joined: Feb 25, 2007
Posts: 1638

If you are making the ldap search request using jndi, you would have to use Subtree Search scope in the search control.
This will enable search in subtrees also.

apigee, a better way to API!
I agree. Here's the link:
subject: Searching down an LDAP tree
It's not a secret anymore!