added cache timeout variable

This commit is contained in:
Roland Gruber 2003-08-18 15:21:27 +00:00
parent 0eb23e99f5
commit 2654a8446f
5 changed files with 307 additions and 301 deletions

View File

@ -100,6 +100,8 @@ $helpArray = array (
"<br><br><b>". "<br><br><b>".
_("LAM will not work if version is wrong!"). _("LAM will not work if version is wrong!").
"</b>"), "</b>"),
"214" => array ("ext" => "FALSE", "Headline" => _("Configuration Wizard") . " - " . _("Cache timeout"),
"Text" => _("This is the time in minutes which LAM caches its LDAP searches. Shorter times will stress LDAP more but decrease the possibility that changes are not identified.")),
// 300 - 399 // 300 - 399
// Roland Gruber // Roland Gruber
// profile editor // profile editor

View File

@ -87,9 +87,6 @@ class Config {
// suffix for domains (Samba 3) // suffix for domains (Samba 3)
var $Suff_domains; var $Suff_domains;
// suffix for user/group mappings (Samba 3)
//var $Suff_map;
// minimum/maximum numbers for UID, GID and UID of Samba Hosts // minimum/maximum numbers for UID, GID and UID of Samba Hosts
var $MinUID; var $MinUID;
var $MaxUID; var $MaxUID;
@ -117,6 +114,9 @@ class Config {
// if "yes" use the new LDAP schema for Samba 3.x // if "yes" use the new LDAP schema for Samba 3.x
var $samba3; var $samba3;
// LDAP cache timeout
var $cache_timeout;
// name of configuration file // name of configuration file
var $file; var $file;
@ -169,10 +169,6 @@ class Config {
$this->Suff_domains = chop(substr($line, 14, strlen($line)-14)); $this->Suff_domains = chop(substr($line, 14, strlen($line)-14));
continue; continue;
} }
/* if (substr($line, 0, 11) == "mapsuffix: ") {
$this->Suff_map = chop(substr($line, 11, strlen($line)-11));
continue;
}*/
if (substr($line, 0, 8) == "minUID: ") { if (substr($line, 0, 8) == "minUID: ") {
$this->MinUID = chop(substr($line, 8, strlen($line)-8)); $this->MinUID = chop(substr($line, 8, strlen($line)-8));
continue; continue;
@ -229,6 +225,10 @@ class Config {
$this->samba3 = chop(substr($line, 8, strlen($line)-8)); $this->samba3 = chop(substr($line, 8, strlen($line)-8));
continue; continue;
} }
if (substr($line, 0, 14) == "cacheTimeout: ") {
$this->cache_timeout = chop(substr($line, 14, strlen($line)-14));
continue;
}
} }
fclose($file); fclose($file);
} }
@ -237,214 +237,212 @@ class Config {
} }
} }
// saves preferences to config file // saves preferences to config file
function save() { function save() {
$conffile = substr(__FILE__, 0, strlen(__FILE__) - 15) . "/config/" . $this->file . ".conf"; $conffile = substr(__FILE__, 0, strlen(__FILE__) - 15) . "/config/" . $this->file . ".conf";
if (is_file($conffile) == True) { if (is_file($conffile) == True) {
// booleans to check if value was already saved // booleans to check if value was already saved
$save_serverURL = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst = $save_serverURL = $save_passwd = $save_admins = $save_suffusr = $save_suffgrp = $save_suffhst =
$save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach = $save_minUID = $save_maxUID = $save_minGID = $save_maxGID = $save_minMach = $save_maxMach =
$save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = $save_maxlstent = $save_deflang = $save_usrlstatrr = $save_grplstatrr = $save_hstlstatrr = $save_maxlstent = $save_deflang =
$save_scriptPath = $save_scriptServer = $save_samba3 = $save_suffdom = $save_scriptPath = $save_scriptServer = $save_samba3 = $save_suffdom = $save_cachetime = False;
$save_suffmap = False; $file = fopen($conffile, "r");
$file = fopen($conffile, "r"); $file_array = array();
$file_array = array(); // read config file
// read config file while (!feof($file)) {
while (!feof($file)) { array_push($file_array, fgets($file, 1024));
array_push($file_array, fgets($file, 1024)); }
} fclose($file);
fclose($file); // generate new configuration file
// generate new configuration file for ($i = 0; $i < sizeof($file_array); $i++) {
for ($i = 0; $i < sizeof($file_array); $i++) { if (($file_array[$i] == "\n")||($file_array[$i][0] == "#")) continue; // ignore comments
if (($file_array[$i] == "\n")||($file_array[$i][0] == "#")) continue; // ignore comments // search for keywords
// search for keywords if (substr($file_array[$i], 0, 11) == "serverURL: ") {
if (substr($file_array[$i], 0, 11) == "serverURL: ") { $file_array[$i] = "serverURL: " . $this->ServerURL . "\n";
$file_array[$i] = "serverURL: " . $this->ServerURL . "\n"; $save_serverURL = True;
$save_serverURL = True; continue;
continue; }
} if (substr($file_array[$i], 0, 8) == "passwd: ") {
if (substr($file_array[$i], 0, 8) == "passwd: ") { $file_array[$i] = "passwd: " . $this->Passwd . "\n";
$file_array[$i] = "passwd: " . $this->Passwd . "\n"; $save_passwd = True;
$save_passwd = True; continue;
continue; }
} if (substr($file_array[$i], 0, 8) == "admins: ") {
if (substr($file_array[$i], 0, 8) == "admins: ") { $file_array[$i] = "admins: " . $this->Adminstring . "\n";
$file_array[$i] = "admins: " . $this->Adminstring . "\n"; $save_admins = True;
$save_admins = True; continue;
continue; }
} if (substr($file_array[$i], 0, 12) == "usersuffix: ") {
if (substr($file_array[$i], 0, 12) == "usersuffix: ") { $file_array[$i] = "usersuffix: " . $this->Suff_users . "\n";
$file_array[$i] = "usersuffix: " . $this->Suff_users . "\n"; $save_suffusr = True;
$save_suffusr = True; continue;
continue; }
} if (substr($file_array[$i], 0, 13) == "groupsuffix: ") {
if (substr($file_array[$i], 0, 13) == "groupsuffix: ") { $file_array[$i] = "groupsuffix: " . $this->Suff_groups . "\n";
$file_array[$i] = "groupsuffix: " . $this->Suff_groups . "\n"; $save_suffgrp = True;
$save_suffgrp = True; continue;
continue; }
} if (substr($file_array[$i], 0, 12) == "hostsuffix: ") {
if (substr($file_array[$i], 0, 12) == "hostsuffix: ") { $file_array[$i] = "hostsuffix: " . $this->Suff_hosts . "\n";
$file_array[$i] = "hostsuffix: " . $this->Suff_hosts . "\n"; $save_suffhst = True;
$save_suffhst = True; continue;
continue; }
} if (substr($file_array[$i], 0, 14) == "domainsuffix: ") {
if (substr($file_array[$i], 0, 14) == "domainsuffix: ") { $file_array[$i] = "domainsuffix: " . $this->Suff_domains . "\n";
$file_array[$i] = "domainsuffix: " . $this->Suff_domains . "\n"; $save_suffdom = True;
$save_suffdom = True; continue;
continue; }
} if (substr($file_array[$i], 0, 8) == "minUID: ") {
/* if (substr($file_array[$i], 0, 11) == "mapsuffix: ") { $file_array[$i] = "minUID: " . $this->MinUID . "\n";
$file_array[$i] = "mapsuffix: " . $this->Suff_map . "\n"; $save_minUID = True;
$save_suffmap = True; continue;
continue; }
}*/ if (substr($file_array[$i], 0, 8) == "maxUID: ") {
if (substr($file_array[$i], 0, 8) == "minUID: ") { $file_array[$i] = "maxUID: " . $this->MaxUID . "\n";
$file_array[$i] = "minUID: " . $this->MinUID . "\n"; $save_maxUID = True;
$save_minUID = True; continue;
continue; }
} if (substr($file_array[$i], 0, 8) == "minGID: ") {
if (substr($file_array[$i], 0, 8) == "maxUID: ") { $file_array[$i] = "minGID: " . $this->MinGID . "\n";
$file_array[$i] = "maxUID: " . $this->MaxUID . "\n"; $save_minGID = True;
$save_maxUID = True; continue;
continue; }
} if (substr($file_array[$i], 0, 8) == "maxGID: ") {
if (substr($file_array[$i], 0, 8) == "minGID: ") { $file_array[$i] = "maxGID: " . $this->MaxGID . "\n";
$file_array[$i] = "minGID: " . $this->MinGID . "\n"; $save_maxGID = True;
$save_minGID = True; continue;
continue; }
} if (substr($file_array[$i], 0, 12) == "minMachine: ") {
if (substr($file_array[$i], 0, 8) == "maxGID: ") { $file_array[$i] = "minMachine: " . $this->MinMachine . "\n";
$file_array[$i] = "maxGID: " . $this->MaxGID . "\n"; $save_minMach = True;
$save_maxGID = True; continue;
continue; }
} if (substr($file_array[$i], 0, 12) == "maxMachine: ") {
if (substr($file_array[$i], 0, 12) == "minMachine: ") { $file_array[$i] = "maxMachine: " . $this->MaxMachine . "\n";
$file_array[$i] = "minMachine: " . $this->MinMachine . "\n"; $save_maxMach = True;
$save_minMach = True; continue;
continue; }
} if (substr($file_array[$i], 0, 20) == "userlistAttributes: ") {
if (substr($file_array[$i], 0, 12) == "maxMachine: ") { $file_array[$i] = "userlistAttributes: " . $this->userlistAttributes . "\n";
$file_array[$i] = "maxMachine: " . $this->MaxMachine . "\n"; $save_usrlstattr = True;
$save_maxMach = True; continue;
continue; }
} if (substr($file_array[$i], 0, 21) == "grouplistAttributes: ") {
if (substr($file_array[$i], 0, 20) == "userlistAttributes: ") { $file_array[$i] = "grouplistAttributes: " . $this->grouplistAttributes . "\n";
$file_array[$i] = "userlistAttributes: " . $this->userlistAttributes . "\n"; $save_grplstattr = True;
$save_usrlstattr = True; continue;
continue; }
} if (substr($file_array[$i], 0, 20) == "hostlistAttributes: ") {
if (substr($file_array[$i], 0, 21) == "grouplistAttributes: ") { $file_array[$i] = "hostlistAttributes: " . $this->hostlistAttributes . "\n";
$file_array[$i] = "grouplistAttributes: " . $this->grouplistAttributes . "\n"; $save_hstlstattr = True;
$save_grplstattr = True; continue;
continue; }
} if (substr($file_array[$i], 0, 16) == "maxlistentries: ") {
if (substr($file_array[$i], 0, 20) == "hostlistAttributes: ") { $file_array[$i] = "maxlistentries: " . $this->maxlistentries . "\n";
$file_array[$i] = "hostlistAttributes: " . $this->hostlistAttributes . "\n"; $save_maxlstent = True;
$save_hstlstattr = True; continue;
continue; }
} if (substr($file_array[$i], 0, 17) == "defaultLanguage: ") {
if (substr($file_array[$i], 0, 16) == "maxlistentries: ") { $file_array[$i] = "defaultLanguage: " . $this->defaultLanguage . "\n";
$file_array[$i] = "maxlistentries: " . $this->maxlistentries . "\n"; $save_deflang = True;
$save_maxlstent = True; continue;
continue; }
} if (substr($file_array[$i], 0, 12) == "scriptPath: ") {
if (substr($file_array[$i], 0, 17) == "defaultLanguage: ") { $file_array[$i] = "scriptPath: " . $this->scriptPath . "\n";
$file_array[$i] = "defaultLanguage: " . $this->defaultLanguage . "\n"; $save_scriptPath = True;
$save_deflang = True; continue;
continue; }
} if (substr($file_array[$i], 0, 14) == "scriptServer: ") {
if (substr($file_array[$i], 0, 12) == "scriptPath: ") { $file_array[$i] = "scriptServer: " . $this->scriptServer . "\n";
$file_array[$i] = "scriptPath: " . $this->scriptPath . "\n"; $save_scriptServer = True;
$save_scriptPath = True; continue;
continue; }
} if (substr($file_array[$i], 0, 8) == "samba3: ") {
if (substr($file_array[$i], 0, 14) == "scriptServer: ") { $file_array[$i] = "samba3: " . $this->samba3 . "\n";
$file_array[$i] = "scriptServer: " . $this->scriptServer . "\n"; $save_samba3 = True;
$save_scriptServer = True; continue;
continue; }
} if (substr($file_array[$i], 0, 14) == "cacheTimeout: ") {
if (substr($file_array[$i], 0, 8) == "samba3: ") { $file_array[$i] = "cacheTimeout: " . $this->cache_timeout . "\n";
$file_array[$i] = "samba3: " . $this->samba3 . "\n"; $save_cachetime = True;
$save_samba3 = True; continue;
continue; }
}
// check if we have to add new entries (e.g. if user upgraded LAM and has an old config file)
if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL . "\n");
if (!$save_passwd == True) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "passwd: " . $this->Passwd . "\n");
if (!$save_admins == True) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" .
"# names have to be seperated by semicolons\n" .
"# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Adminstring . "\n");
if (!$save_suffusr == True) array_push($file_array, "\n\n# suffix of users\n" .
"# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->Suff_users . "\n");
if (!$save_suffgrp == True) array_push($file_array, "\n\n# suffix of groups\n" .
"# e.g. ou=Groups,dc=yourdomain,dc=org\n" . "groupsuffix: " . $this->Suff_groups . "\n");
if (!$save_suffhst == True) array_push($file_array, "\n\n# suffix of Samba hosts\n" .
"# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->Suff_hosts . "\n");
if (!$save_suffdom == True) array_push($file_array, "\n\n# suffix of Samba 3 domains\n" .
"# e.g. ou=domains,dc=yourdomain,dc=org\n" . "domainsuffix: " . $this->Suff_domains . "\n");
if (!$save_minUID == True) array_push($file_array, "\n\n# minimum UID number\n" . "minUID: " . $this->MinUID . "\n");
if (!$save_maxUID == True) array_push($file_array, "\n\n# maximum UID number\n" . "maxUID: " . $this->MaxUID . "\n");
if (!$save_minGID == True) array_push($file_array, "\n\n# minimum GID number\n" . "minGID: " . $this->MinGID . "\n");
if (!$save_maxGID == True) array_push($file_array, "\n\n# maximum GID number\n" . "maxGID: " . $this->MaxGID . "\n");
if (!$save_minMach == True) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine . "\n");
if (!$save_maxMach == True) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine . "\n");
if (!$save_usrlstattr == True) array_push($file_array, "\n\n# list of attributes to show in user list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
"\n# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')\n# values have to be seperated by semicolons\n" . "userlistAttributes: " . $this->userlistAttributes . "\n");
if (!$save_grplstattr == True) array_push($file_array, "\n\n# list of attributes to show in group list\n# entries can either be predefined values (e.g. '#cn' or '#gidNumber')" .
"\n# or individual ones (e.g. 'cn:Group Name')\n# values have to be seperated by semicolons\n" . "grouplistAttributes: " . $this->grouplistAttributes . "\n");
if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
"\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes . "\n");
if (!$save_maxlstent == True) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries . "\n");
if (!$save_deflang == True) array_push($file_array, "\n\n# default language (a line from config/language)\n" . "defaultLanguage: " . $this->defaultLanguage . "\n");
if (!$save_scriptPath == True) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\n");
if (!$save_scriptServer == True) array_push($file_array, "\n\n# Server of external Script\n" . "scriptServer: " . $this->scriptServer . "\n");
if (!$save_samba3 == True) array_push($file_array, "\n\n# Set to \"yes\" only if you use the new Samba 3.x schema.\n" . "samba3: " . $this->samba3 . "\n");
if (!$save_cachetime == True) array_push($file_array, "\n\n# Number of minutes LAM caches LDAP searches.\n" . "cacheTimeout: " . $this->cache_timeout . "\n");
$file = fopen($conffile, "w");
if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
fclose($file);
}
else {
StatusMessage("ERROR", "", _("Cannot open config file!") . " (" . $conffile . ")");
exit;
}
} }
} }
// check if we have to add new entries (e.g. if user upgraded LAM and has an old config file)
if (!$save_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL . "\n");
if (!$save_passwd == True) array_push($file_array, "\n\n# password to change these preferences via webfrontend\n" . "passwd: " . $this->Passwd . "\n");
if (!$save_admins == True) array_push($file_array, "\n\n# list of users who are allowed to use LDAP Account Manager\n" .
"# names have to be seperated by semicolons\n" .
"# e.g. admins: cn=admin,dc=yourdomain,dc=org;cn=root,dc=yourdomain,dc=org\n" . "admins: " . $this->Adminstring . "\n");
if (!$save_suffusr == True) array_push($file_array, "\n\n# suffix of users\n" .
"# e.g. ou=People,dc=yourdomain,dc=org\n" . "usersuffix: " . $this->Suff_users . "\n");
if (!$save_suffgrp == True) array_push($file_array, "\n\n# suffix of groups\n" .
"# e.g. ou=Groups,dc=yourdomain,dc=org\n" . "groupsuffix: " . $this->Suff_groups . "\n");
if (!$save_suffhst == True) array_push($file_array, "\n\n# suffix of Samba hosts\n" .
"# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->Suff_hosts . "\n");
if (!$save_suffdom == True) array_push($file_array, "\n\n# suffix of Samba 3 domains\n" .
"# e.g. ou=domains,dc=yourdomain,dc=org\n" . "domainsuffix: " . $this->Suff_domains . "\n");
// if (!$save_suffmap == True) array_push($file_array, "\n\n# suffix of Samba 3 user/group mappings\n" .
// "# e.g. ou=mappings,dc=yourdomain,dc=org\n" . "mapsuffix: " . $this->Suff_map . "\n");
if (!$save_minUID == True) array_push($file_array, "\n\n# minimum UID number\n" . "minUID: " . $this->MinUID . "\n");
if (!$save_maxUID == True) array_push($file_array, "\n\n# maximum UID number\n" . "maxUID: " . $this->MaxUID . "\n");
if (!$save_minGID == True) array_push($file_array, "\n\n# minimum GID number\n" . "minGID: " . $this->MinGID . "\n");
if (!$save_maxGID == True) array_push($file_array, "\n\n# maximum GID number\n" . "maxGID: " . $this->MaxGID . "\n");
if (!$save_minMach == True) array_push($file_array, "\n\n# minimum UID number for Samba hosts\n" . "minMachine: " . $this->MinMachine . "\n");
if (!$save_maxMach == True) array_push($file_array, "\n\n# maximum UID number for Samba hosts\n" . "maxMachine: " . $this->MaxMachine . "\n");
if (!$save_usrlstattr == True) array_push($file_array, "\n\n# list of attributes to show in user list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
"\n# or individual ones (e.g. 'uid:User ID' or 'host:Host Name')\n# values have to be seperated by semicolons\n" . "userlistAttributes: " . $this->userlistAttributes . "\n");
if (!$save_grplstattr == True) array_push($file_array, "\n\n# list of attributes to show in group list\n# entries can either be predefined values (e.g. '#cn' or '#gidNumber')" .
"\n# or individual ones (e.g. 'cn:Group Name')\n# values have to be seperated by semicolons\n" . "grouplistAttributes: " . $this->grouplistAttributes . "\n");
if (!$save_hstlstattr == True) array_push($file_array, "\n\n# list of attributes to show in host list\n# entries can either be predefined values (e.g. '#cn' or '#uid')" .
"\n# or individual ones (e.g. 'cn:Host Name')\n# values have to be seperated by semicolons\n" . "hostlistAttributes: " . $this->hostlistAttributes . "\n");
if (!$save_maxlstent == True) array_push($file_array, "\n\n# maximum number of rows to show in user/group/host lists\n" . "maxlistentries: " . $this->maxlistentries . "\n");
if (!$save_deflang == True) array_push($file_array, "\n\n# default language (a line from config/language)\n" . "defaultLanguage: " . $this->defaultLanguage . "\n");
if (!$save_scriptPath == True) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\n");
if (!$save_scriptServer == True) array_push($file_array, "\n\n# Server of external Script\n" . "scriptServer: " . $this->scriptServer . "\n");
if (!$save_samba3 == True) array_push($file_array, "\n\n# Set to \"yes\" only if you use the new Samba 3.x schema.\n" . "samba3: " . $this->samba3 . "\n");
$file = fopen($conffile, "w");
if ($file) {
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
fclose($file);
}
else {
StatusMessage("ERROR", "", _("Cannot open config file!") . " (" . $conffile . ")");
exit;
}
}
}
// prints current preferences // prints current preferences
function printconf() { function printconf() {
echo "<b>" . _("Server address") . ": </b>" . $this->ServerURL . "<br>"; echo "<b>" . _("Server address") . ": </b>" . $this->ServerURL . "<br>";
echo "<b>" . _("Samba 3.x schema") . ": </b>" . $this->samba3 . "<br>"; echo "<b>" . _("Cache timeout") . ": </b>" . $this->cache_timeout . "<br>";
echo "<b>" . _("UserSuffix") . ": </b>" . $this->Suff_users . "<br>"; echo "<b>" . _("Samba 3.x schema") . ": </b>" . $this->samba3 . "<br>";
echo "<b>" . _("GroupSuffix") . ": </b>" . $this->Suff_groups . "<br>"; echo "<b>" . _("UserSuffix") . ": </b>" . $this->Suff_users . "<br>";
echo "<b>" . _("HostSuffix") . ": </b>" . $this->Suff_hosts . "<br>"; echo "<b>" . _("GroupSuffix") . ": </b>" . $this->Suff_groups . "<br>";
echo "<b>" . _("DomainSuffix") . ": </b>" . $this->Suff_domains . "<br>"; echo "<b>" . _("HostSuffix") . ": </b>" . $this->Suff_hosts . "<br>";
// echo "<b>" . _("MappingSuffix") . ": </b>" . $this->Suff_map . "<br>"; echo "<b>" . _("DomainSuffix") . ": </b>" . $this->Suff_domains . "<br>";
echo "<b>" . _("Minimum UID number") . ": </b>" . $this->MinUID . "<br>"; echo "<b>" . _("Minimum UID number") . ": </b>" . $this->MinUID . "<br>";
echo "<b>" . _("Maximum UID number") . ": </b>" . $this->MaxUID . "<br>"; echo "<b>" . _("Maximum UID number") . ": </b>" . $this->MaxUID . "<br>";
echo "<b>" . _("Minimum GID number") . ": </b>" . $this->MinGID . "<br>"; echo "<b>" . _("Minimum GID number") . ": </b>" . $this->MinGID . "<br>";
echo "<b>" . _("Maximum GID number") . ": </b>" . $this->MaxGID . "<br>"; echo "<b>" . _("Maximum GID number") . ": </b>" . $this->MaxGID . "<br>";
echo "<b>" . _("Minimum Machine number") . ": </b>" . $this->MinMachine . "<br>"; echo "<b>" . _("Minimum Machine number") . ": </b>" . $this->MinMachine . "<br>";
echo "<b>" . _("Maximum Machine number") . ": </b>" . $this->MaxMachine . "<br>"; echo "<b>" . _("Maximum Machine number") . ": </b>" . $this->MaxMachine . "<br>";
echo "<b>" . _("Attributes in User List") . ": </b>" . $this->userlistAttributes . "<br>"; echo "<b>" . _("Attributes in User List") . ": </b>" . $this->userlistAttributes . "<br>";
echo "<b>" . _("Attributes in Group List") . ": </b>" . $this->grouplistAttributes . "<br>"; echo "<b>" . _("Attributes in Group List") . ": </b>" . $this->grouplistAttributes . "<br>";
echo "<b>" . _("Attributes in Host List") . ": </b>" . $this->hostlistAttributes . "<br>"; echo "<b>" . _("Attributes in Host List") . ": </b>" . $this->hostlistAttributes . "<br>";
echo "<b>" . _("Maximum list entries") . ": </b>" . $this->maxlistentries . "<br>"; echo "<b>" . _("Maximum list entries") . ": </b>" . $this->maxlistentries . "<br>";
echo "<b>" . _("Default language") . ": </b>" . $this->defaultLanguage . "<br>"; echo "<b>" . _("Default language") . ": </b>" . $this->defaultLanguage . "<br>";
echo "<b>" . _("Path to external script") . ": </b>" . $this->scriptPath . "<br>"; echo "<b>" . _("Path to external script") . ": </b>" . $this->scriptPath . "<br>";
echo "<b>" . _("Server of external script") . ": </b>" . $this->scriptServer . "<br>"; echo "<b>" . _("Server of external script") . ": </b>" . $this->scriptServer . "<br>";
echo "<b>" . _("List of valid users") . ": </b>" . $this->Adminstring; echo "<b>" . _("List of valid users") . ": </b>" . $this->Adminstring;
} }
// functions to read/write preferences // functions to read/write preferences
// returns the server address as string // returns the server address as string
function get_ServerURL() { function get_ServerURL() {
return $this->ServerURL; return $this->ServerURL;
} }
// sets the server address // sets the server address
function set_ServerURL($value) { function set_ServerURL($value) {
@ -559,21 +557,6 @@ class Config {
return true; return true;
} }
// returns the LDAP suffix where mappings are saved
/* function get_MapSuffix() {
return $this->Suff_map;
}*/
// sets the LDAP suffix where mappings are saved
/* function set_MapSuffix($value) {
if (!$value) $this->Suff_map = ""; // optional parameter
elseif (is_string($value) && (eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $value))) {
$this->Suff_map = $value;
}
else return false;
return true;
}*/
// returns the minimum UID to use when creating new users // returns the minimum UID to use when creating new users
function get_minUID() { function get_minUID() {
return $this->MinUID; return $this->MinUID;
@ -754,6 +737,19 @@ class Config {
return true; return true;
} }
// returns the LDAP cache timeout in minutes
function get_cacheTimeout() {
return $this->cache_timeout;
}
// sets the LDAP cache timeout in minutes
function set_cacheTimeout($value) {
if (is_numeric($value) && ($value > -1)) {
$this->cache_timeout = $value;
}
else return false;
return true;
}
} }

