From a063f79b1a2aacc5972b75913727d46f8e16ed83 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Mon, 17 Aug 2009 09:06:02 +0000 Subject: [PATCH] SimpleSAML_Auth_LDAP: Don't set timeout options to 0. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1680 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Auth/LDAP.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 32ce1e804..948b63132 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -71,10 +71,12 @@ class SimpleSAML_Auth_LDAP { // (OpenLDAP 2.x.x or Netscape Directory SDK x.x needed). // TODO: Should these be moved to before ldap_connect() above? $this->timeout = $timeout; - if (!@ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, $timeout)) - SimpleSAML_Logger::warning('Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_NETWORK_TIMEOUT) to ' . $timeout); - if (!@ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, $timeout)) - SimpleSAML_Logger::warning('Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_TIMELIMIT) to ' . $timeout); + if ($timeout > 0) { + if (!@ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, $timeout)) + SimpleSAML_Logger::warning('Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_NETWORK_TIMEOUT) to ' . $timeout); + if (!@ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, $timeout)) + SimpleSAML_Logger::warning('Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_TIMELIMIT) to ' . $timeout); + } // Enable TLS, if needed. if (!preg_match("/ldaps:/i", $hostname) and $enable_tls) -- GitLab