This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help in filter syntax for LDAP search  RSS feed

 
Andrew Carney
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using this query to get the OUs below a certain OU location from my LDAP:

String filter = "(&(description=*)(objectCategory=organizationalUnit))";
NamingEnumeration results = ctx.search(distinguishedName, filter, controls);

The method which runs this search receives the distinguishedName as a parameter. This distinguishedName specifies from which place to start the search.
The problem is that I receive all the OUs below the OU stated at the distinguishedName but I also receive the OU of the distinguishedName itself.
I would like to remove this OU from the results and for that I assume I need to add to the filter a requirement that distinguishedName != to the distinguishedName I receive as parameter. I tried few variations of the condition yet with no success. Can someone please help me correct this filter so it will match my requirement ?

Thank you in advance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!