diff options
author | Anders Kaseorg <andersk@mit.edu> | 2015-08-07 19:57:55 -0400 |
---|---|---|
committer | John Hood <cgull@glup.org> | 2015-11-01 01:07:21 -0400 |
commit | f0f2aa7ccee46ac9c1dc4ab40067c3aef7624125 (patch) | |
tree | 02be99380da63f1519c3f6098aec4929b5e64343 /scripts | |
parent | 57e54c46bc724c54323022fb18ec11c3f1e73162 (diff) |
mosh.pl: Run ssh directly instead of via sh
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mosh.pl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/mosh.pl b/scripts/mosh.pl index a18b4f1..2ef5a86 100755 --- a/scripts/mosh.pl +++ b/scripts/mosh.pl @@ -34,6 +34,7 @@ use warnings; use strict; use Getopt::Long; use IO::Socket; +use Text::ParseWords; $|=1; @@ -47,7 +48,7 @@ my $bind_ip = undef; my $family = 'inet'; my $port_request = undef; -my $ssh = 'ssh'; +my @ssh = ('ssh'); my $term_init = 1; @@ -119,7 +120,7 @@ GetOptions( 'client=s' => \$client, '4' => sub { $family = 'inet' }, '6' => sub { $family = 'inet6' }, 'p=s' => \$port_request, - 'ssh=s' => \$ssh, + 'ssh=s' => sub { @ssh = shellwords($_[1]); }, 'init!' => \$term_init, 'local' => \$localhost, 'help' => \$help, @@ -296,7 +297,7 @@ if ( $pid == 0 ) { # child die "Cannot exec $server: $!\n"; } my $quoted_self = shell_quote( $0, "--family=$family" ); - exec "$ssh " . shell_quote( '-S', 'none', '-o', "ProxyCommand=$quoted_self --fake-proxy -- %h %p", '-n', '-tt', $userhost, '--', "$server " . shell_quote( @server ) ); + exec @ssh, '-S', 'none', '-o', "ProxyCommand=$quoted_self --fake-proxy -- %h %p", '-n', '-tt', $userhost, '--', "$server " . shell_quote( @server ); die "Cannot exec ssh: $!\n"; } else { # parent my ( $ip, $port, $key ); |