Commit 64f0dae2 authored by Ad Schellevis's avatar Ad Schellevis

(ldap) add network timeout including default setting

parent 5c283b30
...@@ -203,12 +203,14 @@ class LDAP implements IAuthConnector ...@@ -203,12 +203,14 @@ class LDAP implements IAuthConnector
* @param $bind_url string url to use * @param $bind_url string url to use
* @param null $userdn connect dn to use, leave empty for anonymous * @param null $userdn connect dn to use, leave empty for anonymous
* @param null $password password * @param null $password password
* @param int $timeout network timeout
* @return bool connect status (success/fail) * @return bool connect status (success/fail)
*/ */
public function connect($bind_url, $userdn = null, $password = null) public function connect($bind_url, $userdn = null, $password = null, $timeout = 30)
{ {
$this->closeLDAPHandle(); $this->closeLDAPHandle();
$this->ldapHandle = @ldap_connect($bind_url); $this->ldapHandle = @ldap_connect($bind_url);
ldap_set_option($this->ldapHandle, LDAP_OPT_NETWORK_TIMEOUT, $timeout);
if ($this->ldapHandle !== false) { if ($this->ldapHandle !== false) {
ldap_set_option($this->ldapHandle, LDAP_OPT_REFERRALS, 0); ldap_set_option($this->ldapHandle, LDAP_OPT_REFERRALS, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment