summaryrefslogtreecommitdiffhomepage
path: root/process-packet.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2014-01-23 21:56:35 +0800
committerMatt Johnston <matt@ucc.asn.au>2014-01-23 21:56:35 +0800
commit8128b15e4157abc382f360eaf95c0fabefe5bc61 (patch)
tree3641a48821e6eeaae375238fab58e85281668e4a /process-packet.c
parent8081b0e03399c608dcbe8ebe187e9017886a0c34 (diff)
Fix failing rekeying when we receive a still-in-flight packet
Diffstat (limited to 'process-packet.c')
-rw-r--r--process-packet.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/process-packet.c b/process-packet.c
index 0b92510..97de203 100644
--- a/process-packet.c
+++ b/process-packet.c
@@ -75,15 +75,34 @@ void process_packet() {
/* This applies for KEX, where the spec says the next packet MUST be
* NEWKEYS */
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,%d]", type,
- ses.requirenext[0], ses.requirenext[1]);
- } else {
+ if (ses.requirenext[0] == type || ses.requirenext[1] == type)
+ {
/* Got what we expected */
+ TRACE(("got expeced packet %d during kexinit", type))
ses.requirenext[0] = 0;
ses.requirenext[1] = 0;
}
+ else
+ {
+ /* RFC4253 7.1 - various messages are allowed at this point.
+ The only ones we know about have already been handled though,
+ so just return "unimplemented" */
+ if (type >= 1 && type <= 49
+ && type != SSH_MSG_SERVICE_REQUEST
+ && type != SSH_MSG_SERVICE_ACCEPT
+ && type != SSH_MSG_KEXINIT)
+ {
+ TRACE(("unknown allowed packet during kexinit"))
+ recv_unimplemented();
+ goto out;
+ }
+ else
+ {
+ TRACE(("disallowed packet during kexinit"))
+ dropbear_exit("Unexpected packet type %d, expected [%d,%d]", type,
+ ses.requirenext[0], ses.requirenext[1]);
+ }
+ }
}
/* Check if we should ignore this packet. Used currently only for