i have problem ldap connection.
$hostname="ldap://sub.domain.com"; $ds=ldap_connect($hostname, 389); ldap_set_option ($ds, ldap_opt_referrals, 0) or die('unable set ldap opt referrals'); ldap_set_option($ds, ldap_opt_protocol_version, 3) or die('unable set ldap protocol version'); if ($ds) { $dn = "ou=users,ou=ro,dc=sub,dc=domain,dc=com"; if (!($ldapc=ldap_bind($ds))) { echo "<p>error:" . ldap_error($ds) . "</p>"; echo "<p>error number:" . ldap_errno($ds) . "</p>"; echo "<p>error:" . ldap_err2str(ldap_errno($ds)) . "</p>"; die; } $attributes = array("sn"); $filter = "(sn=*)"; $result = ldap_search($ds, $dn, $filter, $attributes); echo $result; $info = ldap_get_entries($ds, $result); ($i=0; $i < $info["count"]; $i++) { echo $info[$i]["ou"][0]; } } else { echo "<h4>unable connect ldap server</h4>"; } ldap_unbind($ds); the ldap anonymous connection works because test in ad browser , fine. in code stops at
ldap_search($ds, $dn, $filter, $attributes); i receive warning:
warning: ldap_search(): search: operations error in ..\index.php on line 38
i don't know can cause of error, appreciate help.
to off unanswered list:
i found problem, bind problem. server accepts anonymous bind not search. , user , pass worked making mistake. user considered de windows's username not location ad, works.
Comments
Post a Comment