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 {
# 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 = "";
@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 = <STDIN>)) {
$string[$i] .= $input;
$j++;
if ($j==5) {
$j=0;
$i++;
}
}
$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);
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;
}

View File

@ -209,7 +209,7 @@ switch ($_POST['select']) {
// Recreate workstation string
$account_new->smb_smbuserworkstations = $workstations[0];
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;
}