diff svr-runopts.c @ 1532:3616ec41d03d

Only load dropbear default host keys if a key is not specified
author CamVan Nguyen <ctnguyen@us.ibm.com>
date Thu, 22 Feb 2018 21:55:15 +0800
parents 2d450c1056e3
children b918ad1c5b25
line wrap: on
line diff
--- a/svr-runopts.c	Tue Feb 20 16:13:42 2018 +0100
+++ b/svr-runopts.c	Thu Feb 22 21:55:15 2018 +0800
@@ -510,17 +510,20 @@
 		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) {