Jump to content

LDAP. Help please!


dan400007

Recommended Posts

I'm having a problem when searching my MS Active Directory using LDAP.

If I specify an OU (such as OU=Techs, DC=Domain, DC=Local) then my search works without a problem.

If I change the search location to the entire Active Directory (DC=Domain, DC=Local) then my search returns "Warning: ldap_search() [function.ldap-search]: Search: No such object in C:\snm_fn\group_fn.php on line 11".

Does LDAP allow you to search the entire directory, or am I doing something wrong.

Thanks for any help, Dan.

Code:
$dc = ldap_connect($snm["ldapserver"], $ldap_port);

if ($dc) {
//Set user details to bind to the active directory.
ldap_bind($dc, $snm["ldapuser"], $snm["ldappassword"]);

//Set the search parameters
$s_filter = "(&(objectCategory=group))";
$s_fields = array("cn");

$searchresults = ldap_search($dc, "DC=domain, DC=local", $s_filter, $s_fields); //Perform the search
$data = ldap_get_entries($dc, $searchresults); //Get LDAP search results

print_r($data);

ldap_close($dc);
}
Link to comment
https://forums.phpfreaks.com/topic/23596-ldap-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.