[canohost.h canohost.c]
     Add clear_cached_addr(), needed for upcoming changes allowing the peer
     address to change.
     ok markus@
This commit is contained in:
Darren Tucker 2009-06-21 18:12:20 +10:00
parent 51dbe503bf
commit f7288d77e4
8 changed files with 540 additions and 423 deletions

View File

@ -51,6 +51,17 @@
[sshd_config.5]
clarify we cd to user's home after chroot; ok markus@ on
earlier version; tweaks and ok jmc@
- andreas@cvs.openbsd.org 2009/05/25 06:48:01
[channels.c packet.c clientloop.c packet.h serverloop.c monitor_wrap.c
monitor.c]
Put the globals in packet.c into a struct and don't access it directly
from other files. No functional changes.
ok markus@ djm@
- andreas@cvs.openbsd.org 2009/05/27 06:31:25
[canohost.h canohost.c]
Add clear_cached_addr(), needed for upcoming changes allowing the peer
address to change.
ok markus@
20090616
- (dtucker) [configure.ac defines.h] Bug #1607: handle the case where fsid_t

View File

@ -1,4 +1,4 @@
/* $OpenBSD: channels.c,v 1.295 2009/02/12 03:00:56 djm Exp $ */
/* $OpenBSD: channels.c,v 1.296 2009/05/25 06:48:00 andreas Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -2431,7 +2431,7 @@ channel_input_status_confirm(int type, u_int32_t seq, void *ctxt)
int id;
/* Reset keepalive timeout */
keep_alive_timeouts = 0;
packet_set_alive_timeouts(0);
id = packet_get_int();
packet_check_eom();

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clientloop.c,v 1.209 2009/02/12 03:00:56 djm Exp $ */
/* $OpenBSD: clientloop.c,v 1.210 2009/05/25 06:48:01 andreas Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -491,13 +491,13 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt)
xfree(gc);
}
keep_alive_timeouts = 0;
packet_set_alive_timeouts(0);
}
static void
server_alive_check(void)
{
if (++keep_alive_timeouts > options.server_alive_count_max) {
if (packet_inc_alive_timeouts() > options.server_alive_count_max) {
logit("Timeout, server not responding.");
cleanup_exit(255);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: monitor.c,v 1.101 2009/02/12 03:26:22 djm Exp $ */
/* $OpenBSD: monitor.c,v 1.102 2009/05/25 06:48:01 andreas Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@ -100,7 +100,6 @@ extern Newkeys *current_keys[];
extern z_stream incoming_stream;
extern z_stream outgoing_stream;
extern u_char session_id[];
extern Buffer input, output;
extern Buffer auth_debug;
extern int auth_debug_init;
extern Buffer loginmsg;
@ -1670,13 +1669,14 @@ monitor_apply_keystate(struct monitor *pmonitor)
/* Network I/O buffers */
/* XXX inefficient for large buffers, need: buffer_init_from_string */
buffer_clear(&input);
buffer_append(&input, child_state.input, child_state.ilen);
buffer_clear(packet_get_input());
buffer_append(packet_get_input(), child_state.input, child_state.ilen);
memset(child_state.input, 0, child_state.ilen);
xfree(child_state.input);
buffer_clear(&output);
buffer_append(&output, child_state.output, child_state.olen);
buffer_clear(packet_get_output());
buffer_append(packet_get_output(), child_state.output,
child_state.olen);
memset(child_state.output, 0, child_state.olen);
xfree(child_state.output);
}

View File

