diff cli-session.c @ 745:15999b098cc9 kexguess

Don't usually need to recalculate dh_e for the repeated kexdh_init packet
author Matt Johnston <matt@ucc.asn.au>
date Wed, 03 Apr 2013 00:32:55 +0800
parents 09c5eb71ec96
children 465fefc4f6e0
line wrap: on
line diff
--- a/cli-session.c	Wed Apr 03 00:32:05 2013 +0800
+++ b/cli-session.c	Wed Apr 03 00:32:55 2013 +0800
@@ -182,6 +182,11 @@
 
 	TRACE2(("enter cli_sessionloop"))
 
+	if (ses.lastpacket == 0) {
+		TRACE2(("exit cli_sessionloop: no real packets yet"))
+		return;
+	}
+
 	if (ses.lastpacket == SSH_MSG_KEXINIT && cli_ses.kex_state == KEX_NOTHING) {
 		/* We initiate the KEXDH. If DH wasn't the correct type, the KEXINIT
 		 * negotiation would have failed. */
@@ -206,10 +211,9 @@
 		return;
 	}
 
-	/* We should exit if we haven't donefirstkex: we shouldn't reach here
-	 * in normal operation */
 	if (ses.kexstate.donefirstkex == 0) {
-		TRACE(("XXX XXX might be bad! leave cli_sessionloop: haven't donefirstkex"))
+		/* We might reach here if we have partial packet reads or have
+		 * received SSG_MSG_IGNORE etc. Just skip it */
 		return;
 	}