Timeout parameter for ldap_bind() and/or ldap_connect()
| Bug #42837 | Timeout parameter for ldap_bind() and/or ldap_connect() | ||||
|---|---|---|---|---|---|
| Submitted: | 2007-10-03 14:07 UTC | Modified: | 2007-10-06 01:48 UTC | ||
| From: | fernando dot wendt at gmail dot com | Assigned: | jani (profile) | ||
| Status: | Closed | Package: | LDAP related | ||
| PHP Version: | 5.2.4 | OS: | GNU-Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2007-10-03 14:07 UTC] fernando dot wendt at gmail dot com
Description:
------------
I do suggest that PHP LDAP functions "ldap_bind" and/or "ldap_connect" are improved to suport a new parameter to control network timeout over the request.
At some cases, the HTTP request is send to webserver (like Ajax can do), and it can't be handling for stop processing - on the server side (because XMLHTTPRequest has an "abort" method avaliable - for the client side). So, if there are a lot of online users trying to get the same LDAP large entries, the webserver probably hangs up (or even crashes).
That hangs on the request processing for large data ranges from LDAP data sources (i.e: more than 5000 entries). Plus, the network state is too involved at this new suggested behavior, in order to be manipulated at some way.
So, adding this parameter function, PHP could limits the request response in order to control it, by the time.
Reproduce code:
---------------
$host = "localhost";
$basedn = "ou=MYCOMPANY";
if ($con = ldap_connect($host)){
ldap_set_option($con, LDAP_OPT_TIMELIMIT, 10);
echo "Connected";
$ldapbind = ldap_bind($con);
if ($ldapbind){
//echo "Bind OK";
$search = ldap_search($con, $basedn, "(cn=*)");
echo "LDAP Entries:" . ldap_count_entries($con, $search);
}
else
echo "No bind";
ldap_unbind($con);
}
else
echo "Not connected";
Expected result:
----------------
I would like to specify at ldap_connect($host, $time) and/or ldap_bind($con, $time) the number of seconds that request could be hanged on, while not expires.
Actual result:
--------------
As the only time limit is avaliable at ldap_search function, or even ldap_set_option, if there are a lot of entries to be handled, the request is being hanged on a very long time (TCP/IP connection).
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2007-10-06 01:40 UTC] jani@php.net
[2007-10-06 01:48 UTC] jani@php.net