git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/utils@1093
959494ce-11ee-0310-bf91-
de5d638817bd
if(@ARGV < 1) {
print STDERR "usage: rsc HOST CMD ARG...\n";
exit 1;
}
if($ARGV[0] eq "-s") {
if(@ARGV < 1) {
print STDERR "usage: rsc HOST CMD ARG...\n";
exit 1;
}
if($ARGV[0] eq "-s") {
+ if(!defined($ARGV[1])) {
+ print STDERR "rsc: server side needs arguments\n";
+ exit 1
+ }
+ $arg = decode_base64($ARGV[1]);
+ for (split /\n/, $arg) {
chomp;
s/\\(.)/$1/g;
$c .= $_;
chomp;
s/\\(.)/$1/g;
$c .= $_;
}
} else {
$host = shift @ARGV;
}
} else {
$host = shift @ARGV;
- $pid = open SSH, "|-";
- if($pid == 0) {
- exec "ssh", "$host", "rsc", "-s";
- die "$!";
- }
for (@ARGV) {
s/([\\\n])/\\$1/g;
for (@ARGV) {
s/([\\\n])/\\$1/g;
- close SSH;
- waitpid $pid, 0;
- exit $?;
+ exec "ssh", "$host", "rsc", "-s", encode_base64($arg);
+ die "$!";