Using PHP LDAP functions: problem with filters
Posted on 2006-04-07
I'm using php's ldap functions to authenticate users against an Open LDAP directory.
This filter: $filter = "cn=" .$userid.;
works fine - ($userid) comes via POST from a form.
So does this: $filter = "(&(|(cn=ISS*)(cn=ITS*))(cn=" .$userid."))";
So I'm pretty confident I can combine (AND/OR) arguments to the filter, and hard-code different forms of 'acceptable' usernames.
However, I want to limit the search to specific OU's. I'm trying to do this inside the filter, but as soon as I do even this:
$filter = "(&(ou=*)(cn=" .$userid."))";
it breaks. Am I trying to set 'acceptable' ou's in the wrong place, or something?
How do I specify acceptable containers?