Showing with 29 additions and 1 deletion.
  1. +8 −0 configure.ac
  2. +5 −0 ssh.1
  3. +16 −1 ssh.c
@@ -1448,6 +1448,14 @@ else
AC_MSG_RESULT([no])
fi

AC_MSG_CHECKING([for /proc/self/exe link])
if test -L "/proc/self/exe" ; then
AC_DEFINE([HAVE_PROC_SELF_EXE], [1], [Define if you have /proc/self/exe])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi

# Check whether user wants S/Key support
SKEY_MSG="no"
AC_ARG_WITH([skey],
5 ssh.1
@@ -330,6 +330,11 @@ Multiple jump hops may be specified separated by comma characters.
This is a shortcut to specify a
.Cm ProxyJump
configuration directive.
When constructing the proxy command lines, the environment variable
.Ev SSH_CUSTOM_CMD
can be used to specify the
.Nm
binary to use.
.Pp
.It Fl K
Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
17 ssh.c
@@ -1096,6 +1096,20 @@ main(int ac, char **av)
*/
if (options.jump_host != NULL) {
char port_s[8];
#ifdef HAVE_PROC_SELF_EXE
char ssh_path[PATH_MAX];
#endif
char *ssh_cmd = getenv("SSH_CUSTOM_CMD");
if (ssh_cmd && ssh_cmd[0] != '\0') {
debug("Using custom SSH command: '%s'", ssh_cmd);
#ifdef HAVE_PROC_SELF_EXE
} else if (readlink("/proc/self/exe", ssh_path, PATH_MAX) != -1) {
debug("Located own ssh binary: '%s'", ssh_path);
ssh_cmd = ssh_path;
#endif
} else {
ssh_cmd = "ssh";
}

/* Consistency check */
if (options.proxy_command != NULL)
@@ -1104,7 +1118,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",
ssh_cmd,
/* Optional "-l user" argument if jump_user set */
options.jump_user == NULL ? "" : " -l ",
options.jump_user == NULL ? "" : options.jump_user,