comparison 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
comparison
equal deleted inserted replaced
774:e8b2ca448928 775:2f1c199b6e4b
72 dropbear_close("Disconnect received"); 72 dropbear_close("Disconnect received");
73 } 73 }
74 74
75 /* This applies for KEX, where the spec says the next packet MUST be 75 /* This applies for KEX, where the spec says the next packet MUST be
76 * NEWKEYS */ 76 * NEWKEYS */
77 if (ses.requirenext != 0) { 77 if (ses.requirenext[0] != 0) {
78 if (ses.requirenext != type) { 78 if (ses.requirenext[0] != type
79 /* TODO send disconnect? */ 79 && (ses.requirenext[1] == 0 || ses.requirenext[1] != type)) {
80 dropbear_exit("Unexpected packet type %d, expected %d", type, 80 dropbear_exit("Unexpected packet type %d, expected %d", type,
81 ses.requirenext); 81 ses.requirenext);
82 } else { 82 } else {
83 /* Got what we expected */ 83 /* Got what we expected */
84 ses.requirenext = 0; 84 ses.requirenext[0] = 0;
85 ses.requirenext[1] = 0;
85 } 86 }
86 } 87 }
87 88
88 /* Check if we should ignore this packet. Used currently only for 89 /* Check if we should ignore this packet. Used currently only for
89 * KEX code, with first_kex_packet_follows */ 90 * KEX code, with first_kex_packet_follows */