[clientloop.c packet.c packet.h serverloop.c]
     Allow all SSH2 packet types, including UNIMPLEMENTED to reset the
     keepalive timer (bz #1307).  ok markus@
This commit is contained in:
Damien Miller 2008-03-07 18:33:30 +11:00
parent 7cb2b56b1c
commit 58226f6068
5 changed files with 18 additions and 11 deletions

View File

@ -21,6 +21,10 @@
[session.c] [session.c]
closefrom() call was too early, delay it until just before we execute closefrom() call was too early, delay it until just before we execute
the user's rc files (if any). the user's rc files (if any).
- dtucker@cvs.openbsd.org 2008/02/22 20:44:02
[clientloop.c packet.c packet.h serverloop.c]
Allow all SSH2 packet types, including UNIMPLEMENTED to reset the
keepalive timer (bz #1307). ok markus@
20080302 20080302
- (dtucker) [configure.ac] FreeBSD's glob() doesn't behave the way we expect - (dtucker) [configure.ac] FreeBSD's glob() doesn't behave the way we expect
@ -3681,4 +3685,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4855 2008/03/07 07:33:12 djm Exp $ $Id: ChangeLog,v 1.4856 2008/03/07 07:33:30 djm Exp $

View File

@ -1,4 +1,4 @@
/* $OpenBSD: clientloop.c,v 1.187 2008/01/23 01:56:54 dtucker Exp $ */ /* $OpenBSD: clientloop.c,v 1.188 2008/02/22 20:44:02 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -157,7 +157,6 @@ static int connection_in; /* Connection to server (input). */
static int connection_out; /* Connection to server (output). */ static int connection_out; /* Connection to server (output). */
static int need_rekeying; /* Set to non-zero if rekeying is requested. */ static int need_rekeying; /* Set to non-zero if rekeying is requested. */
static int session_closed = 0; /* In SSH2: login session closed. */ static int session_closed = 0; /* In SSH2: login session closed. */
static int server_alive_timeouts = 0;
static void client_init_dispatch(void); static void client_init_dispatch(void);
int session_ident = -1; int session_ident = -1;
@ -467,14 +466,14 @@ client_check_window_change(void)
static void static void
client_global_request_reply(int type, u_int32_t seq, void *ctxt) client_global_request_reply(int type, u_int32_t seq, void *ctxt)
{ {
server_alive_timeouts = 0; keep_alive_timeouts = 0;
client_global_request_reply_fwd(type, seq, ctxt); client_global_request_reply_fwd(type, seq, ctxt);
} }
static void static void
server_alive_check(void) server_alive_check(void)
{ {
if (++server_alive_timeouts > options.server_alive_count_max) { if (++keep_alive_timeouts > options.server_alive_count_max) {
logit("Timeout, server not responding."); logit("Timeout, server not responding.");
cleanup_exit(255); cleanup_exit(255);
} }

View File

@ -1,4 +1,4 @@
/* $OpenBSD: packet.c,v 1.150 2008/01/23 01:56:54 dtucker Exp $ */ /* $OpenBSD: packet.c,v 1.151 2008/02/22 20:44:02 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -136,6 +136,8 @@ static int server_side = 0;
/* Set to true if we are authenticated. */ /* Set to true if we are authenticated. */
static int after_authentication = 0; static int after_authentication = 0;
int keep_alive_timeouts = 0;
/* Session key information for Encryption and MAC */ /* Session key information for Encryption and MAC */
Newkeys *newkeys[MODE_MAX]; Newkeys *newkeys[MODE_MAX];
static struct packet_state { static struct packet_state {
@ -1192,10 +1194,12 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
for (;;) { for (;;) {
if (compat20) { if (compat20) {
type = packet_read_poll2(seqnr_p); type = packet_read_poll2(seqnr_p);
keep_alive_timeouts = 0;
if (type) if (type)
DBG(debug("received packet type %d", type)); DBG(debug("received packet type %d", type));
switch (type) { switch (type) {
case SSH2_MSG_IGNORE: case SSH2_MSG_IGNORE:
debug3("Received SSH2_MSG_IGNORE");
break; break;
case SSH2_MSG_DEBUG: case SSH2_MSG_DEBUG:
packet_get_char(); packet_get_char();

View File

@ -1,4 +1,4 @@
/* $OpenBSD: packet.h,v 1.45 2006/03/25 22:22:43 djm Exp $ */ /* $OpenBSD: packet.h,v 1.46 2008/02/22 20:44:02 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
@ -86,6 +86,7 @@ void tty_make_modes(int, struct termios *);
void tty_parse_modes(int, int *); void tty_parse_modes(int, int *);
extern u_int max_packet_size; extern u_int max_packet_size;
extern int keep_alive_timeouts;
int packet_set_maxsize(u_int); int packet_set_maxsize(u_int);
#define packet_get_maxsize() max_packet_size #define packet_get_maxsize() max_packet_size

View File

@ -1,4 +1,4 @@
/* $OpenBSD: serverloop.c,v 1.147 2008/01/23 01:56:54 dtucker Exp $ */ /* $OpenBSD: serverloop.c,v 1.148 2008/02/22 20:44:02 dtucker Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -104,7 +104,6 @@ static int connection_in; /* Connection to client (input). */
static int connection_out; /* Connection to client (output). */ static int connection_out; /* Connection to client (output). */
static int connection_closed = 0; /* Connection to client closed. */ static int connection_closed = 0; /* Connection to client closed. */
static u_int buffer_high; /* "Soft" max buffer size. */ static u_int buffer_high; /* "Soft" max buffer size. */
static int client_alive_timeouts = 0;
/* /*
* This SIGCHLD kludge is used to detect when the child exits. The server * This SIGCHLD kludge is used to detect when the child exits. The server
@ -248,7 +247,7 @@ client_alive_check(void)
int channel_id; int channel_id;
/* timeout, check to see how many we have had */ /* timeout, check to see how many we have had */
if (++client_alive_timeouts > options.client_alive_count_max) { if (++keep_alive_timeouts > options.client_alive_count_max) {
logit("Timeout, client not responding."); logit("Timeout, client not responding.");
cleanup_exit(255); cleanup_exit(255);
} }
@ -887,7 +886,7 @@ server_input_keep_alive(int type, u_int32_t seq, void *ctxt)
* even if this was generated by something other than * even if this was generated by something other than
* the bogus CHANNEL_REQUEST we send for keepalives. * the bogus CHANNEL_REQUEST we send for keepalives.
*/ */
client_alive_timeouts = 0; keep_alive_timeouts = 0;
} }
static void static void