#30670 [Com]: ldap_search does not work on Windows 2003 directories (but other tools do)
| From: | p dot boven at chello dot nl | Date: | Wed, 12 Jan 2005 23:12:16 +0000 |
| Subject: | #30670 [Com]: ldap_search does not work on Windows 2003 directories (but other tools do) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-71994@lists.php.net to get a copy of this message | ||
ID: 30670
Comment by: p dot boven at chello dot nl
Reported By: michael dot siebke at keymile dot com
Status: Open
Bug Type: LDAP related
Operating System: Linux (Redhat 8)
PHP Version: 5.0.1
New Comment:
Hi,
This is not a PHP bug imho: the problem is that Windows 2003 -must-
have some options set between the ldap_connect and ldap_bind:
$ldap = ldap_connect($ldap_url);
...
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS,0);
...
ldap_bind($ldap, $ldap_user, $ldap_passwd)
Works fine for me with PHP 4.3.x, Solaris 9 (Sparc), ADS W2k3.
Regards, Paul Boven.
Previous Comments:
------------------------------------------------------------------------
[2004-11-03 09:03:58] michael dot siebke at keymile dot com
Description:
------------
It's not possible to search a Windows 2003 active directory using the
LDAP interface (Windows 2000 works fine). However, using other tools
(like LDAP browers), searching the Windows 2003 directory works. The
problems occurs only using the PHP library.
Reproduce code:
---------------
$connect = ldap_connect("[i]server.domain.de[/i]");
if ($connect != FALSE) {
$res = ldap_bind($connect, "[i]username[/i]",
"[i]password[/i]");
if ($res == FALSE) {
echo "Unable to bind to LDAP server<br>";
exit;
}
$attributes = array("sAMAccountName", "dn", "mail");
$data = ldap_search($connect, "[i]DC=company,DC=de[/i]",
"(sAMAccountName=[i]targetaccount[/i])");
if ($data != FALSE) {
echo "Reading data...<br>";
$data = ldap_get_entries($connect, $data);
} else {
echo "Nothing :-(<br>";
}
ldap_close($connect);
}
Expected result:
----------------
"Reading data..."
Actual result:
--------------
Warning: ldap_search() [function.ldap-search]: Search: Operations error
in /data/htdocs/hd5dev/Test.php on line 57
Nothing :-(
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30670&edit=1