mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-02 01:17:52 +03:00
Respect known_hosts file set by the user.
Thanks to contact@leblanc-simon.eu for the patch.
This commit is contained in:
@@ -1501,10 +1501,12 @@ int ssh_write_knownhost(ssh_session session) {
|
|||||||
char *dir;
|
char *dir;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
|
if (session->knownhosts == NULL) {
|
||||||
if (ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL) < 0) {
|
if (ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL) < 0) {
|
||||||
ssh_set_error(session, SSH_FATAL, "Cannot find known_hosts file.");
|
ssh_set_error(session, SSH_FATAL, "Can't find a known_hosts file");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (session->host == NULL) {
|
if (session->host == NULL) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
|
|||||||
Reference in New Issue
Block a user