From 8ed5524101fa6ff8d7dbe30d36dd88da853d9e56 Mon Sep 17 00:00:00 2001 From: jengo Date: Fri, 17 Nov 2000 15:35:25 +0000 Subject: [PATCH] Cleaned up error reporting for LDAP connections --- setup/config.php | 11 ++++++++--- setup/ldap.php | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/setup/config.php b/setup/config.php index a6dfe397f8..b30cf9cf46 100644 --- a/setup/config.php +++ b/setup/config.php @@ -32,9 +32,7 @@ $db->Password = $phpgw_info["server"]["db_pass"]; if ($newsettings["auth_type"] != "ldap") { - echo "phpGroupWare - setup"; - echo ''; - echo "
phpGroupWare version " . $phpgw_info["server"]["version"] . " setup

"; + setup_header(); } if ($submit) { @@ -65,6 +63,13 @@ while (@$db->next_record()) { $current_config[$db->f("config_name")] = $db->f("config_value"); } + + if ($error == "badldapconnection") { + // Please check the number and dial again :) + echo "

Error: There was a problem tring to connect to your LDAP server, please " + . "check your config.
"; + } + ?>
diff --git a/setup/ldap.php b/setup/ldap.php index f48dd33bc4..76d6722be6 100644 --- a/setup/ldap.php +++ b/setup/ldap.php @@ -41,10 +41,19 @@ // First, see if we can connect to the LDAP server, if not send `em back to config.php with an // error message. - $ldap = @$common->ldapConnect($config["ldap_host"],$config["ldap_root_dn"],$config["ldap_root_pw"]); + + // connect to ldap server + if (! $ldap = @ldap_connect($config["ldap_host"])) { + $noldapconnection = True; + } + + // bind as admin, we not to able to do everything + if (! @ldap_bind($ldap,$config["ldap_root_dn"],$config["ldap_root_pw"])) { + $noldapconnection = True; + } - if (! $ldap) { - Header("Location: config.php?error=ldapconnect"); + if ($noldapconnection) { + Header("Location: config.php?error=badldapconnection"); exit; }