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 74f7e05b0..cd2ca4057 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 */
@@ -1713,15 +1715,20 @@ monitor_apply_keystate(struct monitor *pmonitor)
1713 1715
1714 /* Network I/O buffers */ 1716 /* Network I/O buffers */
1715 /* XXX inefficient for large buffers, need: buffer_init_from_string */ 1717 /* XXX inefficient for large buffers, need: buffer_init_from_string */
1716 buffer_clear(&input); 1718 buffer_clear(packet_get_input());
1717 buffer_append(&input, child_state.input, child_state.ilen); 1719 buffer_append(packet_get_input(), child_state.input, child_state.ilen);
1718 memset(child_state.input, 0, child_state.ilen); 1720 memset(child_state.input, 0, child_state.ilen);
1719 xfree(child_state.input); 1721 xfree(child_state.input);
1720 1722
1721 buffer_clear(&output); 1723 buffer_clear(packet_get_output());
1722 buffer_append(&output, child_state.output, child_state.olen); 1724 buffer_append(packet_get_output(), child_state.output,
1725 child_state.olen);
1723 memset(child_state.output, 0, child_state.olen); 1726 memset(child_state.output, 0, child_state.olen);
1724 xfree(child_state.output); 1727 xfree(child_state.output);
1728
1729 /* Roaming */
1730 if (compat20)
1731 roam_set_bytes(child_state.sent_bytes, child_state.recv_bytes);
1725} 1732}
1726 1733
1727static Kex * 1734static Kex *
@@ -1844,6 +1851,12 @@ mm_get_keystate(struct monitor *pmonitor)
1844 child_state.input = buffer_get_string(&m, &child_state.ilen); 1851 child_state.input = buffer_get_string(&m, &child_state.ilen);
1845 child_state.output = buffer_get_string(&m, &child_state.olen); 1852 child_state.output = buffer_get_string(&m, &child_state.olen);
1846 1853
1854 /* Roaming */
1855 if (compat20) {
1856 child_state.sent_bytes = buffer_get_int64(&m);
1857 child_state.recv_bytes = buffer_get_int64(&m);
1858 }
1859
1847 buffer_free(&m); 1860 buffer_free(&m);
1848} 1861}
1849 1862