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

bugfix for ldap status page with admin and test user access

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1179 44740490-163a-0410-bde0-09ae8108e29a
parent 1f3008c6
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@ class SimpleSAML_Auth_LDAP {
SimpleSAML_Logger::debug('Library - LDAP __construct(): Setup LDAP with host [' . $hostname . '] and tls [' . var_export($enable_tls, true) . ']');
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);
......
......@@ -88,7 +88,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
// LDAP Connect
try {
$ldap = new SimpleSAML_Auth_LDAP($orgconfig['hostname'], $orgconfig['enable_tls']);
$ldap = new SimpleSAML_Auth_LDAP($orgconfig['hostname'], (array_key_exists('enable_tls', $orgconfig) ? $orgconfig['enable_tls'] : FALSE));
$results[$orgkey]['connect'] = array(TRUE,NULL);
} catch (Exception $e) {
$results[$orgkey]['connect'] = array(FALSE,$e->getMessage());
......@@ -98,8 +98,12 @@ foreach ($orgs AS $orgkey => $orgconfig) {
// Bind as admin user
if (isset($orgconfig['adminUser'])) {
try {
$ldap->bind($orgconfig['adminUser'], $orgconfig['adminPassword']);
$results[$orgkey]['adminBind'] = array(TRUE,NULL);
$success = $ldap->bind($orgconfig['adminUser'], $orgconfig['adminPassword']);
if ($success) {
$results[$orgkey]['adminBind'] = array(TRUE,NULL);
} else {
$results[$orgkey]['adminBind'] = array(FALSE,'Could not bind()' );
}
} catch (Exception $e) {
$results[$orgkey]['adminBind'] = array(FALSE,$e->getMessage());
continue;
......@@ -107,7 +111,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
}
$eppn = 'test@feide.no';
$eppn = 'asdasdasdasd@feide.no';
// Search for bogus user
try {
$dn = $ldap->searchfordn($orgconfig['searchbase'], 'eduPersonPrincipalName', $eppn, TRUE);
......@@ -123,7 +127,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
// Try to search for DN of test account
try {
$dn = $ldap->searchfordn($orgconfig['searchbase'], 'eduPersonPrincipalName', $eppn);
$dn = $ldap->searchfordn($orgconfig['searchbase'], 'eduPersonPrincipalName', $orgconfig['testUser']);
$results[$orgkey]['ldapSearchTestUser'] = array(TRUE,NULL);
} catch (Exception $e) {
$results[$orgkey]['ldapSearchTestUser'] = 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