2003-03-05 16:05:23 +00:00
|
|
|
<?php
|
2003-02-25 21:28:17 +00:00
|
|
|
/*
|
|
|
|
$Id$
|
|
|
|
|
|
|
|
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
|
|
|
Copyright (C) 2003 Roland Gruber
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2003-05-02 16:52:19 +00:00
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2003-05-02 16:52:19 +00:00
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
2003-05-02 16:52:19 +00:00
|
|
|
|
2003-03-08 10:10:19 +00:00
|
|
|
confsave saves the new preferences to lam.conf
|
2003-05-02 16:52:19 +00:00
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
*/
|
2003-07-06 17:54:11 +00:00
|
|
|
include_once ('../../lib/config.inc');
|
2003-02-25 21:28:17 +00:00
|
|
|
|
2003-03-23 18:38:47 +00:00
|
|
|
// start session
|
2003-04-23 19:13:55 +00:00
|
|
|
session_save_path("../../sess");
|
2003-07-06 17:54:11 +00:00
|
|
|
@session_start();
|
|
|
|
|
|
|
|
setlanguage();
|
2003-03-17 19:14:22 +00:00
|
|
|
|
2003-07-06 10:24:41 +00:00
|
|
|
$conf = new Config($_SESSION['filename']);
|
2003-02-25 21:28:17 +00:00
|
|
|
|
2003-06-24 15:50:38 +00:00
|
|
|
// get data from session
|
2003-05-09 16:22:46 +00:00
|
|
|
if ($_SESSION['passwd']) $passwd = $_SESSION['passwd'];
|
|
|
|
if ($_SESSION['passwd1']) $passwd1 = $_SESSION['passwd1'];
|
|
|
|
if ($_SESSION['passwd2']) $passwd2 = $_SESSION['passwd2'];
|
|
|
|
if ($_SESSION['serverurl']) $serverurl = $_SESSION['serverurl'];
|
|
|
|
if ($_SESSION['admins']) $admins = $_SESSION['admins'];
|
|
|
|
if ($_SESSION['suffusers']) $suffusers = $_SESSION['suffusers'];
|
|
|
|
if ($_SESSION['suffgroups']) $suffgroups = $_SESSION['suffgroups'];
|
|
|
|
if ($_SESSION['suffhosts']) $suffhosts = $_SESSION['suffhosts'];
|
2003-07-25 15:41:51 +00:00
|
|
|
if ($_SESSION['suffdomains']) $suffdomains = $_SESSION['suffdomains'];
|
|
|
|
if ($_SESSION['suffmap']) $suffmap = $_SESSION['suffmap'];
|
2003-05-09 16:22:46 +00:00
|
|
|
if ($_SESSION['minUID']) $minUID = $_SESSION['minUID'];
|
|
|
|
if ($_SESSION['maxUID']) $maxUID = $_SESSION['maxUID'];
|
|
|
|
if ($_SESSION['minGID']) $minGID = $_SESSION['minGID'];
|
|
|
|
if ($_SESSION['maxGID']) $maxGID = $_SESSION['maxGID'];
|
|
|
|
if ($_SESSION['minMach']) $minMach = $_SESSION['minMach'];
|
|
|
|
if ($_SESSION['maxMach']) $maxMach = $_SESSION['maxMach'];
|
|
|
|
if ($_SESSION['usrlstattr']) $usrlstattr = $_SESSION['usrlstattr'];
|
|
|
|
if ($_SESSION['grplstattr']) $grplstattr = $_SESSION['grplstattr'];
|
|
|
|
if ($_SESSION['hstlstattr']) $hstlstattr = $_SESSION['hstlstattr'];
|
|
|
|
if ($_SESSION['maxlistentries']) $maxlistentries = $_SESSION['maxlistentries'];
|
2003-07-15 17:30:12 +00:00
|
|
|
if ($_SESSION['lang']) $lang = $_SESSION['lang'];
|
2003-05-12 17:52:54 +00:00
|
|
|
if ($_SESSION['scriptpath']) $scriptpath = $_SESSION['scriptpath'];
|
|
|
|
if ($_SESSION['scriptserver']) $scriptserver = $_SESSION['scriptserver'];
|
2003-05-28 15:37:48 +00:00
|
|
|
if ($_SESSION['samba3']) $samba3 = $_SESSION['samba3'];
|
2003-06-19 19:01:00 +00:00
|
|
|
if ($_SESSION['domainSID']) $domainSID = $_SESSION['domainSID'];
|
2003-07-06 10:24:41 +00:00
|
|
|
if ($_SESSION['filename']) $filename = $_SESSION['filename'];
|
2003-05-02 16:52:19 +00:00
|
|
|
|
|
|
|
// check if password is correct
|
2003-03-08 10:10:19 +00:00
|
|
|
// if not: load login page
|
2003-02-25 21:28:17 +00:00
|
|
|
if ($passwd != $conf->get_Passwd()) {
|
2003-03-08 10:10:19 +00:00
|
|
|
require('conflogin.php');
|
2003-02-25 21:28:17 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2003-07-29 11:52:26 +00:00
|
|
|
echo $_SESSION['header'];
|
2003-05-28 21:44:41 +00:00
|
|
|
|
2003-05-14 13:45:52 +00:00
|
|
|
echo "<html><head><title>listusers</title>\n";
|
|
|
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\">\n";
|
|
|
|
echo "</head><body>\n";
|
|
|
|
|
2003-05-09 16:22:46 +00:00
|
|
|
echo ("<p align=\"center\"><a href=\"http://lam.sf.net\" target=\"new_window\">".
|
2003-05-28 21:44:41 +00:00
|
|
|
"<img src=\"../../graphics/banner.jpg\" border=1 alt=\"LDAP Account Manager\"></a></p><hr><br><br>");
|
2003-03-18 21:39:52 +00:00
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
// check new preferences
|
2003-06-24 15:50:38 +00:00
|
|
|
if (!$serverurl) {
|
2003-07-04 16:25:05 +00:00
|
|
|
echo ("<font color=\"red\"><b>" . _("Server Address is empty!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-02-25 21:28:17 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
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>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-02-25 21:28:17 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$suffusers || !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffusers)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("UserSuffix is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-05 18:38:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$suffgroups || !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffgroups)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("UserSuffix is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-05-02 17:47:35 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$suffhosts || !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffhosts)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("HostSuffix is invalid!") . "</b></font>");
|
2003-05-02 17:47:35 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-05 18:38:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (($samba3 == "yes") && !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffdomains)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("DomainSuffix is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-13 14:40:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if ($suffmap && !eregi("^(([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)(,([a-z]|-|[0-9])*=([a-z]|-|[0-9])*)*$", $suffmap)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MappingSuffix is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-13 14:40:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$minUID || !is_numeric($minUID)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MinUID is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-13 14:40:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$maxUID || !is_numeric($maxUID)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MaxUID is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-13 14:40:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$minGID || !is_numeric($minGID)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MinGID is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-13 14:40:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$maxGID || !is_numeric($maxGID)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MaxGID is invalid!") . "</b></font>");
|
2003-03-23 17:39:39 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
2003-03-13 14:40:19 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$minMach || !is_numeric($minMach)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MinMachine is invalid!") . "</b></font>");
|
2003-03-30 19:51:47 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$maxMach || !is_numeric($maxMach)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("MaxMachine is invalid!") . "</b></font>");
|
2003-03-30 19:51:47 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$usrlstattr || !eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $usrlstattr)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("User list attributes are invalid!") . "</b></font>");
|
2003-03-30 19:51:47 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
2003-07-25 15:41:51 +00:00
|
|
|
if (!$grplstattr || !eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $grplstattr)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("Group list attributes are invalid!") . "</b></font>");
|
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
if (!$hstlstattr || !eregi("^((#[a-z]*)|([a-z]*:[a-z*]))(;((#[a-z]*)|([a-z]*:[a-z]*)))*$", $hstlstattr)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("Host list attributes are invalidUser list attributes are invalid!") . "</b></font>");
|
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
if (!$maxlistentries || !is_numeric($maxlistentries)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("Max list entries is invalid!") . "</b></font>");
|
2003-05-06 23:52:00 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
2003-02-25 21:28:17 +00:00
|
|
|
|
2003-07-15 17:30:12 +00:00
|
|
|
if (!$lang) {
|
2003-07-04 16:25:05 +00:00
|
|
|
echo ("<font color=\"red\"><b>" . _("Language is not defined!") . "</b></font>");
|
2003-05-12 17:52:54 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2003-06-24 15:50:38 +00:00
|
|
|
if (!$samba3) {
|
2003-07-04 16:25:05 +00:00
|
|
|
echo ("<font color=\"red\"><b>" . _("Samba version is not defined!") . "</b></font>");
|
2003-05-28 15:37:48 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2003-07-25 15:41:51 +00:00
|
|
|
if (($samba3 == "yes") && !eregi("^S-[0-9]-[0-9]-[0-9]{2,2}-[0-9]*-[0-9]*-[0-9]*$", $domainSID)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("Samba 3 domain SID is invalid!") . "</b></font>");
|
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scriptpath && !eregi("^/[a-z0-9_\\-]+(/[a-z0-9_\\-]+)+$", $scriptpath)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("Script path is invalid!") . "</b></font>");
|
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($scriptserver && !is_string($scriptserver)) {
|
|
|
|
echo ("<font color=\"red\"><b>" . _("Script server is invalid!") . "</b></font>");
|
2003-06-19 19:01:00 +00:00
|
|
|
echo ("\n<br><br><br><a href=\"javascript:history.back()\">" . _("Back to preferences...") . "</a>");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
// set new preferences
|
2003-04-18 15:50:01 +00:00
|
|
|
$conf->set_ServerURL($serverurl);
|
2003-02-25 21:28:17 +00:00
|
|
|
$conf->set_Adminstring($admins);
|
2003-03-05 18:38:19 +00:00
|
|
|
$conf->set_UserSuffix($suffusers);
|
|
|
|
$conf->set_GroupSuffix($suffgroups);
|
|
|
|
$conf->set_HostSuffix($suffhosts);
|
2003-07-25 15:41:51 +00:00
|
|
|
$conf->set_DomainSuffix($suffdomains);
|
|
|
|
$conf->set_MapSuffix($suffmap);
|
2003-03-13 14:40:19 +00:00
|
|
|
$conf->set_minUID($minUID);
|
|
|
|
$conf->set_maxUID($maxUID);
|
|
|
|
$conf->set_minGID($minGID);
|
|
|
|
$conf->set_maxGID($maxGID);
|
|
|
|
$conf->set_minMachine($minMach);
|
|
|
|
$conf->set_maxMachine($maxMach);
|
2003-03-30 19:51:47 +00:00
|
|
|
$conf->set_userlistAttributes($usrlstattr);
|
|
|
|
$conf->set_grouplistAttributes($grplstattr);
|
|
|
|
$conf->set_hostlistAttributes($hstlstattr);
|
2003-05-06 23:52:00 +00:00
|
|
|
$conf->set_MaxListEntries($maxlistentries);
|
2003-07-15 17:30:12 +00:00
|
|
|
$conf->set_defaultLanguage($lang);
|
2003-05-28 15:37:48 +00:00
|
|
|
$conf->set_samba3($samba3);
|
2003-06-19 19:01:00 +00:00
|
|
|
$conf->set_domainSID($domainSID);
|
2003-07-25 15:41:51 +00:00
|
|
|
$conf->set_scriptpath($scriptpath);
|
|
|
|
$conf->set_scriptserver($scriptserver);
|
2003-05-09 16:22:46 +00:00
|
|
|
|
|
|
|
|
2003-02-25 21:28:17 +00:00
|
|
|
|
|
|
|
// check if password was changed
|
|
|
|
if ($pass1 != $pass2) {
|
2003-07-04 16:25:05 +00:00
|
|
|
echo ("<b>" . _("Passwords are different!") . "</b>");
|
2003-02-25 21:28:17 +00:00
|
|
|
exit;
|
|
|
|
}
|
2003-03-08 10:10:19 +00:00
|
|
|
// set new password
|
2003-02-25 21:28:17 +00:00
|
|
|
if ($pass1 != "") {
|
|
|
|
$conf->set_Passwd($pass1);
|
|
|
|
echo ("<b>" . _("Password changed!") . "</b><br><br>");
|
|
|
|
}
|
2003-03-08 10:10:19 +00:00
|
|
|
// save settings and display new settings
|
2003-03-01 16:57:54 +00:00
|
|
|
$conf->save();
|
2003-07-06 10:24:41 +00:00
|
|
|
echo ("<b>" . _("The following settings were saved to profile:") . " </b>" . $filename . "<br><br>");
|
2003-02-25 21:28:17 +00:00
|
|
|
$conf->printconf();
|
2003-04-23 19:13:55 +00:00
|
|
|
echo ("<br><br><br><br><br><a href=\"../login.php\" target=\"_top\">" . _("Back to Login") . "</a>");
|
2003-05-14 13:45:52 +00:00
|
|
|
|
|
|
|
echo("</body></html>");
|
|
|
|
|
2003-05-09 16:22:46 +00:00
|
|
|
// remove settings from session
|
2003-07-15 17:30:12 +00:00
|
|
|
session_unregister('passwd');
|
|
|
|
session_unregister('passwd1');
|
|
|
|
session_unregister('passwd2');
|
|
|
|
session_unregister('serverurl');
|
|
|
|
session_unregister('admins');
|
|
|
|
session_unregister('suffusers');
|
|
|
|
session_unregister('suffgroups');
|
|
|
|
session_unregister('suffhosts');
|
2003-07-25 15:41:51 +00:00
|
|
|
session_unregister('suffdomains');
|
|
|
|
session_unregister('suffmap');
|
2003-07-15 17:30:12 +00:00
|
|
|
session_unregister('minUID');
|
|
|
|
session_unregister('maxUID');
|
|
|
|
session_unregister('minGID');
|
|
|
|
session_unregister('maxGID');
|
|
|
|
session_unregister('minMach');
|
|
|
|
session_unregister('maxMach');
|
|
|
|
session_unregister('usrlstattr');
|
|
|
|
session_unregister('grplstattr');
|
|
|
|
session_unregister('hstlstattr');
|
|
|
|
session_unregister('maxlistentries');
|
|
|
|
session_unregister('lang');
|
|
|
|
session_unregister('scriptpath');
|
|
|
|
session_unregister('scriptserver');
|
|
|
|
session_unregister('samba3');
|
|
|
|
session_unregister('domainSID');
|
|
|
|
session_unregister('filename');
|
2003-05-12 17:52:54 +00:00
|
|
|
|
2003-03-08 10:10:19 +00:00
|
|
|
?>
|