diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | serverloop.c | 51 |
2 files changed, 28 insertions, 28 deletions
@@ -6,6 +6,9 @@ | |||
6 | - markus@cvs.openbsd.org 2001/10/04 15:05:40 | 6 | - markus@cvs.openbsd.org 2001/10/04 15:05:40 |
7 | [channels.c serverloop.c] | 7 | [channels.c serverloop.c] |
8 | comment out bogus conditions for selecting on connection_in | 8 | comment out bogus conditions for selecting on connection_in |
9 | - markus@cvs.openbsd.org 2001/10/04 15:12:37 | ||
10 | [serverloop.c] | ||
11 | client_alive_check cleanup | ||
9 | 12 | ||
10 | 20011007 | 13 | 20011007 |
11 | - (bal) ssh-copy-id corrected permissions for .ssh/ and authorized_keys. | 14 | - (bal) ssh-copy-id corrected permissions for .ssh/ and authorized_keys. |
@@ -6651,4 +6654,4 @@ | |||
6651 | - Wrote replacements for strlcpy and mkdtemp | 6654 | - Wrote replacements for strlcpy and mkdtemp |
6652 | - Released 1.0pre1 | 6655 | - Released 1.0pre1 |
6653 | 6656 | ||
6654 | $Id: ChangeLog,v 1.1586 2001/10/10 05:01:16 djm Exp $ | 6657 | $Id: ChangeLog,v 1.1587 2001/10/10 05:01:40 djm Exp $ |
diff --git a/serverloop.c b/serverloop.c index 049ea4e46..4577cc804 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.78 2001/10/04 15:05:40 markus Exp $"); | 38 | RCSID("$OpenBSD: serverloop.c,v 1.79 2001/10/04 15:12:37 markus Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "packet.h" | 41 | #include "packet.h" |
@@ -80,6 +80,7 @@ static int connection_in; /* Connection to client (input). */ | |||
80 | static int connection_out; /* Connection to client (output). */ | 80 | static int connection_out; /* Connection to client (output). */ |
81 | static int connection_closed = 0; /* Connection to client closed. */ | 81 | static int connection_closed = 0; /* Connection to client closed. */ |
82 | static u_int buffer_high; /* "Soft" max buffer size. */ | 82 | static u_int buffer_high; /* "Soft" max buffer size. */ |
83 | static int client_alive_timeouts = 0; | ||
83 | 84 | ||
84 | /* | 85 | /* |
85 | * This SIGCHLD kludge is used to detect when the child exits. The server | 86 | * This SIGCHLD kludge is used to detect when the child exits. The server |
@@ -91,8 +92,6 @@ static volatile int child_terminated; /* The child has terminated. */ | |||
91 | /* prototypes */ | 92 | /* prototypes */ |
92 | static void server_init_dispatch(void); | 93 | static void server_init_dispatch(void); |
93 | 94 | ||
94 | int client_alive_timeouts = 0; | ||
95 | |||
96 | static void | 95 | static void |
97 | sigchld_handler(int sig) | 96 | sigchld_handler(int sig) |
98 | { | 97 | { |
@@ -161,6 +160,26 @@ make_packets_from_stdout_data(void) | |||
161 | } | 160 | } |
162 | } | 161 | } |
163 | 162 | ||
163 | static void | ||
164 | client_alive_check(void) | ||
165 | { | ||
166 | int id; | ||
167 | |||
168 | /* timeout, check to see how many we have had */ | ||
169 | if (++client_alive_timeouts > options.client_alive_count_max) | ||
170 | packet_disconnect("Timeout, your session not responding."); | ||
171 | |||
172 | id = channel_find_open(); | ||
173 | if (id == -1) | ||
174 | packet_disconnect("No open channels after timeout!"); | ||
175 | /* | ||
176 | * send a bogus channel request with "wantreply", | ||
177 | * we should get back a failure | ||
178 | */ | ||
179 | channel_request_start(id, "keepalive@openssh.com", 1); | ||
180 | packet_send(); | ||
181 | } | ||
182 | |||
164 | /* | 183 | /* |
165 | * Sleep in select() until we can do something. This will initialize the | 184 | * Sleep in select() until we can do something. This will initialize the |
166 | * select masks. Upon return, the masks will indicate which descriptors | 185 | * select masks. Upon return, the masks will indicate which descriptors |
@@ -261,30 +280,8 @@ retry_select: | |||
261 | else | 280 | else |
262 | goto retry_select; | 281 | goto retry_select; |
263 | } | 282 | } |
264 | if (ret == 0 && client_alive_scheduled) { | 283 | if (ret == 0 && client_alive_scheduled) |
265 | /* timeout, check to see how many we have had */ | 284 | client_alive_check(); |
266 | client_alive_timeouts++; | ||
267 | |||
268 | if (client_alive_timeouts > options.client_alive_count_max ) { | ||
269 | packet_disconnect( | ||
270 | "Timeout, your session not responding."); | ||
271 | } else { | ||
272 | /* | ||
273 | * send a bogus channel request with "wantreply" | ||
274 | * we should get back a failure | ||
275 | */ | ||
276 | int id; | ||
277 | |||
278 | id = channel_find_open(); | ||
279 | if (id != -1) { | ||
280 | channel_request_start(id, | ||
281 | "keepalive@openssh.com", 1); | ||
282 | packet_send(); | ||
283 | } else | ||
284 | packet_disconnect( | ||
285 | "No open channels after timeout!"); | ||
286 | } | ||
287 | } | ||
288 | } | 285 | } |
289 | 286 | ||
290 | /* | 287 | /* |