From 4c95d595c00818f61905a9d607e3fd675ba85458 Mon Sep 17 00:00:00 2001 From: CamVan Nguyen Date: Thu, 22 Feb 2018 21:55:15 +0800 Subject: [PATCH] Only load dropbear default host keys if a key is not specified --- svr-runopts.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/svr-runopts.c b/svr-runopts.c index 3d97023..182366f 100644 --- a/svr-runopts.c +++ b/svr-runopts.c @@ -510,17 +510,20 @@ void load_all_hostkeys() { m_free(hostkey_file); } + /* Only load default host keys if a host key is not specified by the user */ + if (svr_opts.num_hostkey_files == 0) { #if DROPBEAR_RSA - loadhostkey(RSA_PRIV_FILENAME, 0); + loadhostkey(RSA_PRIV_FILENAME, 0); #endif #if DROPBEAR_DSS - loadhostkey(DSS_PRIV_FILENAME, 0); + loadhostkey(DSS_PRIV_FILENAME, 0); #endif #if DROPBEAR_ECDSA - loadhostkey(ECDSA_PRIV_FILENAME, 0); + loadhostkey(ECDSA_PRIV_FILENAME, 0); #endif + } #if DROPBEAR_DELAY_HOSTKEY if (svr_opts.delay_hostkey) {