summaryrefslogtreecommitdiff
path: root/meta-phosphor/common/recipes-core/dropbear/dropbear/0001-Only-load-dropbear-default-host-keys-if-a-key-is-not.patch
blob: e32baec83f7686d4b626bc0997dddf1994893a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 95eff1ca0beea55259c2cdc7f1bb9f930bf57bc8 Mon Sep 17 00:00:00 2001
From: CamVan Nguyen <ctnguyen@us.ibm.com>
Date: Tue, 13 Feb 2018 15:37:47 -0600
Subject: [PATCH 1/1] Only load dropbear default host keys if a key is not
 specified

---
 svr-runopts.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/svr-runopts.c b/svr-runopts.c
index 8f60059..c5c2148 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -488,17 +488,21 @@ void load_all_hostkeys() {
 		m_free(hostkey_file);
 	}
 
+	/* Only load default host keys if a host key is not specified by the
+	 * user */
+	if (0 ==  svr_opts.num_hostkey_files) {
 #ifdef DROPBEAR_RSA
-	loadhostkey(RSA_PRIV_FILENAME, 0);
+		loadhostkey(RSA_PRIV_FILENAME, 0);
 #endif
 
 #ifdef DROPBEAR_DSS
-	loadhostkey(DSS_PRIV_FILENAME, 0);
+		loadhostkey(DSS_PRIV_FILENAME, 0);
 #endif
 
 #ifdef DROPBEAR_ECDSA
-	loadhostkey(ECDSA_PRIV_FILENAME, 0);
+		loadhostkey(ECDSA_PRIV_FILENAME, 0);
 #endif
+	}
 
 #ifdef DROPBEAR_DELAY_HOSTKEY
 	if (svr_opts.delay_hostkey) {
-- 
1.8.2.2