aboutsummaryrefslogtreecommitdiff
path: root/libssh/keyfiles.c
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:35:38 +0100
commitb971834d1040bdbbe5b775248ffe511f8615287a (patch)
tree4cece815e3393ebb51ffbadc1a9beee2c19a2830 /libssh/keyfiles.c
parent94ee9effe6840912416168199a4eb5f1464a4eea (diff)
downloadlibssh-b971834d1040bdbbe5b775248ffe511f8615287a.tar.gz
libssh-b971834d1040bdbbe5b775248ffe511f8615287a.tar.xz
libssh-b971834d1040bdbbe5b775248ffe511f8615287a.zip
Respect known_hosts file set by the user.
Thanks to contact@leblanc-simon.eu for the patch.
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r--libssh/keyfiles.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 21b02a82..ab2050ed 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -1501,9 +1501,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) {