summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/monitor.c b/monitor.c
index f57e74ba5..ace25c404 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: monitor.c,v 1.101 2009/02/12 03:26:22 djm Exp $ */ 1/* $OpenBSD: monitor.c,v 1.104 2009/06/12 20:43:22 andreas Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -88,6 +88,7 @@
88#include "compat.h" 88#include "compat.h"
89#include "ssh2.h" 89#include "ssh2.h"
90#include "jpake.h" 90#include "jpake.h"
91#include "roaming.h"
91 92
92#ifdef GSSAPI 93#ifdef GSSAPI
93static Gssctxt *gsscontext = NULL; 94static Gssctxt *gsscontext = NULL;
@@ -100,7 +101,6 @@ extern Newkeys *current_keys[];
100extern z_stream incoming_stream; 101extern z_stream incoming_stream;
101extern z_stream outgoing_stream; 102extern z_stream outgoing_stream;
102extern u_char session_id[]; 103extern u_char session_id[];
103extern Buffer input, output;
104extern Buffer auth_debug; 104extern Buffer auth_debug;
105extern int auth_debug_init; 105extern int auth_debug_init;
106extern Buffer loginmsg; 106extern Buffer loginmsg;
@@ -126,6 +126,8 @@ struct {
126 u_int ilen; 126 u_int ilen;
127 u_char *output; 127 u_char *output;
128 u_int olen; 128 u_int olen;
129 u_int64_t sent_bytes;
130 u_int64_t recv_bytes;
129} child_state; 131} child_state;
130 132
131/* Functions on the monitor that answer unprivileged requests */ 133/* Functions on the monitor that answer unprivileged requests */
@@ -1670,15 +1672,20 @@ monitor_apply_keystate(struct monitor *pmonitor)
1670 1672
1671 /* Network I/O buffers */ 1673 /* Network I/O buffers */
1672 /* XXX inefficient for large buffers, need: buffer_init_from_string */ 1674 /* XXX inefficient for large buffers, need: buffer_init_from_string */
1673 buffer_clear(&input); 1675 buffer_clear(packet_get_input());
1674 buffer_append(&input, child_state.input, child_state.ilen); 1676 buffer_append(packet_get_input(), child_state.input, child_state.ilen);
1675 memset(child_state.input, 0, child_state.ilen); 1677 memset(child_state.input, 0, child_state.ilen);
1676 xfree(child_state.input); 1678 xfree(child_state.input);
1677 1679
1678 buffer_clear(&output); 1680 buffer_clear(packet_get_output());
1679 buffer_append(&output, child_state.output, child_state.olen); 1681 buffer_append(packet_get_output(), child_state.output,
1682 child_state.olen);
1680 memset(child_state.output, 0, child_state.olen); 1683 memset(child_state.output, 0, child_state.olen);
1681 xfree(child_state.output); 1684 xfree(child_state.output);
1685
1686 /* Roaming */
1687 if (compat20)
1688 roam_set_bytes(child_state.sent_bytes, child_state.recv_bytes);
1682} 1689}
1683 1690
1684static Kex * 1691static Kex *
@@ -1794,6 +1801,12 @@ mm_get_keystate(struct monitor *pmonitor)
1794 child_state.input = buffer_get_string(&m, &child_state.ilen); 1801 child_state.input = buffer_get_string(&m, &child_state.ilen);
1795 child_state.output = buffer_get_string(&m, &child_state.olen); 1802 child_state.output = buffer_get_string(&m, &child_state.olen);
1796 1803
1804 /* Roaming */
1805 if (compat20) {
1806 child_state.sent_bytes = buffer_get_int64(&m);
1807 child_state.recv_bytes = buffer_get_int64(&m);
1808 }
1809
1797 buffer_free(&m); 1810 buffer_free(&m);
1798} 1811}
1799 1812