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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.