removed bug in userworkstations
This commit is contained in:
parent
5261442687
commit
9af780b94e
|
@ -75,9 +75,12 @@ if ($( == 0 ) { # we are root
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# loop for every transmitted user
|
# loop for every transmitted user
|
||||||
while (defined($input = <STDIN>)) {
|
# 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++) {
|
||||||
$return = "";
|
$return = "";
|
||||||
@vals = split (' ', $input);
|
@vals = split (' ', $input[$i]);
|
||||||
switch: {
|
switch: {
|
||||||
# Get user information
|
# Get user information
|
||||||
if (($vals[3] eq 'user') || ($vals[1] eq 'home')) { @user = getpwnam($vals[0]); }
|
if (($vals[3] eq 'user') || ($vals[1] eq 'home')) { @user = getpwnam($vals[0]); }
|
||||||
|
@ -197,26 +200,14 @@ else {
|
||||||
$username[0] =~ s/uid=//;
|
$username[0] =~ s/uid=//;
|
||||||
$password = $ARGV[1];
|
$password = $ARGV[1];
|
||||||
# Put all transfered lines in one string
|
# Put all transfered lines in one string
|
||||||
$i = 0;
|
|
||||||
$j = 0;
|
|
||||||
if ($ARGV[2] ne "*test") {
|
if ($ARGV[2] ne "*test") {
|
||||||
while (defined($input = <STDIN>)) {
|
$string = do {local $/;<STDIN>};
|
||||||
$string[$i] .= $input;
|
|
||||||
$j++;
|
|
||||||
if ($j==5) {
|
|
||||||
$j=0;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else { $argv = "*test\n"; }
|
else { $argv = "*test\n"; }
|
||||||
my $ssh = Net::SSH::Perl->new($hostname, options=>[
|
my $ssh = Net::SSH::Perl->new($hostname, options=>[
|
||||||
"UserKnownHostsFile /dev/null"],
|
"UserKnownHostsFile /dev/null"],
|
||||||
protocol => "2,1" );
|
protocol => "2,1" );
|
||||||
$ssh->login($username[0], $password);
|
$ssh->login($username[0], $password);
|
||||||
foreach $string2 ( @string ) {
|
($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string);
|
||||||
($stdout, $stderr, $exit) = $ssh->cmd("sudo $remotepath $argv", $string2);
|
print $stdout;
|
||||||
$return .= $stdout;
|
|
||||||
}
|
|
||||||
print "$return";
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue