mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
remote: push logic for default netcat binary into common helper
We don't want to repeat the choice of default netcat binary setting in three different places. This will also make it possible to do better error reporting in the helper. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
019b13dd20
commit
5cd80b04d9
@ -1225,7 +1225,7 @@ doRemoteOpen(virConnectPtr conn,
|
||||
username,
|
||||
!tty,
|
||||
!verify,
|
||||
netcat ? netcat : "nc",
|
||||
netcat,
|
||||
keyfile,
|
||||
sockname)))
|
||||
goto failed;
|
||||
|
@ -419,6 +419,9 @@ virNetClientSSHHelperCommand(const char *netcatPath,
|
||||
{
|
||||
g_autofree char *netcatPathSafe = virNetClientDoubleEscapeShell(netcatPath);
|
||||
|
||||
if (!netcatPath)
|
||||
netcatPath = "nc";
|
||||
|
||||
return g_strdup_printf(
|
||||
"sh -c "
|
||||
"'if '%s' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
|
||||
@ -505,7 +508,6 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
|
||||
DEFAULT_VALUE(host, "localhost");
|
||||
DEFAULT_VALUE(port, "22");
|
||||
DEFAULT_VALUE(username, "root");
|
||||
DEFAULT_VALUE(netcatPath, "nc");
|
||||
DEFAULT_VALUE(knownHostsVerify, "normal");
|
||||
|
||||
command = virNetClientSSHHelperCommand(netcatPath, socketPath);
|
||||
@ -566,7 +568,6 @@ virNetClientPtr virNetClientNewLibssh(const char *host,
|
||||
DEFAULT_VALUE(host, "localhost");
|
||||
DEFAULT_VALUE(port, "22");
|
||||
DEFAULT_VALUE(username, "root");
|
||||
DEFAULT_VALUE(netcatPath, "nc");
|
||||
DEFAULT_VALUE(knownHostsVerify, "normal");
|
||||
|
||||
command = virNetClientSSHHelperCommand(netcatPath, socketPath);
|
||||
|
Loading…
x
Reference in New Issue
Block a user