added cache timeout variable
This commit is contained in:
parent
0eb23e99f5
commit
2654a8446f
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -245,8 +245,7 @@ class Config {
|
||||||
$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
|
||||||
|
@ -293,11 +292,6 @@ class Config {
|
||||||
$save_suffdom = True;
|
$save_suffdom = True;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* if (substr($file_array[$i], 0, 11) == "mapsuffix: ") {
|
|
||||||
$file_array[$i] = "mapsuffix: " . $this->Suff_map . "\n";
|
|
||||||
$save_suffmap = True;
|
|
||||||
continue;
|
|
||||||
}*/
|
|
||||||
if (substr($file_array[$i], 0, 8) == "minUID: ") {
|
if (substr($file_array[$i], 0, 8) == "minUID: ") {
|
||||||
$file_array[$i] = "minUID: " . $this->MinUID . "\n";
|
$file_array[$i] = "minUID: " . $this->MinUID . "\n";
|
||||||
$save_minUID = True;
|
$save_minUID = True;
|
||||||
|
@ -368,6 +362,11 @@ class Config {
|
||||||
$save_samba3 = True;
|
$save_samba3 = True;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (substr($file_array[$i], 0, 14) == "cacheTimeout: ") {
|
||||||
|
$file_array[$i] = "cacheTimeout: " . $this->cache_timeout . "\n";
|
||||||
|
$save_cachetime = True;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// check if we have to add new entries (e.g. if user upgraded LAM and has an old config file)
|
// 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_serverURL == True) array_push($file_array, "\n\n# server address (e.g. ldap://localhost:389 or ldaps://localhost:636)\n" . "serverURL: " . $this->ServerURL . "\n");
|
||||||
|
@ -383,8 +382,6 @@ class Config {
|
||||||
"# e.g. ou=machines,dc=yourdomain,dc=org\n" . "hostsuffix: " . $this->Suff_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" .
|
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");
|
"# 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_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_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_minGID == True) array_push($file_array, "\n\n# minimum GID number\n" . "minGID: " . $this->MinGID . "\n");
|
||||||
|
@ -402,6 +399,7 @@ class Config {
|
||||||
if (!$save_scriptPath == True) array_push($file_array, "\n\n# Path to external Script\n" . "scriptPath: " . $this->scriptPath . "\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_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_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");
|
$file = fopen($conffile, "w");
|
||||||
if ($file) {
|
if ($file) {
|
||||||
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
|
for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]);
|
||||||
|
@ -417,12 +415,12 @@ class Config {
|
||||||
// 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>" . _("Cache timeout") . ": </b>" . $this->cache_timeout . "<br>";
|
||||||
echo "<b>" . _("Samba 3.x schema") . ": </b>" . $this->samba3 . "<br>";
|
echo "<b>" . _("Samba 3.x schema") . ": </b>" . $this->samba3 . "<br>";
|
||||||
echo "<b>" . _("UserSuffix") . ": </b>" . $this->Suff_users . "<br>";
|
echo "<b>" . _("UserSuffix") . ": </b>" . $this->Suff_users . "<br>";
|
||||||
echo "<b>" . _("GroupSuffix") . ": </b>" . $this->Suff_groups . "<br>";
|
echo "<b>" . _("GroupSuffix") . ": </b>" . $this->Suff_groups . "<br>";
|
||||||
echo "<b>" . _("HostSuffix") . ": </b>" . $this->Suff_hosts . "<br>";
|
echo "<b>" . _("HostSuffix") . ": </b>" . $this->Suff_hosts . "<br>";
|
||||||
echo "<b>" . _("DomainSuffix") . ": </b>" . $this->Suff_domains . "<br>";
|
echo "<b>" . _("DomainSuffix") . ": </b>" . $this->Suff_domains . "<br>";
|
||||||
// echo "<b>" . _("MappingSuffix") . ": </b>" . $this->Suff_map . "<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>";
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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>");
|
||||||
|
|
|
@ -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']);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue