mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-10 10:26:47 +09:00
options: Use exec for the proxy command
This wont create a new process but replace the shell.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit bd2db30174)
This commit is contained in:
committed by
Jakub Jelen
parent
bb6d1b78dc
commit
7c6105882b
@@ -1518,7 +1518,23 @@ int ssh_options_apply(ssh_session session)
|
|||||||
session->opts.global_knownhosts = tmp;
|
session->opts.global_knownhosts = tmp;
|
||||||
|
|
||||||
if (session->opts.ProxyCommand != NULL) {
|
if (session->opts.ProxyCommand != NULL) {
|
||||||
tmp = ssh_path_expand_escape(session, session->opts.ProxyCommand);
|
char *p = NULL;
|
||||||
|
size_t plen = strlen(session->opts.ProxyCommand) +
|
||||||
|
5 /* strlen("exec ") */;
|
||||||
|
|
||||||
|
p = malloc(plen + 1 /* \0 */);
|
||||||
|
if (p == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = snprintf(p, plen + 1, "exec %s", session->opts.ProxyCommand);
|
||||||
|
if ((size_t)rc != plen) {
|
||||||
|
free(p);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = ssh_path_expand_escape(session, p);
|
||||||
|
free(p);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user