38 lines
1.3 KiB
Diff
38 lines
1.3 KiB
Diff
From bed645ed5fca3ff776fd1997ec9d5c6b9065a7eb Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Tue, 30 Oct 2018 13:55:30 +0100
|
|
Subject: [PATCH] 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>
|
|
(cherry picked from commit 5159cd96e8b61c9f8f96786f70cf23167980b621)
|
|
(cherry picked from commit a4b99eedf2f0f993f10c31d9bea0f1ad9fa7737e)
|
|
---
|
|
src/knownhosts.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
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,
|
|
--
|
|
2.19.1
|
|
|