mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
remote: do not check for an existing config dir
When composing the path to the default known_hosts file (for the libssh and libssh2 drivers), do not check whether the configuration directory (determined by virGetUserConfigDirectory()) exists: both the drivers can handle non-existing files, and are able to create them (and their directories) in that case. This adds a small behaviour change: before, the key for an unknown host, and manually accepted, was saved only if the configuration directory existed -- a bit incoherent behaviour though.
This commit is contained in:
parent
45c4a70c70
commit
1a5de3fe2e
@ -462,11 +462,9 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
|
|||||||
} else {
|
} else {
|
||||||
confdir = virGetUserConfigDirectory();
|
confdir = virGetUserConfigDirectory();
|
||||||
if (confdir) {
|
if (confdir) {
|
||||||
if (virFileExists(confdir)) {
|
virBufferAsprintf(&buf, "%s/known_hosts", confdir);
|
||||||
virBufferAsprintf(&buf, "%s/known_hosts", confdir);
|
if (!(knownhosts = virBufferContentAndReset(&buf)))
|
||||||
if (!(knownhosts = virBufferContentAndReset(&buf)))
|
goto no_memory;
|
||||||
goto no_memory;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,10 +571,8 @@ virNetClientPtr virNetClientNewLibssh(const char *host,
|
|||||||
} else {
|
} else {
|
||||||
confdir = virGetUserConfigDirectory();
|
confdir = virGetUserConfigDirectory();
|
||||||
if (confdir) {
|
if (confdir) {
|
||||||
if (virFileExists(confdir)) {
|
if (virAsprintf(&knownhosts, "%s/known_hosts", confdir) < 0)
|
||||||
if (virAsprintf(&knownhosts, "%s/known_hosts", confdir) < 0)
|
goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user