mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +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>
This commit is contained in:
@@ -1518,7 +1518,23 @@ int ssh_options_apply(ssh_session session)
|
||||
session->opts.global_knownhosts = tmp;
|
||||
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user