summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/kex.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2015-11-13 04:39:36 +0000
committerDamien Miller <djm@cvs.openbsd.org>2015-11-13 04:39:36 +0000
commit008c6055df57a5bae55e9d7048b24ef3580af019 (patch)
tree4821cfb6bc7e266e2cf81b6c327942fa20b210ec /usr.bin/ssh/kex.c
parent178d32763f0b88d3225ca1f0deca00f4fd6092ba (diff)
send SSH2_MSG_UNIMPLEMENTED replies to unexpected messages during
KEX; bz#2949, ok dtucker@
Diffstat (limited to 'usr.bin/ssh/kex.c')
-rw-r--r--usr.bin/ssh/kex.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/ssh/kex.c b/usr.bin/ssh/kex.c
index 111a3e52f48..172e2cfd450 100644
--- a/usr.bin/ssh/kex.c
+++ b/usr.bin/ssh/kex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.111 2015/10/13 00:21:27 djm Exp $ */
+/* $OpenBSD: kex.c,v 1.112 2015/11/13 04:39:35 djm Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
*
@@ -296,7 +296,14 @@ kex_prop_free(char **proposal)
static int
kex_protocol_error(int type, u_int32_t seq, void *ctxt)
{
- error("Hm, kex protocol error: type %d seq %u", type, seq);
+ struct ssh *ssh = active_state; /* XXX */
+ int r;
+
+ error("kex protocol error: type %d seq %u", type, seq);
+ if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
+ (r = sshpkt_put_u32(ssh, seq)) != 0 ||
+ (r = sshpkt_send(ssh)) != 0)
+ return r;
return 0;
}