diff options
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -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 |
93 | static Gssctxt *gsscontext = NULL; | 94 | static Gssctxt *gsscontext = NULL; |
@@ -100,7 +101,6 @@ extern Newkeys *current_keys[]; | |||
100 | extern z_stream incoming_stream; | 101 | extern z_stream incoming_stream; |
101 | extern z_stream outgoing_stream; | 102 | extern z_stream outgoing_stream; |
102 | extern u_char session_id[]; | 103 | extern u_char session_id[]; |
103 | extern Buffer input, output; | ||
104 | extern Buffer auth_debug; | 104 | extern Buffer auth_debug; |
105 | extern int auth_debug_init; | 105 | extern int auth_debug_init; |
106 | extern Buffer loginmsg; | 106 | extern 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 | ||
1684 | static Kex * | 1691 | static 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 | ||