aboutsummaryrefslogtreecommitdiff
path: root/libssh/keyfiles.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-10-29 12:10:44 +0100
committerAndreas Schneider <mail@cynapses.org>2009-10-29 12:10:44 +0100
commitcce34a61760cd03091e47c98ae8f7cfef5dd716c (patch)
treee31b965299a57b3e6d6d929aa70e17f3b9d2f51c /libssh/keyfiles.c
parent89f031192764698e662235af93d4d04898319c25 (diff)
downloadlibssh-cce34a61760cd03091e47c98ae8f7cfef5dd716c.tar.gz
libssh-cce34a61760cd03091e47c98ae8f7cfef5dd716c.tar.xz
libssh-cce34a61760cd03091e47c98ae8f7cfef5dd716c.zip
Fixed setting knownhosts in ssh_is_server_known().
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r--libssh/keyfiles.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 5e7fe4f2..8dc2f10f 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -1386,11 +1386,13 @@ int ssh_is_server_known(ssh_session session) {
enter_function();
- if (ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL) < 0) {
- ssh_set_error(session, SSH_REQUEST_DENIED,
- "Can't find a known_hosts file");
- leave_function();
- return SSH_SERVER_FILE_NOT_FOUND;
+ if (session->knownhosts == NULL) {
+ if (ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, NULL) < 0) {
+ ssh_set_error(session, SSH_REQUEST_DENIED,
+ "Can't find a known_hosts file");
+ leave_function();
+ return SSH_SERVER_FILE_NOT_FOUND;
+ }
}
if (session->host == NULL) {