@ -1,4 +1,4 @@
/* $OpenBSD: monitor_wrap.c,v 1.65 2009/03/05 07:18:19 djm Exp $ */
/* $OpenBSD: monitor_wrap.c,v 1.66 2009/05/25 06:48:01 andreas Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@ -80,11 +80,9 @@
/* Imports */
extern int compat20;
extern Newkeys *newkeys[];
extern z_stream incoming_stream;
extern z_stream outgoing_stream;
extern struct monitor *pmonitor;
extern Buffer input, output;
extern Buffer loginmsg;
extern ServerOptions options;
@ -509,7 +507,7 @@ mm_newkeys_to_blob(int mode, u_char **blobp, u_int *lenp)
Enc *enc;
Mac *mac;
Comp *comp;
Newkeys *newkey = newkeys[mode];
Newkeys *newkey = (Newkeys *)packet_get_newkeys(mode);
debug3("%s: converting %p", __func__, newkey);
@ -571,7 +569,7 @@ mm_send_kex(Buffer *m, Kex *kex)
void
mm_send_keystate(struct monitor *monitor)
{
Buffer m;
Buffer m, *input, *output;
u_char *blob, *p;
u_int bloblen, plen;
u_int32_t seqnr, packets;
@ -609,7 +607,8 @@ mm_send_keystate(struct monitor *monitor)
}
debug3("%s: Sending new keys: %p %p",
__func__, newkeys[MODE_OUT], newkeys[MODE_IN]);
__func__, packet_get_newkeys(MODE_OUT),
packet_get_newkeys(MODE_IN));
/* Keys from Kex */
if (!mm_newkeys_to_blob(MODE_OUT, &blob, &bloblen))
@ -656,8 +655,10 @@ mm_send_keystate(struct monitor *monitor)
buffer_put_string(&m, &incoming_stream, sizeof(incoming_stream));
/* Network I/O buffers */
buffer_put_string(&m, buffer_ptr(&input), buffer_len(&input));
buffer_put_string(&m, buffer_ptr(&output), buffer_len(&output));
input = (Buffer *)packet_get_input();
output = (Buffer *)packet_get_output();
buffer_put_string(&m, buffer_ptr(input), buffer_len(input));
buffer_put_string(&m, buffer_ptr(output), buffer_len(output));
mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, &m);
debug3("%s: Finished sending state", __func__);

895
packet.c

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $OpenBSD: packet.h,v 1.49 2008/07/10 18:08:11 markus Exp $ */
/* $OpenBSD: packet.h,v 1.50 2009/05/25 06:48:01 andreas Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -72,6 +72,7 @@ void packet_get_state(int, u_int32_t *, u_int64_t *, u_int32_t *, u_int64_t *);
void packet_set_state(int, u_int32_t, u_int64_t, u_int32_t, u_int64_t);
int packet_get_ssh1_cipher(void);
void packet_set_iv(int, u_char *);
void *packet_get_newkeys(int);
void packet_write_poll(void);
void packet_write_wait(void);
@ -87,10 +88,10 @@ void packet_add_padding(u_char);
void tty_make_modes(int, struct termios *);
void tty_parse_modes(int, int *);
extern u_int max_packet_size;
extern int keep_alive_timeouts;
void packet_set_alive_timeouts(int);
int packet_inc_alive_timeouts(void);
int packet_set_maxsize(u_int);
#define packet_get_maxsize() max_packet_size
u_int packet_get_maxsize(void);
/* don't allow remaining bytes after the end of the message */
#define packet_check_eom() \
@ -106,4 +107,7 @@ do { \
int packet_need_rekeying(void);
void packet_set_rekey_limit(u_int32_t);
void *packet_get_input(void);
void *packet_get_output(void);
#endif /* PACKET_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: serverloop.c,v 1.157 2009/02/12 03:16:01 djm Exp $ */
/* $OpenBSD: serverloop.c,v 1.158 2009/05/25 06:48:01 andreas Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -249,7 +249,7 @@ client_alive_check(void)
int channel_id;
/* timeout, check to see how many we have had */
if (++keep_alive_timeouts > options.client_alive_count_max) {
if (packet_inc_alive_timeouts() > options.client_alive_count_max) {
logit("Timeout, client not responding.");
cleanup_exit(255);
}
@ -890,7 +890,7 @@ server_input_keep_alive(int type, u_int32_t seq, void *ctxt)
* even if this was generated by something other than
* the bogus CHANNEL_REQUEST we send for keepalives.
*/
keep_alive_timeouts = 0;
packet_set_alive_timeouts(0);
}
static void