diff options
author | 2018-06-01 03:11:49 +0000 | |
---|---|---|
committer | 2018-06-01 03:11:49 +0000 | |
commit | cc35ad4a31b1a835f787a15be579f6a2ac946441 (patch) | |
tree | cd52c134e7543e4f8da4c4d42a92377c9ebf7e03 /usr.bin/ssh/ssh.c | |
parent | remove 'where' parameter from all x*() functions in utils.c, it doesn't (diff) | |
download | wireguard-openbsd-cc35ad4a31b1a835f787a15be579f6a2ac946441.tar.xz wireguard-openbsd-cc35ad4a31b1a835f787a15be579f6a2ac946441.zip |
prefer argv0 to "ssh" when re-executing ssh for ProxyJump directive;
bz2831, feedback and ok dtucker@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 90cce2aa111..a4eb6902120 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.477 2018/04/14 21:50:41 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.478 2018/06/01 03:11:49 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1140,6 +1140,14 @@ main(int ac, char **av) */ if (options.jump_host != NULL) { char port_s[8]; + const char *sshbin = argv0; + + /* + * Try to use SSH indicated by argv[0], but fall back to + * "ssh" if it appears unavailable. + */ + if (strchr(argv0, '/') != NULL && access(argv0, X_OK) != 0) + sshbin = "ssh"; /* Consistency check */ if (options.proxy_command != NULL) @@ -1148,7 +1156,8 @@ main(int ac, char **av) options.proxy_use_fdpass = 0; snprintf(port_s, sizeof(port_s), "%d", options.jump_port); xasprintf(&options.proxy_command, - "ssh%s%s%s%s%s%s%s%s%s%.*s -W '[%%h]:%%p' %s", + "%s%s%s%s%s%s%s%s%s%s%.*s -W '[%%h]:%%p' %s", + sshbin, /* Optional "-l user" argument if jump_user set */ options.jump_user == NULL ? "" : " -l ", options.jump_user == NULL ? "" : options.jump_user, |