diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2014-05-03 17:20:35 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2014-05-03 17:20:35 +0000 |
commit | cab3721a38d3e34943de9ed036d1ef5b9cdd8c1a (patch) | |
tree | 8ce8842b14f7be8008de63280d8b244f57bba797 | |
parent | c710f7f7c61e03427ecc9d726b843007c4820082 (diff) |
unbreak compression, by re-init-ing the compression code in the
post-auth child. the new buffer code is more strict, and requires
buffer_init() while the old code was happy after a bzero();
originally from djm@
-rw-r--r-- | usr.bin/ssh/monitor.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/packet.c | 22 | ||||
-rw-r--r-- | usr.bin/ssh/packet.h | 3 |
3 files changed, 26 insertions, 3 deletions
diff --git a/usr.bin/ssh/monitor.c b/usr.bin/ssh/monitor.c index 5fe12a6c0bd..8fda7d241c4 100644 --- a/usr.bin/ssh/monitor.c +++ b/usr.bin/ssh/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.132 2014/04/29 18:01:49 markus Exp $ */ +/* $OpenBSD: monitor.c,v 1.133 2014/05/03 17:20:34 markus Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * Copyright 2002 Markus Friedl <markus@openbsd.org> @@ -1480,6 +1480,8 @@ monitor_apply_keystate(struct monitor *pmonitor) if (options.compression) mm_init_compression(pmonitor->m_zlib); + packet_set_postauth(); + if (options.rekey_limit || options.rekey_interval) packet_set_rekey_limits((u_int32_t)options.rekey_limit, (time_t)options.rekey_interval); diff --git a/usr.bin/ssh/packet.c b/usr.bin/ssh/packet.c index fe2af2d5c21..052531f8977 100644 --- a/usr.bin/ssh/packet.c +++ b/usr.bin/ssh/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.195 2014/04/29 18:01:49 markus Exp $ */ +/* $OpenBSD: packet.c,v 1.196 2014/05/03 17:20:34 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -2037,3 +2037,23 @@ packet_restore_state(void) add_recv_bytes(len); } } + +/* Reset after_authentication and reset compression in post-auth privsep */ +void +packet_set_postauth(void) +{ + Comp *comp; + int mode; + + debug("%s: called", __func__); + /* This was set in net child, but is not visible in user child */ + active_state->after_authentication = 1; + active_state->rekeying = 0; + for (mode = 0; mode < MODE_MAX; mode++) { + if (active_state->newkeys[mode] == NULL) + continue; + comp = &active_state->newkeys[mode]->comp; + if (comp && comp->enabled) + packet_init_compression(); + } +} diff --git a/usr.bin/ssh/packet.h b/usr.bin/ssh/packet.h index 5beb1677c8e..f295f0d7c66 100644 --- a/usr.bin/ssh/packet.h +++ b/usr.bin/ssh/packet.h @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.h,v 1.60 2014/04/28 03:09:18 djm Exp $ */ +/* $OpenBSD: packet.h,v 1.61 2014/05/03 17:20:34 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> @@ -114,6 +114,7 @@ time_t packet_get_rekey_timeout(void); void packet_backup_state(void); void packet_restore_state(void); +void packet_set_postauth(void); void *packet_get_input(void); void *packet_get_output(void); |