Cleaned up error reporting for LDAP connections

This commit is contained in:
jengo 2000-11-17 15:35:25 +00:00
parent 406e39d1d3
commit 8ed5524101
2 changed files with 20 additions and 6 deletions

View File

@ -32,9 +32,7 @@
$db->Password = $phpgw_info["server"]["db_pass"];
if ($newsettings["auth_type"] != "ldap") {
echo "<title>phpGroupWare - setup</title>";
echo '<body bgcolor="FFFFFF">';
echo "<center>phpGroupWare version " . $phpgw_info["server"]["version"] . " setup</center><p>";
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 "<br><center><b>Error:</b> There was a problem tring to connect to your LDAP server, please "
. "check your config.</center>";
}
?>
<form method="POST" action="config.php">
<table border="0" align="center">

View File

@ -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"]);
if (! $ldap) {
Header("Location: config.php?error=ldapconnect");
// 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 ($noldapconnection) {
Header("Location: config.php?error=badldapconnection");
exit;
}