Jump to content

Archived

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

dan400007

LDAP. Help please!

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);
}

Share this post


Link to post
Share on other sites

×

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.