View File

@ -42,17 +42,17 @@ if ($_POST['back'] || $_POST['submitconf']){
if ($_POST['passwd1']) $_SESSION['passwd1'] = $_POST['passwd1']; if ($_POST['passwd1']) $_SESSION['passwd1'] = $_POST['passwd1'];
if ($_POST['passwd2']) $_SESSION['passwd2'] = $_POST['passwd2']; if ($_POST['passwd2']) $_SESSION['passwd2'] = $_POST['passwd2'];
if ($_POST['serverurl']) $_SESSION['serverurl'] = $_POST['serverurl']; if ($_POST['serverurl']) $_SESSION['serverurl'] = $_POST['serverurl'];
if (isset($_POST['cache_timeout'])) $_SESSION['cache_timeout'] = $_POST['cache_timeout'];
if ($_POST['admins']) $_SESSION['admins'] = $_POST['admins']; if ($_POST['admins']) $_SESSION['admins'] = $_POST['admins'];
if ($_POST['suffusers']) $_SESSION['suffusers'] = $_POST['suffusers']; if ($_POST['suffusers']) $_SESSION['suffusers'] = $_POST['suffusers'];
if ($_POST['suffgroups']) $_SESSION['suffgroups'] = $_POST['suffgroups']; if ($_POST['suffgroups']) $_SESSION['suffgroups'] = $_POST['suffgroups'];
if ($_POST['suffhosts']) $_SESSION['suffhosts'] = $_POST['suffhosts']; if ($_POST['suffhosts']) $_SESSION['suffhosts'] = $_POST['suffhosts'];
if ($_POST['suffdomains']) $_SESSION['suffdomains'] = $_POST['suffdomains']; if ($_POST['suffdomains']) $_SESSION['suffdomains'] = $_POST['suffdomains'];
// if ($_POST['suffmap']) $suffmap = $_POST['suffmap']; if (isset($_POST['minUID'])) $_SESSION['minUID'] = $_POST['minUID'];
if ($_POST['minUID']) $_SESSION['minUID'] = $_POST['minUID'];
if ($_POST['maxUID']) $_SESSION['maxUID'] = $_POST['maxUID']; if ($_POST['maxUID']) $_SESSION['maxUID'] = $_POST['maxUID'];
if ($_POST['minGID']) $_SESSION['minGID'] = $_POST['minGID']; if (isset($_POST['minGID'])) $_SESSION['minGID'] = $_POST['minGID'];
if ($_POST['maxGID']) $_SESSION['maxGID'] = $_POST['maxGID']; if ($_POST['maxGID']) $_SESSION['maxGID'] = $_POST['maxGID'];
if ($_POST['minMach']) $_SESSION['minMach'] = $_POST['minMach']; if (isset($_POST['minMach'])) $_SESSION['minMach'] = $_POST['minMach'];
if ($_POST['maxMach']) $_SESSION['maxMach'] = $_POST['maxMach']; if ($_POST['maxMach']) $_SESSION['maxMach'] = $_POST['maxMach'];
if ($_POST['usrlstattr']) $_SESSION['usrlstattr'] = $_POST['usrlstattr']; if ($_POST['usrlstattr']) $_SESSION['usrlstattr'] = $_POST['usrlstattr'];
if ($_POST['grplstattr']) $_SESSION['grplstattr'] = $_POST['grplstattr']; if ($_POST['grplstattr']) $_SESSION['grplstattr'] = $_POST['grplstattr'];
@ -141,11 +141,18 @@ echo ("<tr><td align=\"right\"><b>".
_("DomainSuffix") . " **: </b></td>". _("DomainSuffix") . " **: </b></td>".
"<td><input size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_DomainSuffix() . "\"></td>\n"); "<td><input size=50 type=\"text\" name=\"suffdomains\" value=\"" . $conf->get_DomainSuffix() . "\"></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=215\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n"); echo ("<td><a href=\"../help.php?HelpNumber=215\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
// mapping suffix // LDAP cache timeout
/*echo ("<tr><td align=\"right\"><b>". echo ("<tr><td align=\"right\"><b>".
_("MappingSuffix") . ": </b></td>". _("Cache timeout") . " *: </b></td>".
"<td><input size=50 type=\"text\" name=\"suffmap\" value=\"" . $conf->get_MapSuffix() . "\"></td>\n"); "<td><select name=\"cache_timeout\">\n<option selected>".$conf->get_cacheTimeout()."</option>\n");
echo ("<td><a href=\"../help.php?HelpNumber=216\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");*/ if ($conf->get_cacheTimeout() != 0) echo("<option>0</option>\n");
if ($conf->get_cacheTimeout() != 1) echo("<option>1</option>\n");
if ($conf->get_cacheTimeout() != 2) echo("<option>2</option>\n");
if ($conf->get_cacheTimeout() != 5) echo("<option>5</option>\n");
if ($conf->get_cacheTimeout() != 10) echo("<option>10</option>\n");
if ($conf->get_cacheTimeout() != 15) echo("<option>15</option>\n");
echo ("</select></td>\n");
echo ("<td><a href=\"../help.php?HelpNumber=214\" target=\"lamhelp\">" . _("Help") . "</a></td></tr>\n");
echo ("</table>"); echo ("</table>");
echo ("</fieldset>"); echo ("</fieldset>");

View File

@ -38,17 +38,18 @@ if ($_SESSION['passwd']) $passwd = $_SESSION['passwd'];
if ($_SESSION['passwd1']) $passwd1 = $_SESSION['passwd1']; if ($_SESSION['passwd1']) $passwd1 = $_SESSION['passwd1'];
if ($_SESSION['passwd2']) $passwd2 = $_SESSION['passwd2']; if ($_SESSION['passwd2']) $passwd2 = $_SESSION['passwd2'];
if ($_SESSION['serverurl']) $serverurl = $_SESSION['serverurl']; if ($_SESSION['serverurl']) $serverurl = $_SESSION['serverurl'];
if (isset($_SESSION['serverurl'])) $serverurl = $_SESSION['serverurl'];
if ($_SESSION['admins']) $admins = $_SESSION['admins']; if ($_SESSION['admins']) $admins = $_SESSION['admins'];
if ($_SESSION['suffusers']) $suffusers = $_SESSION['suffusers']; if ($_SESSION['suffusers']) $suffusers = $_SESSION['suffusers'];
if ($_SESSION['suffgroups']) $suffgroups = $_SESSION['suffgroups']; if ($_SESSION['suffgroups']) $suffgroups = $_SESSION['suffgroups'];
if ($_SESSION['suffhosts']) $suffhosts = $_SESSION['suffhosts']; if ($_SESSION['suffhosts']) $suffhosts = $_SESSION['suffhosts'];
if ($_SESSION['suffdomains']) $suffdomains = $_SESSION['suffdomains']; if ($_SESSION['suffdomains']) $suffdomains = $_SESSION['suffdomains'];
//if ($_SESSION['suffmap']) $suffmap = $_SESSION['suffmap']; //if ($_SESSION['suffmap']) $suffmap = $_SESSION['suffmap'];
if ($_SESSION['minUID']) $minUID = $_SESSION['minUID']; if (isset($_SESSION['minUID'])) $minUID = $_SESSION['minUID'];
if ($_SESSION['maxUID']) $maxUID = $_SESSION['maxUID']; if ($_SESSION['maxUID']) $maxUID = $_SESSION['maxUID'];
if ($_SESSION['minGID']) $minGID = $_SESSION['minGID']; if (isset($_SESSION['minGID'])) $minGID = $_SESSION['minGID'];
if ($_SESSION['maxGID']) $maxGID = $_SESSION['maxGID']; if ($_SESSION['maxGID']) $maxGID = $_SESSION['maxGID'];
if ($_SESSION['minMach']) $minMach = $_SESSION['minMach']; if (isset($_SESSION['minMach'])) $minMach = $_SESSION['minMach'];
if ($_SESSION['maxMach']) $maxMach = $_SESSION['maxMach']; if ($_SESSION['maxMach']) $maxMach = $_SESSION['maxMach'];
if ($_SESSION['usrlstattr']) $usrlstattr = $_SESSION['usrlstattr']; if ($_SESSION['usrlstattr']) $usrlstattr = $_SESSION['usrlstattr'];
if ($_SESSION['grplstattr']) $grplstattr = $_SESSION['grplstattr']; if ($_SESSION['grplstattr']) $grplstattr = $_SESSION['grplstattr'];
@ -82,6 +83,11 @@ if (!$serverurl) {
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
} }
if (!isset($cache_timeout) || !(is_numeric($cache_timeout)) || !($cache_timeout > -1)) {
echo ("<font color=\"red\"><b>" . _("Cache timeout is empty!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}
if (!$admins || !eregi("^([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+(;([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+)*$", $admins)) { if (!$admins || !eregi("^([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+(;([a-z0-9]|-)+=([a-z0-9]|-)+(,([a-z0-9]|-)+=([a-z0-9]|-)+)+)*$", $admins)) {
echo ("<font color=\"red\"><b>" . _("List of admin users is empty or invalid!") . "</b></font>"); echo ("<font color=\"red\"><b>" . _("List of admin users is empty or invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
@ -107,12 +113,7 @@ if (($samba3 == "yes") && !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
} }
/*if ($suffmap && !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffmap)) { if (!isset($minUID) || !is_numeric($minUID)) {
echo ("<font color=\"red\"><b>" . _("MappingSuffix is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit;
}*/
if (!$minUID || !is_numeric($minUID)) {
echo ("<font color=\"red\"><b>" . _("MinUID is invalid!") . "</b></font>"); echo ("<font color=\"red\"><b>" . _("MinUID is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
@ -122,7 +123,7 @@ if (!$maxUID || !is_numeric($maxUID)) {
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
} }
if (!$minGID || !is_numeric($minGID)) { if (!isset($minGID) || !is_numeric($minGID)) {
echo ("<font color=\"red\"><b>" . _("MinGID is invalid!") . "</b></font>"); echo ("<font color=\"red\"><b>" . _("MinGID is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
@ -132,7 +133,7 @@ if (!$maxGID || !is_numeric($maxGID)) {
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
} }
if (!$minMach || !is_numeric($minMach)) { if (!isset($minMach) || !is_numeric($minMach)) {
echo ("<font color=\"red\"><b>" . _("MinMachine is invalid!") . "</b></font>"); echo ("<font color=\"red\"><b>" . _("MinMachine is invalid!") . "</b></font>");
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>"); echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
exit; exit;
@ -189,12 +190,12 @@ if ($scriptserver && !is_string($scriptserver)) {
// set new preferences // set new preferences
$conf->set_ServerURL($serverurl); $conf->set_ServerURL($serverurl);
$conf->set_cacheTimeout($cache_timeout);
$conf->set_Adminstring($admins); $conf->set_Adminstring($admins);
$conf->set_UserSuffix($suffusers); $conf->set_UserSuffix($suffusers);
$conf->set_GroupSuffix($suffgroups); $conf->set_GroupSuffix($suffgroups);
$conf->set_HostSuffix($suffhosts); $conf->set_HostSuffix($suffhosts);
$conf->set_DomainSuffix($suffdomains); $conf->set_DomainSuffix($suffdomains);
//$conf->set_MapSuffix($suffmap);
$conf->set_minUID($minUID); $conf->set_minUID($minUID);
$conf->set_maxUID($maxUID); $conf->set_maxUID($maxUID);
$conf->set_minGID($minGID); $conf->set_minGID($minGID);
@ -235,12 +236,12 @@ unset($_SESSION['passwd']);
unset($_SESSION['passwd1']); unset($_SESSION['passwd1']);
unset($_SESSION['passwd2']); unset($_SESSION['passwd2']);
unset($_SESSION['serverurl']); unset($_SESSION['serverurl']);
unset($_SESSION['cache_timeout']);
unset($_SESSION['admins']); unset($_SESSION['admins']);
unset($_SESSION['suffusers']); unset($_SESSION['suffusers']);
unset($_SESSION['suffgroups']); unset($_SESSION['suffgroups']);
unset($_SESSION['suffhosts']); unset($_SESSION['suffhosts']);
unset($_SESSION['suffdomains']); unset($_SESSION['suffdomains']);
//unset($_SESSION['suffmap']);
unset($_SESSION['minUID']); unset($_SESSION['minUID']);
unset($_SESSION['maxUID']); unset($_SESSION['maxUID']);
unset($_SESSION['minGID']); unset($_SESSION['minGID']);

View File

@ -9,12 +9,12 @@ $Id$
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@ -24,7 +24,7 @@ $Id$
*/ */
include ("../lib/config.inc"); include ("../lib/config.inc");
$conf = new Config(); $conf = new Config('test');
echo "<html><head><title></title><link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\"></head><body>"; echo "<html><head><title></title><link rel=\"stylesheet\" type=\"text/css\" href=\"../style/layout.css\"></head><body>";
echo ("<b> Current Config</b><br><br>"); echo ("<b> Current Config</b><br><br>");
$conf->printconf(); $conf->printconf();
@ -32,6 +32,7 @@ echo ("<br><br><big><b> Starting Test...</b></big><br><br>");
// now all prferences are loaded // now all prferences are loaded
echo ("Loading preferences..."); echo ("Loading preferences...");
$ServerURL = $conf->get_ServerURL(); $ServerURL = $conf->get_ServerURL();
$cache_timeout = $conf->get_cacheTimeout();
$Admins = $conf->get_Admins(); $Admins = $conf->get_Admins();
$Passwd = $conf->get_Passwd(); $Passwd = $conf->get_Passwd();
$Adminstring = $conf->get_Adminstring(); $Adminstring = $conf->get_Adminstring();
@ -39,7 +40,6 @@ $Suff_users = $conf->get_UserSuffix();
$Suff_groups = $conf->get_GroupSuffix(); $Suff_groups = $conf->get_GroupSuffix();
$Suff_hosts = $conf->get_HostSuffix(); $Suff_hosts = $conf->get_HostSuffix();
$Suff_domains = $conf->get_DomainSuffix(); $Suff_domains = $conf->get_DomainSuffix();
$Suff_map = $conf->get_MapSuffix();
$MinUID = $conf->get_minUID(); $MinUID = $conf->get_minUID();
$MaxUID = $conf->get_maxUID(); $MaxUID = $conf->get_maxUID();
$MinGID = $conf->get_minGID(); $MinGID = $conf->get_minGID();
@ -58,6 +58,7 @@ echo ("done<br>");
// next we modify them and save lam.conf // next we modify them and save lam.conf
echo ("Changing preferences..."); echo ("Changing preferences...");
$conf->set_ServerURL("ldap://123.345.678.123:777"); $conf->set_ServerURL("ldap://123.345.678.123:777");
$conf->set_cacheTimeout("33");
$conf->set_Admins(array("uid=test,o=test,dc=org","uid=root,o=test2,c=de")); $conf->set_Admins(array("uid=test,o=test,dc=org","uid=root,o=test2,c=de"));
$conf->set_Passwd("123456abcde"); $conf->set_Passwd("123456abcde");
$conf->set_Adminstring("uid=test,o=test,dc=org;uid=root,o=test2,c=de"); $conf->set_Adminstring("uid=test,o=test,dc=org;uid=root,o=test2,c=de");
@ -65,7 +66,6 @@ $conf->set_UserSuffix("ou=test,o=test,c=de");
$conf->set_GroupSuffix("ou=testgrp,o=test,c=de"); $conf->set_GroupSuffix("ou=testgrp,o=test,c=de");
$conf->set_HostSuffix("ou=testhst,o=test,c=de"); $conf->set_HostSuffix("ou=testhst,o=test,c=de");
$conf->set_DomainSuffix("ou=testdom,o=test,c=de"); $conf->set_DomainSuffix("ou=testdom,o=test,c=de");
$conf->set_MapSuffix("ou=testmap,o=test,c=de");
$conf->set_minUID("25"); $conf->set_minUID("25");
$conf->set_maxUID("254"); $conf->set_maxUID("254");
$conf->set_minGID("253"); $conf->set_minGID("253");
@ -84,63 +84,63 @@ $conf->save();
echo ("done<br>"); echo ("done<br>");
// at last all preferences are read from lam.conf and compared // at last all preferences are read from lam.conf and compared
echo ("Loading and comparing..."); echo ("Loading and comparing...");
$conf = new Config('default'); $conf2 = new Config('test');
if ($conf->get_ServerURL() != "ldap://123.345.678.123:777") echo ("<br><font color=\"#FF0000\">Saving ServerURL failed!</font><br>"); if ($conf2->get_ServerURL() != "ldap://123.345.678.123:777") echo ("<br><font color=\"#FF0000\">Saving ServerURL failed!</font><br>");
$adm_arr = $conf->get_Admins(); if ($conf2->get_cacheTimeout() != "33") echo ("<br><font color=\"#FF0000\">Saving Cache timeout failed!</font><br>");
$adm_arr = $conf2->get_Admins();
if ($adm_arr[0] != "uid=test,o=test,dc=org") echo ("<br><font color=\"#FF0000\">Saving admins failed!" . $adm_arr[0] . "</font><br>"); if ($adm_arr[0] != "uid=test,o=test,dc=org") echo ("<br><font color=\"#FF0000\">Saving admins failed!" . $adm_arr[0] . "</font><br>");
if ($adm_arr[1] != "uid=root,o=test2,c=de") echo ("<br><font color=\"#FF0000\">Saving admins failed!</font><br>"); if ($adm_arr[1] != "uid=root,o=test2,c=de") echo ("<br><font color=\"#FF0000\">Saving admins failed!</font><br>");
if ($conf->get_Passwd() != "123456abcde") echo ("<br><font color=\"#FF0000\">Saving password failed!</font><br>"); if ($conf2->get_Passwd() != "123456abcde") echo ("<br><font color=\"#FF0000\">Saving password failed!</font><br>");
if ($conf->get_Adminstring() != "uid=test,o=test,dc=org;uid=root,o=test2,c=de") echo ("<br><font color=\"#FF0000\">Saving admin string failed!</font><br>"); if ($conf2->get_Adminstring() != "uid=test,o=test,dc=org;uid=root,o=test2,c=de") echo ("<br><font color=\"#FF0000\">Saving admin string failed!</font><br>");
if ($conf->get_UserSuffix() != "ou=test,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving user suffix failed!</font><br>"); if ($conf2->get_UserSuffix() != "ou=test,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving user suffix failed!</font><br>");
if ($conf->get_GroupSuffix() != "ou=testgrp,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving group suffix failed!</font><br>"); if ($conf2->get_GroupSuffix() != "ou=testgrp,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving group suffix failed!</font><br>");
if ($conf->get_HostSuffix() != "ou=testhst,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving host suffix failed!</font><br>"); if ($conf2->get_HostSuffix() != "ou=testhst,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving host suffix failed!</font><br>");
if ($conf->get_DomainSuffix() != "ou=testdom,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving domain suffix failed!</font><br>"); if ($conf2->get_DomainSuffix() != "ou=testdom,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving domain suffix failed!</font><br>");
if ($conf->get_MapSuffix() != "ou=testmap,o=test,c=de") echo ("<br><font color=\"#FF0000\">Saving mapping suffix failed!</font><br>"); if ($conf2->get_minUID() != "25") echo ("<br><font color=\"#FF0000\">Saving minUID failed!</font><br>");
if ($conf->get_minUID() != "25") echo ("<br><font color=\"#FF0000\">Saving minUID failed!</font><br>"); if ($conf2->get_maxUID() != "254") echo ("<br><font color=\"#FF0000\">Saving maxUID failed!</font><br>");
if ($conf->get_maxUID() != "254") echo ("<br><font color=\"#FF0000\">Saving maxUID failed!</font><br>"); if ($conf2->get_minGID() != "253") echo ("<br><font color=\"#FF0000\">Saving minGID failed!</font><br>");
if ($conf->get_minGID() != "253") echo ("<br><font color=\"#FF0000\">Saving minGID failed!</font><br>"); if ($conf2->get_maxGID() != "1234") echo ("<br><font color=\"#FF0000\">Saving maxGID failed!</font><br>");
if ($conf->get_maxGID() != "1234") echo ("<br><font color=\"#FF0000\">Saving maxGID failed!</font><br>"); if ($conf2->get_minMachine() != "3") echo ("<br><font color=\"#FF0000\">Saving maxMachine failed!</font><br>");
if ($conf->get_minMachine() != "3") echo ("<br><font color=\"#FF0000\">Saving maxMachine failed!</font><br>"); if ($conf2->get_maxMachine() != "47") echo ("<br><font color=\"#FF0000\">Saving minMachine failed!</font><br>");
if ($conf->get_maxMachine() != "47") echo ("<br><font color=\"#FF0000\">Saving minMachine failed!</font><br>"); if ($conf2->get_userlistAttributes() != "#uid;#cn") echo ("<br><font color=\"#FF0000\">Saving userlistAttributes failed!</font><br>");
if ($conf->get_userlistAttributes() != "#uid;#cn") echo ("<br><font color=\"#FF0000\">Saving userlistAttributes failed!</font><br>"); if ($conf2->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>");
if ($conf->get_grouplistAttributes() != "#gidNumber;#cn;#memberUID") echo ("<br><font color=\"#FF0000\">Saving grouplistAttributes failed!</font><br>"); if ($conf2->get_hostlistAttributes() != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>");
if ($conf->get_hostlistAttributes() != "#cn;#uid;#description") echo ("<br><font color=\"#FF0000\">Saving hostlistAttributes failed!</font><br>"); if ($conf2->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>");
if ($conf->get_maxlistentries() != "54") echo ("<br><font color=\"#FF0000\">Saving maxlistentries failed!</font><br>"); if ($conf2->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("<br><font color=\"#FF0000\">Saving default language failed!</font><br>");
if ($conf->get_defaultlanguage() != "de_AT:iso639_de:Deutsch (Oesterreich)") echo ("<br><font color=\"#FF0000\">Saving default language failed!</font><br>"); if ($conf2->get_scriptPath() != "/var/www/lam/lib/script") echo ("<br><font color=\"#FF0000\">Saving script path failed!</font><br>");
if ($conf->get_scriptPath() != "/var/www/lam/lib/script") echo ("<br><font color=\"#FF0000\">Saving script path failed!</font><br>"); if ($conf2->get_scriptServer() != "127.0.0.1") echo ("<br><font color=\"#FF0000\">Saving script server failed!</font><br>");
if ($conf->get_scriptServer() != "127.0.0.1") echo ("<br><font color=\"#FF0000\">Saving script server failed!</font><br>"); if ($conf2->get_samba3() != "yes") echo ("<br><font color=\"#FF0000\">Saving samba3 failed!</font><br>");
if ($conf->get_samba3() != "yes") echo ("<br><font color=\"#FF0000\">Saving samba3 failed!</font><br>");
echo ("done<br>"); echo ("done<br>");
// restore old values // restore old values
echo ("Restoring old preferences..."); echo ("Restoring old preferences...");
$conf->set_ServerURL($ServerURL); $conf2->set_ServerURL($ServerURL);
$conf->set_Admins($Admins); $conf2->set_cacheTimeout($cache_timeout);
$conf->set_Passwd($Passwd); $conf2->set_Admins($Admins);
$conf->set_Adminstring($Adminstring); $conf2->set_Passwd($Passwd);
$conf->set_UserSuffix($Suff_users); $conf2->set_Adminstring($Adminstring);
$conf->set_GroupSuffix($Suff_groups); $conf2->set_UserSuffix($Suff_users);
$conf->set_HostSuffix($Suff_hosts); $conf2->set_GroupSuffix($Suff_groups);
$conf->set_DomainSuffix($Suff_domains); $conf2->set_HostSuffix($Suff_hosts);
$conf->set_MapSuffix($Suff_map); $conf2->set_DomainSuffix($Suff_domains);
$conf->set_minUID($MinUID); $conf2->set_minUID($MinUID);
$conf->set_maxUID($MaxUID); $conf2->set_maxUID($MaxUID);
$conf->set_minGID($MinGID); $conf2->set_minGID($MinGID);
$conf->set_maxGID($MaxGID); $conf2->set_maxGID($MaxGID);
$conf->set_minMachine($MinMachine); $conf2->set_minMachine($MinMachine);
$conf->set_maxMachine($MaxMachine); $conf2->set_maxMachine($MaxMachine);
$conf->set_userlistAttributes($userlistAttributes); $conf2->set_userlistAttributes($userlistAttributes);
$conf->set_grouplistAttributes($grouplistAttributes); $conf2->set_grouplistAttributes($grouplistAttributes);
$conf->set_hostlistAttributes($hostlistAttributes); $conf2->set_hostlistAttributes($hostlistAttributes);
$conf->set_maxlistentries($maxlistentries); $conf2->set_maxlistentries($maxlistentries);
$conf->set_defaultLanguage($defaultlanguage); $conf2->set_defaultLanguage($defaultlanguage);
$conf->set_scriptPath($scriptpath); $conf2->set_scriptPath($scriptpath);
$conf->set_scriptServer($scriptserver); $conf2->set_scriptServer($scriptserver);
$conf->set_samba3($samba3); $conf2->set_samba3($samba3);
$conf->save(); $conf2->save();
echo ("done<br>"); echo ("done<br>");
// finished // finished
echo ("<br><b><font color=\"#00C000\">Test is complete.</font></b>"); echo ("<br><b><font color=\"#00C000\">Test is complete.</font></b>");
echo ("<br><br><b> Current Config</b><br><br>"); echo ("<br><br><b> Current Config</b><br><br>");
$conf->printconf(); $conf2->printconf();
?> ?>