diff options
author | Andreas Åkre Solberg <andreas.solberg@uninett.no> | 2009-01-20 12:57:03 +0000 |
---|---|---|
committer | Andreas Åkre Solberg <andreas.solberg@uninett.no> | 2009-01-20 12:57:03 +0000 |
commit | 48d7a75fadda7cda8bfba4a298c170bae4f8f687 (patch) | |
tree | 8d6e8f95832b799c330cc8e6a02b01c3eaf26a1b | |
parent | 3ae5eead194f6aff3ec3ba7e3d5718fc27f03179 (diff) | |
download | simplesamlphp-48d7a75fadda7cda8bfba4a298c170bae4f8f687.zip simplesamlphp-48d7a75fadda7cda8bfba4a298c170bae4f8f687.tar.gz simplesamlphp-48d7a75fadda7cda8bfba4a298c170bae4f8f687.tar.bz2 |
Enable LDAP debugging
git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1181 44740490-163a-0410-bde0-09ae8108e29a
-rw-r--r-- | lib/SimpleSAML/Auth/LDAP.php | 9 | ||||
-rw-r--r-- | modules/ldapstatus/www/index.php | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 1be3e35..98555af 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 4f15233..c9e5aa5 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()); |