#15637 [Opn->Fbk]: if using URI, ldap_connect() returns resource ID when server does not exist
| From: | iliaa@php.net | Date: | Mon, 20 Jan 2003 22:12:26 +0000 |
| Subject: | #15637 [Opn->Fbk]: if using URI, ldap_connect() returns resource ID when server does not exist | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30721@lists.php.net to get a copy of this message | ||
ID: 15637
Updated by: iliaa@php.net
Reported By: cjm46543@hotmail.com
-Status: Open
+Status: Feedback
Bug Type: LDAP related
Operating System: Linux - RedHat 7.2
PHP Version: 4.4.0-dev
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
With latest CVS it returns FALSE when appropriate, cannot replicate the
problem.
Previous Comments:
------------------------------------------------------------------------
[2003-01-17 22:26:57] philip@php.net
I cannot get ldap_connect() to return false under ANY conditions,
including with the examples provided in this bug report. I find this
behavior impossible to document, please have another look at this.
Reclassifying -> ldap related.
Shouldn't these return false? They are not URI's:
var_dump(ldap_connect('foo'));
var_dump(ldap_connect('does.not.exist'));
I get resources with both. apache1.3.26/php4.4/openldap2.0.23
------------------------------------------------------------------------
[2003-01-06 11:28:38] martin@kouba.at
when using an ip address ldap_connect doesn't work as described.
$server = "10.1.1.100";
$port = "389";
$ds = ldap_connect($server, $port);
the result is true even if the server does not exist or the service is
not running.
------------------------------------------------------------------------
[2002-12-27 16:27:34] W.Regenczuk@adbglobal.com
I have observed something like this (in php-4.30rc3):
The whole script:
<?
$ldaphost = "nonexistendserver";
$ldapport = 389;
$ldapconn = ldap_connect( $ldaphost, $ldapport )
or die( "Could not connect to {$ldaphost}" );
echo $ldapconn; // display a valid ldap resource
?>
regards.
------------------------------------------------------------------------
[2002-11-29 09:07:12] f.labanvoye@cg70.fr
Hello,
in php-4.30rcX, the ldap_connect doesn't perform the connection, so
documentation should be updated.
But, the documention (on zend site) for ldap_connect is:
ldap_connect() establishes a connection to a LDAP server on a
specified
hostname and port. Both the arguments are optional. --> If no
arguments
are specified then the link identifier of the already opened link will
be returned.
In my script i don't have any previous opened link, so i think the
function would return FALSE.
Or the documention is wrong and need correction.
<?php
$ds = ldap_connect ( );
echo $ds // return a valid ldap resource
?>
Sincerely
------------------------------------------------------------------------
[2002-10-31 15:09:44] rattray@purdue.edu
mfischer@php.net suggests that "Checking the return code of ldap_bind()
would be the proper thing to do anyway." However, the act of calling
ldap_bind generates an error message on the page, e.g.:
"Warning: LDAP: Unable to bind to server: Can't contact LDAP server in
/home/shop/www/ldaps-1.php on line 8"
before any check can be made on the results of ldap_bind().
We are trying to create our first secure ldap system, and the
false-positive returns from ldap_connect() are making it difficult to
track down problems.
------------------------------------------------------------------------
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/15637
--
Edit this bug report at http://bugs.php.net/?id=15637&edit=1