aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2010-02-07 21:41:08 +0100
committerAndreas Schneider <mail@cynapses.org>2010-02-07 22:39:35 +0100
commit14da14db05f627b867076073654df5d2f6436614 (patch)
treed074d15d53b331fdc12a2c49ddb2e7c0825f4f89
parent474d63f24e396e82316f316b07bfe04cf43a5a60 (diff)
downloadlibssh-14da14db05f627b867076073654df5d2f6436614.tar.gz
libssh-14da14db05f627b867076073654df5d2f6436614.tar.xz
libssh-14da14db05f627b867076073654df5d2f6436614.zip
Respect known_hosts file set by the user.
Thanks to contact@leblanc-simon.eu for the patch.
-rw-r--r--libssh/keyfiles.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 47904147..797e9579 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -1500,9 +1500,11 @@ int ssh_write_knownhost(ssh_session session) {
char *dir;
size_t len = 0;
- if (ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL) < 0) {
- ssh_set_error(session, SSH_FATAL, "Cannot find known_hosts file.");
- return -1;
+ if (session->knownhosts == NULL) {
+ if (ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL) < 0) {
+ ssh_set_error(session, SSH_FATAL, "Can't find a known_hosts file");
+ return -1;
+ }
}
if (session->host == NULL) {