diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 1be3e358fcaef9f62a6a444c0032a2b104f33c82..98555afc016233afa0547374084d8f3a35258cfd 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -19,11 +19,14 @@ class SimpleSAML_Auth_LDAP { /** * private constructor restricts instantiaton to getInstance() */ - public function __construct($hostname, $enable_tls = true) { + public function __construct($hostname, $enable_tls = TRUE, $debug = FALSE) { - SimpleSAML_Logger::debug('Library - LDAP __construct(): Setup LDAP with host [' . $hostname . '] and tls [' . var_export($enable_tls, true) . ']'); + SimpleSAML_Logger::debug('Library - LDAP __construct(): Setup LDAP with ' . + 'host [' . $hostname . '] and ' . + 'tls [' . var_export($enable_tls, TRUE) . ']' . + 'debug [' . var_export($debug, TRUE) . ']'); -# ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); + if ($debug) ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); $this->ldap = @ldap_connect($hostname); # ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, 2); # ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, 2); diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php index 4f1523391e68830c9749d5fa28215a9a067f2c63..c9e5aa5466b38779c828344bdce8fe46e447a0b4 100644 --- a/modules/ldapstatus/www/index.php +++ b/modules/ldapstatus/www/index.php @@ -16,6 +16,7 @@ $ldapStatusConfig = $config->copyFromBase('ldapstatus', 'module_ldapstatus.php') $pingcommand = $ldapStatusConfig->getValue('ping'); +$debug = $ldapconfig->getValue('ldapDebug', FALSE); $orgs = $ldapconfig->getValue('orgldapconfig'); @@ -88,7 +89,7 @@ foreach ($orgs AS $orgkey => $orgconfig) { // LDAP Connect try { - $ldap = new SimpleSAML_Auth_LDAP($orgconfig['hostname'], (array_key_exists('enable_tls', $orgconfig) ? $orgconfig['enable_tls'] : FALSE)); + $ldap = new SimpleSAML_Auth_LDAP($orgconfig['hostname'], (array_key_exists('enable_tls', $orgconfig) ? $orgconfig['enable_tls'] : FALSE), $debug); $results[$orgkey]['connect'] = array(TRUE,NULL); } catch (Exception $e) { $results[$orgkey]['connect'] = array(FALSE,$e->getMessage());