diff --git a/config-templates/authsources.php b/config-templates/authsources.php index fd16d4cf434250e6935a4e25f2f36a860b1f0330..aee707ce1b85cd7c2a787d3d6dfb3e91f9c63ae9 100644 --- a/config-templates/authsources.php +++ b/config-templates/authsources.php @@ -95,6 +95,18 @@ $config = array( /* Whether SSL/TLS should be used when contacting the LDAP server. */ 'enable_tls' => FALSE, + /* + * Whether debug output from the LDAP library should be enabled. + * Default is FALSE. + */ + 'debug' => FALSE, + + /* + * The timeout for accessing the LDAP server, in seconds. + * The default is 0, which means no timeout. + */ + 'timeout' => 0, + /* * Which attributes should be retrieved from the LDAP server. * This can be an array of attribute names, or NULL, in which case diff --git a/modules/ldap/lib/ConfigHelper.php b/modules/ldap/lib/ConfigHelper.php index b7b514e866f5632c1ffdc165a92ee2f0b3de5257..8f1dd5634224e97dbcc9e9bb77bee8ce1c24a4d5 100644 --- a/modules/ldap/lib/ConfigHelper.php +++ b/modules/ldap/lib/ConfigHelper.php @@ -31,6 +31,22 @@ class sspmod_ldap_ConfigHelper { private $enableTLS; + /** + * Whether debug output is enabled. + * + * @var bool + */ + private $debug; + + + /** + * The timeout for accessing the LDAP server. + * + * @var int + */ + private $timeout; + + /** * Whether we need to search for the users DN. */ @@ -108,6 +124,8 @@ class sspmod_ldap_ConfigHelper { $this->hostname = $config->getString('hostname'); $this->enableTLS = $config->getBoolean('enable_tls', FALSE); + $this->debug = $config->getBoolean('debug', FALSE); + $this->timeout = $config->getInteger('timeout', 0); $this->searchEnable = $config->getBoolean('search.enable', FALSE); $this->privRead = $config->getBoolean('priv.read', FALSE); @@ -148,7 +166,7 @@ class sspmod_ldap_ConfigHelper { assert('is_string($username)'); assert('is_string($password)'); - $ldap = new SimpleSAML_Auth_LDAP($this->hostname, $this->enableTLS); + $ldap = new SimpleSAML_Auth_LDAP($this->hostname, $this->enableTLS, $this->debug, $this->timeout); if (!$this->searchEnable) { $ldapusername = addcslashes($username, ',+"\\<>;*');