can bind but cannot search?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

The following script returns 'search failed...' after 'LDAP bind successful...'.

==
<?php

$ldaprdn = "CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu";
$ldappass = "passwd";

$ds=ldap_connect("ad.coll.some.edu");

if ($ds) {
   echo "Binding ...<br />";
   $r=ldap_bind($ds, $ldaprdn, $ldappass);

   if ($r) {
       echo "LDAP bind successful...<br />";
   } else {
       echo "LDAP bind failed...<br />";
       exit;
   }

   $filter = "(sAMAccountName=jsmith)";
   $base = "DC=Coll,DC=some,DC=edu";

   $sr=ldap_search($ds, $base, $filter);

   if ($sr)
   {
     echo "Search result is " . $sr . "<br />";
   } else {
             echo "search failed...<br />";
          }
}
?>
==

However, the following ldapsearch returns the result fine.

% ldapsearch -h ad.coll.some.edu -s sub -b "dc=coll,dc=some,dc=edu" -x -D 'CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu' -W "samaccountname=jsmith"

I'm in dark now and don't know where to look for more information on why ldap_search did not work. I'd appreciate any help.

Bing

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux