Fixed small bug prevention to display next page

This commit is contained in:
katagia 2003-10-22 17:51:44 +00:00
parent a8faa1470f
commit e49648af93
8 changed files with 74 additions and 13 deletions

View File

@ -49,6 +49,19 @@ thins to get it work.
* run make * run make
* run make install * run make install
4. Set up ssh
The ssh connection is done to remote hast as the user your
webserver is running as. In my case it's wwwrun.
You have to connect one time to remote host because in most
cases the host key has to added.
This can be done by connecting to remote host and confirm the
question about host authenticity.
Example (as root):
su wwwrun
ssh -l $admin-user $remotehost
Confirm all questions.
Exit the connection and connect again. You shouldn't be asked
about enything.
Now everything should work fine Now everything should work fine

View File

@ -187,7 +187,7 @@ else {
@username = split (',', $ARGV[0]); @username = split (',', $ARGV[0]);
$username[0] =~ s/uid=//; $username[0] =~ s/uid=//;
my $ssh = Net::SSH::Perl->new($hostname, options=>[ my $ssh = Net::SSH::Perl->new($hostname, options=>[
"IdentityFile /var/lib/wwwrun/.ssh/id_dsa", #"IdentityFile /var/lib/wwwrun/.ssh/id_dsa",
"UserKnownHostsFile /dev/null" "UserKnownHostsFile /dev/null"
]); ]);
$ssh->login($username[0], $ARGV[1]); $ssh->login($username[0], $ARGV[1]);

View File

@ -34,6 +34,13 @@ include_once('../../lib/ldap.inc'); // LDAP-functions
// Start session // Start session
session_save_path('../../sess'); session_save_path('../../sess');
@session_start(); @session_start();
// Redirect to startpage if user is not loged in
if (!isset($_SESSION['loggedIn'])) {
metaRefresh("../login.php");
die;
}
// Set correct language, codepages, .... // Set correct language, codepages, ....
setlanguage(); setlanguage();
@ -321,8 +328,12 @@ do { // X-Or, only one if() can be true
} }
if ($_POST['next_final']) { if ($_POST['next_final']) {
// Check if objectclasses are OK // Check if objectclasses are OK
if ($config_intern->is_samba3() && !isset($account_new->smb_domain)) // Samba page not viewed; can not create group because if missing options $stay = false;
if ($config_intern->is_samba3() && !isset($account_new->smb_domain)) {
// Samba page not viewed; can not create group because if missing options
$errors[] = array("ERROR", _("Samba Options not set!"), _("Please check settings on samba page.")); $errors[] = array("ERROR", _("Samba Options not set!"), _("Please check settings on samba page."));
$stay = true;
}
if (isset($account_old->general_objectClass)) { if (isset($account_old->general_objectClass)) {
if (($config_intern->is_samba3()) && (!in_array('sambaGroupMapping', $account_old->general_objectClass))) if (($config_intern->is_samba3()) && (!in_array('sambaGroupMapping', $account_old->general_objectClass)))
$errors[] = array('WARN', _('ObjectClass sambaGroupMapping not found.'), _('Have to add objectClass sambaGroupMapping.')); $errors[] = array('WARN', _('ObjectClass sambaGroupMapping not found.'), _('Have to add objectClass sambaGroupMapping.'));
@ -334,7 +345,7 @@ do { // X-Or, only one if() can be true
$errors[] = array('INFO', _('GID-number has changed. You have to run the following command as root in order to change existing file-permissions:'), $errors[] = array('INFO', _('GID-number has changed. You have to run the following command as root in order to change existing file-permissions:'),
'find / -gid ' . $account_old->general_uidNumber . ' -exec chgrp ' . $account_new->general_uidNumber . ' {} \;'); 'find / -gid ' . $account_old->general_uidNumber . ' -exec chgrp ' . $account_new->general_uidNumber . ' {} \;');
// Go from final to next page if no error did ocour // Go from final to next page if no error did ocour
if (!isset($errors)) $select_local='final'; if (!$stay)) $select_local='final';
else $select_local=$_POST['select']; else $select_local=$_POST['select'];
break; break;
} }

View File

@ -34,6 +34,13 @@ include_once('../../lib/ldap.inc'); // LDAP-functions
// Start session // Start session
session_save_path('../../sess'); session_save_path('../../sess');
@session_start(); @session_start();
// Redirect to startpage if user is not loged in
if (!isset($_SESSION['loggedIn'])) {
metaRefresh("login.php");
die;
}
// Set correct language, codepages, .... // Set correct language, codepages, ....
setlanguage(); setlanguage();

View File

@ -34,6 +34,13 @@ include_once('../../lib/ldap.inc'); // LDAP-functions
// Start session // Start session
session_save_path('../../sess'); session_save_path('../../sess');
@session_start(); @session_start();
// Redirect to startpage if user is not loged in
if (!isset($_SESSION['loggedIn'])) {
metaRefresh("../login.php");
die;
}
// Set correct language, codepages, .... // Set correct language, codepages, ....
setlanguage(); setlanguage();
@ -537,6 +544,7 @@ do { // X-Or, only one if() can be true
} }
if ($_POST['next_final']) { if ($_POST['next_final']) {
// Go from final to next page if no error did ocour // Go from final to next page if no error did ocour
$stay = false;
if (($account_old) && ($account_new->general_uidNumber != $account_old->general_uidNumber)) if (($account_old) && ($account_new->general_uidNumber != $account_old->general_uidNumber))
$errors[] = array('INFO', _('UID-number has changed. You have to run the following command as root in order to change existing file-permissions:'), $errors[] = array('INFO', _('UID-number has changed. You have to run the following command as root in order to change existing file-permissions:'),
'find / -gid ' . $account_old->general_uidNumber . ' -exec chown ' . $account_new->general_uidNumber . ' {} \;'); 'find / -gid ' . $account_old->general_uidNumber . ' -exec chown ' . $account_new->general_uidNumber . ' {} \;');
@ -546,10 +554,12 @@ do { // X-Or, only one if() can be true
if (($account_old) && ($account_new->general_homedir != $account_old->general_homedir)) if (($account_old) && ($account_new->general_homedir != $account_old->general_homedir))
$errors[] = array('INFO', _('Home Directory has changed. You have to run the following command as root in order to change the existing homedirectory:'), $errors[] = array('INFO', _('Home Directory has changed. You have to run the following command as root in order to change the existing homedirectory:'),
'mv ' . $account_old->general_homedir . ' ' . $account_new->general_homedir); 'mv ' . $account_old->general_homedir . ' ' . $account_new->general_homedir);
if ($config_intern->is_samba3() && !isset($account_new->smb_domain)) if ($config_intern->is_samba3() && !isset($account_new->smb_domain)) {
// Samba page not viewed; can not create user because if missing options // Samba page not viewed; can not create user because if missing options
$errors[] = array("ERROR", _("Samba Options not set!"), _("Please check settings on samba page.")); $errors[] = array("ERROR", _("Samba Options not set!"), _("Please check settings on samba page."));
else { $stay = true;
}
if (!$config_intern->is_samba3()) {
$found = false; $found = false;
if (strstr($account_new->smb_scriptPath, '$group')) $found = true; if (strstr($account_new->smb_scriptPath, '$group')) $found = true;
if (strstr($account_new->smb_scriptPath, '$user')) $found = true; if (strstr($account_new->smb_scriptPath, '$user')) $found = true;
@ -559,6 +569,7 @@ do { // X-Or, only one if() can be true
if (strstr($account_new->smb_smbhome, '$user')) $found = true; if (strstr($account_new->smb_smbhome, '$user')) $found = true;
if ($found) if ($found)
// Samba page not viewed; can not create group because if missing options // Samba page not viewed; can not create group because if missing options
$stay = true;
$errors[] = array("ERROR", _("Samba Options not set!"), _("Please check settings on samba page.")); $errors[] = array("ERROR", _("Samba Options not set!"), _("Please check settings on samba page."));
} }
if (isset($account_old->general_objectClass)) { if (isset($account_old->general_objectClass)) {
@ -575,7 +586,7 @@ do { // X-Or, only one if() can be true
$errors[] = array('WARN', _('ObjectClass sambaAccount not found.'), _('Have to add objectClass sambaAccount. User with sambaSamAccount will be set back to sambaAccount.')); $errors[] = array('WARN', _('ObjectClass sambaAccount not found.'), _('Have to add objectClass sambaAccount. User with sambaSamAccount will be set back to sambaAccount.'));
} }
} }
if (!is_array($errors)) $select_local='final'; if (!$stay) $select_local='final';
else $select_local=$_POST['select']; else $select_local=$_POST['select'];
break; break;
} }

View File

@ -29,6 +29,12 @@ include_once('../lib/config.inc');
// start session // start session
session_save_path('../sess'); session_save_path('../sess');
@session_start(); @session_start();
// Redirect to startpage if user is not loged in
if (!isset($_SESSION['loggedIn'])) {
metaRefresh("login.php");
die;
}
// set language // set language
setlanguage(); setlanguage();
@ -177,10 +183,9 @@ if ($_POST['delete_yes']) {
// Get group GIDNumber // Get group GIDNumber
$groupgid = getgid($groupname); $groupgid = getgid($groupname);
// Search for users which have gid set to current gid // Search for users which have gid set to current gid
$result = ldap_search($ldap_intern->server(), $dn, "gidNumber=$groupgid", array('')); $result = ldap_search($ldap_intern->server(), $config_intern->get_UserSuffix(), "gidNumber=$groupgid", array(''));
$entry = ldap_first_entry($ldap_intern->server(), $result);
// Print error if still users in group // Print error if still users in group
if ($entry) $error = _('Could not delete group. Still users in group:').' '.$dn; if (!$result) $error = _('Could not delete group. Still users in group:').' '.$dn;
else { else {
// continue if no primary users are in group // continue if no primary users are in group
// Remove quotas if lamdaemon.pl is used // Remove quotas if lamdaemon.pl is used

View File

@ -34,6 +34,13 @@ include_once('../lib/pdf.inc'); // Return a pdf-file
// Start Session // Start Session
session_save_path('../sess'); session_save_path('../sess');
@session_start(); @session_start();
// Redirect to startpage if user is not loged in
if (!isset($_SESSION['loggedIn'])) {
metaRefresh("login.php");
die;
}
// Set correct language, codepages, .... // Set correct language, codepages, ....
setlanguage(); setlanguage();
@ -443,7 +450,7 @@ echo '</form></body></html>';
function loadfile() { function loadfile() {
if ($_FILES['userfile']['size']>0) { if ($_FILES['userfile']['size']>0) {
// Array with all OUs from users // Array with all OUs from users
$OUs = array(); $OUs = $_SESSION['ldap']->search_units($_SESSION['config']->get_UserSuffix());
// fixme **** load all existing OUs in Array // fixme **** load all existing OUs in Array
// open csv-file // open csv-file
$handle = fopen($_FILES['userfile']['tmp_name'], 'r'); $handle = fopen($_FILES['userfile']['tmp_name'], 'r');
@ -510,11 +517,11 @@ function loadfile() {
// Expand DN of user with ou=$group // Expand DN of user with ou=$group
$_SESSION['accounts'][$row]->general_dn = "ou=".$_SESSION['accounts'][$row]->general_group .','. $_POST['f_general_suffix']; $_SESSION['accounts'][$row]->general_dn = "ou=".$_SESSION['accounts'][$row]->general_group .','. $_POST['f_general_suffix'];
// Create OUs if needed // Create OUs if needed
if (!in_array($_SESSION['accounts'][$row]->general_group, $OUs)) { if (!in_array("ou=".$_SESSION['accounts'][$row]->general_group.",".$_POST['f_general_suffix'], $OUs)) {
$attr['objectClass']= 'organizationalUnit'; $attr['objectClass']= 'organizationalUnit';
$attr['ou'] = $_SESSION['accounts'][$row]->general_group; $attr['ou'] = $_SESSION['accounts'][$row]->general_group;
$success = @ldap_add($_SESSION['ldap']->server(), $_SESSION['accounts'][$row]->general_dn, $attr); $success = ldap_add($_SESSION['ldap']->server(), $_SESSION['accounts'][$row]->general_dn, $attr);
if ($success) $OUs[] = $_SESSION['accounts'][$row]->general_group; if ($success) $OUs[] = "ou=".$_SESSION['accounts'][$row]->general_group.",".$_POST['f_general_suffix'];
} }
} }
// Set DN without uid=$username // Set DN without uid=$username

View File

@ -34,6 +34,13 @@ include_once('../lib/ldap.inc'); // LDAP-functions
// Start Session // Start Session
session_save_path('../sess'); session_save_path('../sess');
@session_start(); @session_start();
// Redirect to startpage if user is not loged in
if (!isset($_SESSION['loggedIn'])) {
metaRefresh("login.php");
die;
}
// Set correct language, codepages, .... // Set correct language, codepages, ....
setlanguage(); setlanguage();