removed bug in userworkstations

This commit is contained in:
katagia 2003-11-18 08:06:46 +00:00
parent 5261442687
commit 9af780b94e
2 changed files with 9 additions and 18 deletions

View File

@ -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";
} }

View File

@ -209,7 +209,7 @@ switch ($_POST['select']) {
// Recreate workstation string // Recreate workstation string
$account_new->smb_smbuserworkstations = $workstations[0]; $account_new->smb_smbuserworkstations = $workstations[0];
for ($i=1; $i<count($workstations); $i++) { for ($i=1; $i<count($workstations); $i++) {
$account_new->smb_smbuserworkstations = $account_new->smb_smbuserworkstations . ", " . $workstations[$i]; $account_new->smb_smbuserworkstations = $account_new->smb_smbuserworkstations . "," . $workstations[$i];
} }
break; break;
} }