Re: AD Bind success, search fails [Tiki 5.3, Server 2008]
Update: I think I might know what is going on. I think that LDAP2 is reporting that a bind is successful, when it is not. On line 315 of tiki_root/pear/Net/LDAP2.php is the public function bind
The way it looks to be set up is that it will attempt an automatic connection first and will only attempt the manual bind if the automatic fails. What I *think* is happening is that my AD server is accepting the connection, but since it isn't authenticated correctly it will not return search results. But it doesn't fail in the way that the script expects, so I get no errors, no results, but no further attempts.
I don't know how to fix this. Here is a test script that returns the correct information:
php
$ldap_url = 'ad.url';
$ldap_domain = 'site.domain.ca.us';
$ldap_dn = "dc=site,dc=domain,dc=ca,dc=us";
$ds = ldap_connect( $ldap_url );
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
$username = "spopepro";
$password = "AverySTRONGpassword";
$login = ldap_bind( $ds, "$username@$ldap_domain", $password );
echo '- Logged In Successfully';
try{
$attributes = array("displayName", "mail");
$filter = "(&(objectCategory=user)(sAMAccountName=$username))";
$result = ldap_search($ds, $ldap_dn, $filter, $attributes);
$entries = ldap_get_entries($ds, $result);
if($entries%22count%22 > 0){
echo "User Information:";
echo "displayName: ".$entries0'displayname'0."";
echo "email: ".$entries0'mail'0."";
}
}catch(Exception $e){
ldap_unbind($ds);
return;
}
ldap_unbind($ds);
echo '- Logged Out';
/php
Any ideas if I am on the right track here? What can I do to further debug?