diff process-packet.c @ 775:2f1c199b6e4b

requirenext fixup for firstkexfollows
author Matt Johnston <matt@ucc.asn.au>
date Sun, 14 Apr 2013 23:16:16 +0800
parents 685d05f1cc5c
children 96b8bcb88017
line wrap: on
line diff
--- a/process-packet.c	Sun Apr 14 23:08:57 2013 +0800
+++ b/process-packet.c	Sun Apr 14 23:16:16 2013 +0800
@@ -74,14 +74,15 @@
 
 	/* This applies for KEX, where the spec says the next packet MUST be
 	 * NEWKEYS */
-	if (ses.requirenext != 0) {
-		if (ses.requirenext != type) {
-			/* TODO send disconnect? */
+	if (ses.requirenext[0] != 0) {
+		if (ses.requirenext[0] != type
+				&& (ses.requirenext[1] == 0 || ses.requirenext[1] != type)) {
 			dropbear_exit("Unexpected packet type %d, expected %d", type,
 					ses.requirenext);
 		} else {
 			/* Got what we expected */
-			ses.requirenext = 0;
+			ses.requirenext[0] = 0;
+			ses.requirenext[1] = 0;
 		}
 	}