ID: 19494 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: LDAP related Operating System: Linux 2.4.17 PHP Version: 4.2.2 and 4.3.0-dev New Comment:
When you use OpenLDAP 2 or other libraries that use the new LDAP API, ldap_connect() will only create some state on the client, the server is not contacted until you later do an LDAP operation like search or bind. There are no DNS lookups either, so ldap_connect("jlkdsfjsdk") will be successful. This means that ldap_connect() will almost always return true, while later operations might very well fail. Another difference worth noting, is that for anonymous access there is no more need for ldap_bind(). You just do your search. Previous Comments: ------------------------------------------------------------------------ [2002-09-24 04:26:52] [EMAIL PROTECTED] this is what the config line looks like: $CONFIG["ldap_server"] = "ldaps://my.ldap.server"; and then i do: $ds=ldap_connect($CONFIG["ldap_server"]); even if there would be a difference shouldnt be the result of ldap_connect be FALSE. and ldap_error($ds) give an error >From the docs: Returns a positive LDAP link identifier on success, or FALSE on error. ------------------------------------------------------------------------ [2002-09-24 04:15:52] [EMAIL PROTECTED] If $CONFIG["ldap-server"] is defined as "ldaps://my.ldap.server" then it's exactly the same for PHP. There is NO way that this could be a problem. Are you very sure there isn't a trailing newline or a \0 somehwere? Derick ------------------------------------------------------------------------ [2002-09-24 04:12:47] [EMAIL PROTECTED] Well it seems like ldap_connect has some problem. 1. Scenario $ds=ldap_connect($CONFIG["ldap_server"]); -> echo $ldap_error($ds) say "Success" but ldap_bind fails (also $ds is true and var_dump says "ressource (X) of type (ldap link)") 2. Scenario $ds=ldap_connect("ldaps://my.ldap.server"); -> echo $ldap_error($ds) say success and ldap_bind works. of course $CONFIG["ldap-server"] is defined as "ldaps://my.ldap.server" i checked that 3 times. So is this right that ldap_connect says everything is OK though it is not really ? Chris ------------------------------------------------------------------------ [2002-09-23 08:54:10] [EMAIL PROTECTED] very funny, when i use URL-syntax in ldap_connect it works. the state after the ldap_connect seems to be identical except that the ldap_bind now works with and without bind-dn ------------------------------------------------------------------------ [2002-09-23 01:43:27] [EMAIL PROTECTED] thought that too after i read that on some other bug here. i tried with ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3) still no change. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/19494 -- Edit this bug report at http://bugs.php.net/?id=19494&edit=1