Mercurial > dropbear
comparison process-packet.c @ 885:19ce21bd198a
Fix failing rekeying when we receive a still-in-flight packet
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 23 Jan 2014 21:56:35 +0800 |
parents | 220f55d540ae |
children | cbc73a5aefb0 |
comparison
equal
deleted
inserted
replaced
884:dd0bd9231fc2 | 885:19ce21bd198a |
---|---|
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] != 0) { | 77 if (ses.requirenext[0] != 0) { |
78 if (ses.requirenext[0] != type | 78 if (ses.requirenext[0] == type || ses.requirenext[1] == type) |
79 && (ses.requirenext[1] == 0 || ses.requirenext[1] != type)) { | 79 { |
80 dropbear_exit("Unexpected packet type %d, expected [%d,%d]", type, | |
81 ses.requirenext[0], ses.requirenext[1]); | |
82 } else { | |
83 /* Got what we expected */ | 80 /* Got what we expected */ |
81 TRACE(("got expeced packet %d during kexinit", type)) | |
84 ses.requirenext[0] = 0; | 82 ses.requirenext[0] = 0; |
85 ses.requirenext[1] = 0; | 83 ses.requirenext[1] = 0; |
84 } | |
85 else | |
86 { | |
87 /* RFC4253 7.1 - various messages are allowed at this point. | |
88 The only ones we know about have already been handled though, | |
89 so just return "unimplemented" */ | |
90 if (type >= 1 && type <= 49 | |
91 && type != SSH_MSG_SERVICE_REQUEST | |
92 && type != SSH_MSG_SERVICE_ACCEPT | |
93 && type != SSH_MSG_KEXINIT) | |
94 { | |
95 TRACE(("unknown allowed packet during kexinit")) | |
96 recv_unimplemented(); | |
97 goto out; | |
98 } | |
99 else | |
100 { | |
101 TRACE(("disallowed packet during kexinit")) | |
102 dropbear_exit("Unexpected packet type %d, expected [%d,%d]", type, | |
103 ses.requirenext[0], ses.requirenext[1]); | |
104 } | |
86 } | 105 } |
87 } | 106 } |
88 | 107 |
89 /* Check if we should ignore this packet. Used currently only for | 108 /* Check if we should ignore this packet. Used currently only for |
90 * KEX code, with first_kex_packet_follows */ | 109 * KEX code, with first_kex_packet_follows */ |