diff svr-kex.c @ 847:f4bb964c8678 keyondemand

Add '-R' for delayed hostkey option
author Matt Johnston <matt@ucc.asn.au>
date Thu, 07 Nov 2013 23:49:37 +0800
parents b298bb438625
children 754d7bee1068
line wrap: on
line diff
--- a/svr-kex.c	Thu Nov 07 00:18:52 2013 +0800
+++ b/svr-kex.c	Thu Nov 07 23:49:37 2013 +0800
@@ -77,6 +77,7 @@
 	TRACE(("leave recv_msg_kexdh_init"))
 }
 
+#ifdef DROPBEAR_DELAY_HOSTKEY
 static void svr_ensure_hostkey() {
 
 	const char* fn = NULL;
@@ -141,7 +142,7 @@
 
 	if (ret == DROPBEAR_FAILURE)
 	{
-		dropbear_exit("Couldn't read or generate hostkey");
+		dropbear_exit("Couldn't read or generate hostkey %s", fn);
 	}
 
 	// directory for keys.
@@ -152,6 +153,7 @@
 	// atomic rename, done.
 
 }
+#endif
 	
 /* Generate our side of the diffie-hellman key exchange value (dh_f), and
  * calculate the session key using the diffie-hellman algorithm. Following
@@ -165,8 +167,13 @@
 
 	/* we can start creating the kexdh_reply packet */
 	CHECKCLEARTOWRITE();
-	
-	svr_ensure_hostkey();
+
+#ifdef DROPBEAR_DELAY_HOSTKEY
+	if (svr_opts.delay_hostkey)
+	{
+		svr_ensure_hostkey();
+	}
+#endif
 
 	buf_putbyte(ses.writepayload, SSH_MSG_KEXDH_REPLY);
 	buf_put_pub_key(ses.writepayload, svr_opts.hostkey,