lamdaemon.pl should work now again.

This commit is contained in:
katagia 2003-11-06 14:53:00 +00:00
parent 2d98b6907e
commit ec277c457e
4 changed files with 63 additions and 62 deletions

View File

@ -276,8 +276,8 @@ function setquotas($values2,$values2_old=false) {
* admin-username, admin-password, account with quotas, 'quota', operation='set', type=user|group * admin-username, admin-password, account with quotas, 'quota', operation='set', type=user|group
* use escapeshellarg to make exec() shell-safe * use escapeshellarg to make exec() shell-safe
*/ */
$towrite = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".escapeshellarg($_SESSION['config']->scriptServer)." ". $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
escapeshellarg($_SESSION['config']->scriptPath)." ".escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]); escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
$descriptorspec = array( $descriptorspec = array(
0 => array("pipe", "r"), // stdin 0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stout 1 => array("pipe", "w"), // stout
@ -333,8 +333,8 @@ function remquotas($users, $type) {
* admin-username, admin-password, account with quotas, 'quota', operation='rem', type=user|group * admin-username, admin-password, account with quotas, 'quota', operation='rem', type=user|group
* use escapeshellarg to make exec() shell-safe * use escapeshellarg to make exec() shell-safe
*/ */
$towrite = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".escapeshellarg($_SESSION['config']->scriptServer)." ". $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
escapeshellarg($_SESSION['config']->scriptPath)." ".escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]); escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
$descriptorspec = array( $descriptorspec = array(
0 => array("pipe", "r"), // stdin 0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stout 1 => array("pipe", "w"), // stout
@ -373,8 +373,8 @@ function addhomedir($users) {
* admin-username, admin-password, owner of homedir, 'home', operation='add' * admin-username, admin-password, owner of homedir, 'home', operation='add'
* use escapeshellarg to make exec() shell-safe * use escapeshellarg to make exec() shell-safe
*/ */
$towrite = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".escapeshellarg($_SESSION['config']->scriptServer)." ". $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
escapeshellarg($_SESSION['config']->scriptPath)." ".escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]); escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
$descriptorspec = array( $descriptorspec = array(
0 => array("pipe", "r"), // stdin 0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stout 1 => array("pipe", "w"), // stout
@ -408,15 +408,15 @@ function addhomedir($users) {
* account is removed from ldap * account is removed from ldap
* $users = array of usernames * $users = array of usernames
*/ */
function remhomedir($user) { function remhomedir($users) {
// get username and password of the current lam-admin // get username and password of the current lam-admin
$ldap_q = $_SESSION['ldap']->decrypt(); $ldap_q = $_SESSION['ldap']->decrypt();
/* $towrite has the following syntax: /* $towrite has the following syntax:
* admin-username, admin-password, owner of homedir, 'home', operation='add' * admin-username, admin-password, owner of homedir, 'home', operation='add'
* use escapeshellarg to make exec() shell-safe * use escapeshellarg to make exec() shell-safe
*/ */
$towrite = escapeshellarg($_SESSION['lampath']."lib/lamdaemon.pl")." ".escapeshellarg($_SESSION['config']->scriptServer)." ". $towrite = escapeshellarg($_SESSION['config']->scriptServer)." ".escapeshellarg($_SESSION['config']->scriptPath)." ".
escapeshellarg($_SESSION['config']->scriptPath)." ".escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]); escapeshellarg($ldap_q[0]).' '.escapeshellarg($ldap_q[1]);
$descriptorspec = array( $descriptorspec = array(
0 => array("pipe", "r"), // stdin 0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stout 1 => array("pipe", "w"), // stout
@ -1736,7 +1736,8 @@ function modifyuser($values,$values_old,$uselamdaemon=true) { // Will modify the
} }
// Change quotas if quotas are set and lamdaemon.pl should be used // Change quotas if quotas are set and lamdaemon.pl should be used
if ($_SESSION['config']->scriptServer && is_array($values->quota) && $uselamdaemon) setquotas(array($values),array($values_old)); if ($_SESSION['config']->scriptServer && is_array($values->quota) && $uselamdaemon)
setquotas(array($values),array($values_old));
//make required changes in cache-array //make required changes in cache-array
if ((isset($_SESSION['userDN']))) { if ((isset($_SESSION['userDN']))) {
if ($values->general_dn != $values_old->general_dn) { if ($values->general_dn != $values_old->general_dn) {

View File

@ -121,7 +121,7 @@ if ($( == 0 ) { # we are root
use Quota; # Needed to get and set quotas use Quota; # Needed to get and set quotas
get_fs(); # Load list of devices with enabled quotas get_fs(); # Load list of devices with enabled quotas
# Store quota information in array # Store quota information in array
@quota_temp1 = split (':', $vals[6]); @quota_temp1 = split (':', $vals[4]);
$group=0; $group=0;
$i=0; $i=0;
while ($quota_temp1[$i]) { while ($quota_temp1[$i]) {
@ -132,54 +132,54 @@ if ($( == 0 ) { # we are root
$j++; $j++;
} }
$i++; $i++;
} }
if ($vals[3] eq 'user') { $group=false; } if ($vals[3] eq 'user') { $group=false; }
else { else {
$group=1; $group=1;
@quota_usr = @quota_grp; @quota_usr = @quota_grp;
} }
switch2: { switch2: {
$vals[2] eq 'rem' && do { $vals[2] eq 'rem' && do {
$i=0; $i=0;
($<, $>) = ($>, $<); # Get root privileges ($<, $>) = ($>, $<); # Get root privileges
while ($quota_usr[$i][0]) { while ($quota_usr[$i][0]) {
$dev = Quota::getqcarg($quota_usr[$i][1]);
$return = Quota::setqlim($dev,$user[2],0,0,0,0,1,$group);
$i++;
}
($<, $>) = ($>, $<); # Give up root previleges
last switch2;
};
$vals[2] eq 'set' && do {
$i=0;
($<, $>) = ($>, $<); # Get root privileges
while ($quota_usr[$i][0]) {
$dev = Quota::getqcarg($quota[$i][0]);
$return = Quota::setqlim($dev,$user[2],$quota[$i][1],$quota[$i][2],$quota[$i][3],$quota[$i][4],1,$group);
$i++;
}
($<, $>) = ($>, $<); # Give up root previleges
last switch2;
};
$vals[2] eq 'get' && do {
$i=0;
($<, $>) = ($>, $<); # Get root privileges
while ($quota_usr[$i][0]) {
if ($vals[2]ne'+') {
$dev = Quota::getqcarg($quota_usr[$i][1]); $dev = Quota::getqcarg($quota_usr[$i][1]);
$return = Quota::setqlim($dev,$user[2],0,0,0,0,1,$group); @temp = Quota::query($dev,$user[2],$group);
$i++; if ($temp[0]ne'') {
} $return = "$quota_usr[$i][1],$temp[0],$temp[1],$temp[2],$temp[3],$temp[4],$temp[5],$temp[6],$temp[7]:$return";
($<, $>) = ($>, $<); # Give up root previleges
last switch2;
};
$vals[2] eq 'set' && do {
$i=0;
($<, $>) = ($>, $<); # Get root privileges
while ($quota_usr[$i][0]) {
$dev = Quota::getqcarg($quota[$i][0]);
$return = Quota::setqlim($dev,$user[2],$quota[$i][1],$quota[$i][2],$quota[$i][3],$quota[$i][4],1,$group);
$i++;
}
($<, $>) = ($>, $<); # Give up root previleges
last switch2;
};
$vals[2] eq 'get' && do {
$i=0;
($<, $>) = ($>, $<); # Get root privileges
while ($quota_usr[$i][0]) {
if ($vals[2]ne'+') {
$dev = Quota::getqcarg($quota_usr[$i][1]);
@temp = Quota::query($dev,$user[2],$group);
if ($temp[0]ne'') {
$return = "$quota_usr[$i][1],$temp[0],$temp[1],$temp[2],$temp[3],$temp[4],$temp[5],$temp[6],$temp[7]:$return";
}
else { $return = "$quota_usr[$i][1],0,0,0,0,0,0,0,0:$return"; }
} }
else { $return = "$quota_usr[$i][1],0,0,0,0,0,0,0,0:$return"; } else { $return = "$quota_usr[$i][1],0,0,0,0,0,0,0,0:$return"; }
$i++;
} }
($<, $>) = ($>, $<); # Give up root previleges else { $return = "$quota_usr[$i][1],0,0,0,0,0,0,0,0:$return"; }
last switch2; $i++;
}; }
} ($<, $>) = ($>, $<); # Give up root previleges
last switch2;
};
}
last switch; last switch;
}; };
last switch; last switch;

View File

@ -190,7 +190,7 @@ if ($_POST['delete_yes']) {
} }
break; break;
} }
if ($config_intern->scriptServer && is_set($usernames)) { if ($config_intern->scriptServer && isset($usernames)) {
// Remove homedir if required // Remove homedir if required
if ($_POST['f_rem_home']) remhomedir($usernames); if ($_POST['f_rem_home']) remhomedir($usernames);
// Remove quotas if lamdaemon.pl is used // Remove quotas if lamdaemon.pl is used

View File

@ -584,9 +584,9 @@ function loadfile() {
$users[] = $_SESSION['accounts'][$row2]->general_username; $users[] = $_SESSION['accounts'][$row2]->general_username;
if ($_SESSION['accounts'][$row2]->general_username != $username) $_SESSION['mass_errors'][$row2][] = array('WARN', _('Username'), _('Username in use. Selected next free username.')); if ($_SESSION['accounts'][$row2]->general_username != $username) $_SESSION['mass_errors'][$row2][] = array('WARN', _('Username'), _('Username in use. Selected next free username.'));
// Check if givenname is valid // Check if givenname is valid
if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[<EFBFBD>|[<5B>|[<5B>|[<5B>|[]|[<5B>|[<5B>)+$', $_SESSION['accounts'][$row2]->general_givenname)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Given name'), _('Given name contains invalid characters')); if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $_SESSION['accounts'][$row2]->general_givenname)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Given name'), _('Given name contains invalid characters'));
// Check if surname is valid // Check if surname is valid
if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[<EFBFBD>|[<5B>|[<5B>|[<5B>|[]|[<5B>|[<5B>)+$', $_SESSION['accounts'][$row2]->general_surname)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Surname'), _('Surname contains invalid characters')); if ( !ereg('^([a-z]|[A-Z]|[-]|[ ]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])+$', $_SESSION['accounts'][$row2]->general_surname)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Surname'), _('Surname contains invalid characters'));
if ( ($_SESSION['accounts'][$row2]->general_gecos=='') || ($_SESSION['accounts'][$row2]->general_gecos==' ')) { if ( ($_SESSION['accounts'][$row2]->general_gecos=='') || ($_SESSION['accounts'][$row2]->general_gecos==' ')) {
$_SESSION['accounts'][$row2]->general_gecos = $_SESSION['accounts'][$row2]->general_givenname . " " . $_SESSION['accounts'][$row2]->general_surname ; $_SESSION['accounts'][$row2]->general_gecos = $_SESSION['accounts'][$row2]->general_givenname . " " . $_SESSION['accounts'][$row2]->general_surname ;
$_SESSION['mass_errors'][$row2][] = array('INFO', _('Gecos'), _('Inserted sur- and given name in gecos-field.')); $_SESSION['mass_errors'][$row2][] = array('INFO', _('Gecos'), _('Inserted sur- and given name in gecos-field.'));
@ -606,10 +606,10 @@ function loadfile() {
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_mobileTelephoneNumber)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!')); if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_mobileTelephoneNumber)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Mobile number'), _('Please enter a valid mobile number!'));
if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_facsimileTelephoneNumber)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!')); if ( !ereg('^(\+)*([0-9]|[ ]|[.]|[(]|[)]|[/])*$', $_SESSION['accounts'][$row2]->personal_facsimileTelephoneNumber)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Fax number'), _('Please enter a valid fax number!'));
if ( !ereg('^(([0-9]|[A-Z]|[a-z]|[.]|[-]|[_])+[@]([0-9]|[A-Z]|[a-z]|[-])+([.]([0-9]|[A-Z]|[a-z]|[-])+)*)*$', $_SESSION['accounts'][$row2]->personal_mail)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('eMail address'), _('Please enter a valid eMail address!')); if ( !ereg('^(([0-9]|[A-Z]|[a-z]|[.]|[-]|[_])+[@]([0-9]|[A-Z]|[a-z]|[-])+([.]([0-9]|[A-Z]|[a-z]|[-])+)*)*$', $_SESSION['accounts'][$row2]->personal_mail)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('eMail address'), _('Please enter a valid eMail address!'));
if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[<EFBFBD>|[<5B>|[<5B>|[<5B>|[<5B>|[]|[<5B>)*$', $_SESSION['accounts'][$row2]->personal_street)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Street'), _('Please enter a valid street name!')); if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*$', $_SESSION['accounts'][$row2]->personal_street)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Street'), _('Please enter a valid street name!'));
if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[<EFBFBD>|[<5B>|[<5B>|[<5B>|[<5B>|[]|[<5B>)*$', $_SESSION['accounts'][$row2]->personal_postalAddress)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Postal address'), _('Please enter a valid postal address!')); if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*$', $_SESSION['accounts'][$row2]->personal_postalAddress)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Postal address'), _('Please enter a valid postal address!'));
if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[<EFBFBD>|[<5B>|[<5B>|[<5B>|[<5B>|[]|[<5B>)*$', $_SESSION['accounts'][$row2]->personal_title)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Title'), _('Please enter a valid title!')); if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*$', $_SESSION['accounts'][$row2]->personal_title)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Title'), _('Please enter a valid title!'));
if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[<EFBFBD>|[<5B>|[<5B>|[<5B>|[<5B>|[]|[<5B>)*$', $_SESSION['accounts'][$row2]->personal_employeeType)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Employee type'), _('Please enter a valid employee type!')); if ( !ereg('^([0-9]|[A-Z]|[a-z]|[ ]|[.]|[ä]|[Ä]|[ö]|[Ö]|[ü]|[Ü]|[ß])*$', $_SESSION['accounts'][$row2]->personal_employeeType)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Employee type'), _('Please enter a valid employee type!'));
if ( !ereg('^([0-9]|[A-Z]|[a-z])*$', $_SESSION['accounts']->personal_postalCode)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Postal code'), _('Please enter a valid postal code!')); if ( !ereg('^([0-9]|[A-Z]|[a-z])*$', $_SESSION['accounts']->personal_postalCode)) $_SESSION['mass_errors'][$row2][] = array('ERROR', _('Postal code'), _('Please enter a valid postal code!'));
} }
} }