fixed self-test

This commit is contained in:
Roland Gruber 2004-03-11 21:02:55 +00:00
parent 4e9fd1c9ff
commit 13e9b1ec8e
1 changed files with 14 additions and 14 deletions

View File

@ -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 $/;<STDIN>};
@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 $/;<STDIN>};
}
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 $/;<STDIN>};
@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;
}
}