More work on LDAP admin section

This commit is contained in:
jengo 2000-10-20 05:51:27 +00:00
parent ac8d54a110
commit 0295005a6e
3 changed files with 34 additions and 10 deletions

View File

@ -23,18 +23,16 @@
{ {
global $phpgw_info; global $phpgw_info;
$phpgw_info["server"]["ldap_encryption_type"] = "DES"; if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") {
$salt = randomstring(2);
$userpassword = descryptpass($account_info["passwd"], $salt);
}
if ($phpgw_info["server"]["ldap_encryption_type"] == "MD5") { if ($phpgw_info["server"]["ldap_encryption_type"] == "MD5") {
$salt = randomstring(9); $salt = randomstring(9);
$userpassword = md5cryptpass($account_info["passwd"], $salt); $userpassword = md5cryptpass($account_info["passwd"], $salt);
} }
if ($phpgw_info["server"]["ldap_encryption_type"] == "DES") {
$salt = randomstring(2);
$userpassword = descryptpass($account_info["passwd"], $salt);
}
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]); $ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
if (! ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) { if (! ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) {

View File

@ -11,7 +11,8 @@
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True, "currentapp" => "home", "noapi" => True); $phpgw_info["flags"] = array("noheader" => True, "nonavbar" => True,
"currentapp" => "home", "noapi" => True);
include("../header.inc.php"); include("../header.inc.php");
$phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi"; $phpgw_info["server"]["api_dir"] = $phpgw_info["server"]["include_root"]."/phpgwapi";
@ -25,12 +26,12 @@
/* Database setup */ /* Database setup */
include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php"); include($phpgw_info["server"]["api_dir"] . "/phpgw_db_".$phpgw_info["server"]["db_type"].".inc.php");
$db = new db; $db = new db;
$db->Host = $phpgw_info["server"]["db_host"]; $db->Host = $phpgw_info["server"]["db_host"];
$db->Type = $phpgw_info["server"]["db_type"]; $db->Type = $phpgw_info["server"]["db_type"];
$db->Database = $phpgw_info["server"]["db_name"]; $db->Database = $phpgw_info["server"]["db_name"];
$db->User = $phpgw_info["server"]["db_user"]; $db->User = $phpgw_info["server"]["db_user"];
$db->Password = $phpgw_info["server"]["db_pass"]; $db->Password = $phpgw_info["server"]["db_pass"];
echo "<title>phpGroupWare - setup</title>"; echo "<title>phpGroupWare - setup</title>";
echo '<body bgcolor="FFFFFF">'; echo '<body bgcolor="FFFFFF">';
@ -167,6 +168,28 @@
<td><input name="newsettings[ldap_context]" value="<?php echo $current_config["ldap_context"]; ?>"></td> <td><input name="newsettings[ldap_context]" value="<?php echo $current_config["ldap_context"]; ?>"></td>
</tr> </tr>
<tr bgcolor="e6e6e6">
<td>LDAP root dn:</td>
<td><input name="newsettings[ldap_root_dn]" value="<?php echo $current_config["ldap_root_dn"]; ?>"></td>
</tr>
<tr bgcolor="e6e6e6">
<td>LDAP root password:</td>
<td><input name="newsettings[ldap_root_pw]" value="<?php echo $current_config["ldap_root_pw"]; ?>"></td>
</tr>
<?php $selected[$current_config["ldap_encryption_type"]] = " selected"; ?>
<tr bgcolor="e6e6e6">
<td>LDAP encryption type</td>
<td>
<select name="newsettings[ldap_encryption_type]">
<option value="DES"<?php echo $selected["DES"]; ?>>DES</option>
<option value="MD5"<?php echo $selected["MD5"]; ?>>MD5</option>
</select>
</td>
</tr>
<?php $selected = array(); ?>
<tr bgcolor="e6e6e6"> <tr bgcolor="e6e6e6">
<td>Use cookies to pass sessionid:</td> <td>Use cookies to pass sessionid:</td>
<td><input type="checkbox" name="newsettings[usecookies]" value="True"<?php echo ($current_config["usecookies"]?" checked":""); ?>></td> <td><input type="checkbox" name="newsettings[usecookies]" value="True"<?php echo ($current_config["usecookies"]?" checked":""); ?>></td>

View File

@ -23,6 +23,9 @@
$db->query("insert into config (config_name, config_value) values ('auth_type', 'sql')"); $db->query("insert into config (config_name, config_value) values ('auth_type', 'sql')");
$db->query("insert into config (config_name, config_value) values ('ldap_host', 'localhost')"); $db->query("insert into config (config_name, config_value) values ('ldap_host', 'localhost')");
$db->query("insert into config (config_name, config_value) values ('ldap_context', 'o=phpGroupWare')"); $db->query("insert into config (config_name, config_value) values ('ldap_context', 'o=phpGroupWare')");
$db->query("insert into config (config_name, config_value) values ('ldap_encryption_type', 'DES')");
$db->query("insert into config (config_name, config_value) values ('ldap_root_dn', 'cn=Manager,dc=my-domain,dc=com')");
$db->query("insert into config (config_name, config_value) values ('ldap_root_pw', 'secret')");
$db->query("insert into config (config_name, config_value) values ('usecookies', 'True')"); $db->query("insert into config (config_name, config_value) values ('usecookies', 'True')");
$db->query("insert into config (config_name, config_value) values ('mail_server', 'localhost')"); $db->query("insert into config (config_name, config_value) values ('mail_server', 'localhost')");
$db->query("insert into config (config_name, config_value) values ('mail_server_type', 'imap')"); $db->query("insert into config (config_name, config_value) values ('mail_server_type', 'imap')");