From 13e9b1ec8e98c64cee6ffa4ad3d6bca62d8bb342 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 11 Mar 2004 21:02:55 +0000 Subject: [PATCH] fixed self-test --- lam-0.4/lib/lamdaemon.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lam-0.4/lib/lamdaemon.pl b/lam-0.4/lib/lamdaemon.pl index 559134c1..95580243 100755 --- a/lam-0.4/lib/lamdaemon.pl +++ b/lam-0.4/lib/lamdaemon.pl @@ -71,11 +71,10 @@ if ($( == 0 ) { # we are root if ($ARGV[0] eq "*test") { use Quota; # Needed to get and set quotas print "Perl quota module successfully installed.\n"; - print "IF you haven't seen any errors lamdaemon.pl was set up successfully.\n"; + print "If you haven't seen any errors lamdaemon.pl was set up successfully.\n"; } else { # loop for every transmitted user - # 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++) { @@ -198,21 +197,22 @@ else { @username = split (',', $ARGV[0]); $username[0] =~ s/uid=//; $password = $ARGV[1]; - # Put all transfered lines in one string - if ($ARGV[2] ne "*test") { - $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); - # Change needed to prevent buffer overrun - @string2 = split ("\n", $string); - for ($i=0; $i<=$#string2; $i++) { - ($stdout2, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string2[$i]); - $stdout .= $stdout2; + # Put all transfered lines in one string + if ($ARGV[2] ne "*test") { + $string = do {local $/;}; + @string2 = split ("\n", $string); + for ($i=0; $i<=$#string2; $i++) { + ($stdout2, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string2[$i]); + $stdout .= $stdout2; } - #($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string); - print $stdout; + print $stdout; } + else { + ($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath *test"); + print $stdout; + } +}