ID:               42837
 Updated by:       [EMAIL PROTECTED]
 Reported By:      fernando dot wendt at gmail dot com
-Status:           Assigned
+Status:           Closed
 Bug Type:         LDAP related
 Operating System: GNU-Linux
 PHP Version:      5.2.4
 Assigned To:      jani
 New Comment:

Patch applied to PHP_5_3 branch and will be available as of PHP 5.3.0
and above.


Previous Comments:
------------------------------------------------------------------------

[2007-10-06 01:40:59] [EMAIL PROTECTED]

This is duplicate of bug #41017

I have a patch pending which makes LDAP_OPT_NETWORK_TIMEOUT option
available to ldap_get_option/ldap_set_option functions.

Basic usage:

<?php

$ld = ldap_connect("ldap.example.com");
ldap_set_option($ld, LDAP_OPT_NETWORK_TIMEOUT, 10); /* 10 second
timeout */
ldap_bind($ld);

?>

This will now not just hang there indefinately but will bail out after
10s if bind does not succeed before.


------------------------------------------------------------------------

[2007-10-03 14:07:35] 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).


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42837&edit=1

Reply via email to