diff --git a/lam/lib/lamdaemon.pl b/lam/lib/lamdaemon.pl index edff0c1a..f3b414b6 100755 --- a/lam/lib/lamdaemon.pl +++ b/lam/lib/lamdaemon.pl @@ -75,9 +75,12 @@ if ($( == 0 ) { # we are root } else { # loop for every transmitted user - while (defined($input = )) { + # XXX fixme change code to read stdin at once and then loop + my $string = do {local $/;}; + @input = split ("\n", $string ); + for ($i=0; $i<=$#input; $i++) { $return = ""; - @vals = split (' ', $input); + @vals = split (' ', $input[$i]); switch: { # Get user information if (($vals[3] eq 'user') || ($vals[1] eq 'home')) { @user = getpwnam($vals[0]); } @@ -197,26 +200,14 @@ else { $username[0] =~ s/uid=//; $password = $ARGV[1]; # Put all transfered lines in one string - $i = 0; - $j = 0; if ($ARGV[2] ne "*test") { - while (defined($input = )) { - $string[$i] .= $input; - $j++; - if ($j==5) { - $j=0; - $i++; - } - } + $string = do {local $/;}; } else { $argv = "*test\n"; } my $ssh = Net::SSH::Perl->new($hostname, options=>[ "UserKnownHostsFile /dev/null"], protocol => "2,1" ); $ssh->login($username[0], $password); - foreach $string2 ( @string ) { - ($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string2); - $return .= $stdout; - } - print "$return"; + ($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string); + print $stdout; } diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php index eb439f9c..1d4a0681 100644 --- a/lam/templates/account/useredit.php +++ b/lam/templates/account/useredit.php @@ -209,7 +209,7 @@ switch ($_POST['select']) { // Recreate workstation string $account_new->smb_smbuserworkstations = $workstations[0]; for ($i=1; $ismb_smbuserworkstations = $account_new->smb_smbuserworkstations . ", " . $workstations[$i]; + $account_new->smb_smbuserworkstations = $account_new->smb_smbuserworkstations . "," . $workstations[$i]; } break; }