summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-01-24 21:39:36 +0000
committerColin Watson <cjwatson@debian.org>2010-01-24 21:39:36 +0000
commit964476f91b66c475d5b8fa1e8b28d39a97a1b56e (patch)
treed12ff16d94cffc5d84dba0193eaaa616967c9c2c /monitor.c
parentcadac134eda6ed97478afdc528a68dd33f31dbc5 (diff)
parent1e4cfeee6c17b02af09418c5afe4a4d71aaaf0c8 (diff)
import openssh-5.3p1-gsskex-all-20100124.patch
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 6a82936d4..fd287d8c0 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 */
@@ -1687,15 +1689,20 @@ monitor_apply_keystate(struct monitor *pmonitor)
1687 1689
1688 /* Network I/O buffers */ 1690 /* Network I/O buffers */
1689 /* XXX inefficient for large buffers, need: buffer_init_from_string */ 1691 /* XXX inefficient for large buffers, need: buffer_init_from_string */
1690 buffer_clear(&input); 1692 buffer_clear(packet_get_input());
1691 buffer_append(&input, child_state.input, child_state.ilen); 1693 buffer_append(packet_get_input(), child_state.input, child_state.ilen);
1692 memset(child_state.input, 0, child_state.ilen); 1694 memset(child_state.input, 0, child_state.ilen);
1693 xfree(child_state.input); 1695 xfree(child_state.input);
1694 1696
1695 buffer_clear(&output); 1697 buffer_clear(packet_get_output());
1696 buffer_append(&output, child_state.output, child_state.olen); 1698 buffer_append(packet_get_output(), child_state.output,
1699 child_state.olen);
1697 memset(child_state.output, 0, child_state.olen); 1700 memset(child_state.output, 0, child_state.olen);
1698 xfree(child_state.output); 1701 xfree(child_state.output);
1702
1703 /* Roaming */
1704 if (compat20)
1705 roam_set_bytes(child_state.sent_bytes, child_state.recv_bytes);
1699} 1706}
1700 1707
1701static Kex * 1708static Kex *
@@ -1818,6 +1825,12 @@ mm_get_keystate(struct monitor *pmonitor)
1818 child_state.input = buffer_get_string(&m, &child_state.ilen); 1825 child_state.input = buffer_get_string(&m, &child_state.ilen);
1819 child_state.output = buffer_get_string(&m, &child_state.olen); 1826 child_state.output = buffer_get_string(&m, &child_state.olen);
1820 1827
1828 /* Roaming */
1829 if (compat20) {
1830 child_state.sent_bytes = buffer_get_int64(&m);
1831 child_state.recv_bytes = buffer_get_int64(&m);
1832 }
1833
1821 buffer_free(&m); 1834 buffer_free(&m);
1822} 1835}
1823 1836