Skip to content
Snippets Groups Projects
Commit 48d7a75f authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Enable LDAP debugging

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1181 44740490-163a-0410-bde0-09ae8108e29a
parent 3ae5eead
No related branches found
No related tags found
No related merge requests found
...@@ -19,11 +19,14 @@ class SimpleSAML_Auth_LDAP { ...@@ -19,11 +19,14 @@ class SimpleSAML_Auth_LDAP {
/** /**
* private constructor restricts instantiaton to getInstance() * 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); $this->ldap = @ldap_connect($hostname);
# ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, 2); # ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, 2);
# ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, 2); # ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, 2);
......
...@@ -16,6 +16,7 @@ $ldapStatusConfig = $config->copyFromBase('ldapstatus', 'module_ldapstatus.php') ...@@ -16,6 +16,7 @@ $ldapStatusConfig = $config->copyFromBase('ldapstatus', 'module_ldapstatus.php')
$pingcommand = $ldapStatusConfig->getValue('ping'); $pingcommand = $ldapStatusConfig->getValue('ping');
$debug = $ldapconfig->getValue('ldapDebug', FALSE);
$orgs = $ldapconfig->getValue('orgldapconfig'); $orgs = $ldapconfig->getValue('orgldapconfig');
...@@ -88,7 +89,7 @@ foreach ($orgs AS $orgkey => $orgconfig) { ...@@ -88,7 +89,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
// LDAP Connect // LDAP Connect
try { 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); $results[$orgkey]['connect'] = array(TRUE,NULL);
} catch (Exception $e) { } catch (Exception $e) {
$results[$orgkey]['connect'] = array(FALSE,$e->getMessage()); $results[$orgkey]['connect'] = array(FALSE,$e->getMessage());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment