LDAP Syntax/Semantics: Filter vs. Base DN?

John picture John · Nov 4, 2010 · Viewed 13.2k times · Source

This is probably pretty stupid, but I'm still green to LDAP. So I hope someone can lend me a hand.

I am using Apache Directory Studio to do my searches and I am confused about when I should be using a filter or when I should be breaking up my filter into two, using one part as the filter and the other as my search base.

Here's an example where I'm trying filter out a group.

Filter: CN=JohnTestGroup,OU=TECH,DC=lab,DC=ing
Base:   DC=lab,DC=ing

This yielded zero results. I realized that perhaps I am being redundant as part of the base is in the filter, so I got rid of that part in the filter.

Filter: CN=JohnTestGroup,OU=TECH
Base:   DC=lab,DC=ing

This still did not yield anything. So I tried this:

Filter: CN=JohnTestGroup
Base:   OU=TECH,DC=lab,DC=ing

I moved the OU parameter into the Base. This worked, but I don't understand why the first or second attempts didn't. Someone care to drop some knowledge on me?

This is probably a matter of syntax/semantics, so if anyone could point me to a resource, I'd be more than willing to read more about it.

Answer

seriyPS picture seriyPS · Nov 4, 2010

Read about Scopes there: http://www.idevelopment.info/data/LDAP/LDAP_Resources/SEARCH_Setting_the_SCOPE_Parameter.shtml

If you set you search scope to SUBTREE both (2 and 3), possible 1 variants start work, but searching by subtree works slower