aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-10-30 13:55:30 +0100
committerJakub Jelen <jjelen@redhat.com>2018-11-02 10:08:20 +0100
commit5159cd96e8b61c9f8f96786f70cf23167980b621 (patch)
tree19738fee04d6952a4d8b641df2b11c8532a66dcd
parent35c417312c0b0a9cb04a160dbc92fa10e8e0ef74 (diff)
downloadlibssh-5159cd96e8b61c9f8f96786f70cf23167980b621.tar.gz
libssh-5159cd96e8b61c9f8f96786f70cf23167980b621.tar.xz
libssh-5159cd96e8b61c9f8f96786f70cf23167980b621.zip
knownhosts: Make sure we have both knownhosts files ready
If either one is missing at this point, fill it with default vaules in ssh_options_apply(). Previously, when setting up only knownhosts, global_knownhosts file was left pointing to NULL and the ssh_known_hosts_read_entries() was trying to open NULL file which is invalid. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/knownhosts.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/knownhosts.c b/src/knownhosts.c
index 23902a5f..546619aa 100644
--- a/src/knownhosts.c
+++ b/src/knownhosts.c
@@ -306,7 +306,8 @@ struct ssh_list *ssh_known_hosts_get_algorithms(ssh_session session)
int list_error = 0;
int rc;
- if (session->opts.knownhosts == NULL) {
+ if (session->opts.knownhosts == NULL ||
+ session->opts.global_knownhosts == NULL) {
if (ssh_options_apply(session) < 0) {
ssh_set_error(session,
SSH_REQUEST_DENIED,