mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-22 22:03:44 +03:00
src: Fix ssh tunnel with non-POSIX remote shells
The command depends on POSIX-compatible shell being the default shell on the remote side of SSH, but that might not be the case. To make sure the command gets parsed correctly this commit encloses it in extra single quotes (to avoid it being parsed by the remote shell) and passes that string as a parameter to `sh -c`. Signed-off-by: Martin Kletzander <nert.pinx@gmail.com>
This commit is contained in:
parent
dec15f96a0
commit
0a6155ca13
@ -847,7 +847,7 @@ virt_viewer_app_open_tunnel_ssh(const char *sshhost,
|
||||
}
|
||||
cmd[n++] = sshhost;
|
||||
|
||||
cat = g_string_new("if (command -v socat) >/dev/null 2>&1");
|
||||
cat = g_string_new("sh -c 'if (command -v socat) >/dev/null 2>&1");
|
||||
|
||||
g_string_append(cat, "; then socat - ");
|
||||
if (port) {
|
||||
@ -868,7 +868,7 @@ virt_viewer_app_open_tunnel_ssh(const char *sshhost,
|
||||
else
|
||||
g_string_append_printf(cat, "-U %s", unixsock);
|
||||
|
||||
g_string_append(cat, "; fi");
|
||||
g_string_append(cat, "; fi'");
|
||||
|
||||
cmd[n++] = cat->str;
|
||||
cmd[n++] = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user