summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-06-10 13:07:11 +1000
committerDamien Miller <djm@mindrot.org>2013-06-10 13:07:11 +1000
commit36187093ea0b2d2240c043417b8949611687e105 (patch)
treee399ca31e1573856ddff2f8cdfb6ea051b57ed1d
parentae133d4b31af05bb232d797419f498f3ae7e9f2d (diff)
- dtucker@cvs.openbsd.org 2013/06/07 15:37:52
[channels.c channels.h clientloop.c] Add an "ABANDONED" channel state and use for mux sessions that are disconnected via the ~. escape sequence. Channels in this state will be able to close if the server responds, but do not count as active channels. This means that if you ~. all of the mux clients when using ControlPersist on a broken network, the backgrounded mux master will exit when the Control Persist time expires rather than hanging around indefinitely. bz#1917, also reported and tested by tedu@. ok djm@ markus@.
-rw-r--r--ChangeLog12
-rw-r--r--channels.c8
-rw-r--r--channels.h5
-rw-r--r--clientloop.c5
4 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 66e07fc63..a9a8cbce1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
120130610
2 - (djm) OpenBSD CVS Sync
3 - dtucker@cvs.openbsd.org 2013/06/07 15:37:52
4 [channels.c channels.h clientloop.c]
5 Add an "ABANDONED" channel state and use for mux sessions that are
6 disconnected via the ~. escape sequence. Channels in this state will
7 be able to close if the server responds, but do not count as active channels.
8 This means that if you ~. all of the mux clients when using ControlPersist
9 on a broken network, the backgrounded mux master will exit when the
10 Control Persist time expires rather than hanging around indefinitely.
11 bz#1917, also reported and tested by tedu@. ok djm@ markus@.
12
120130605 1320130605
2 - (dtucker) [myproposal.h] Enable sha256 kex methods based on the presence of 14 - (dtucker) [myproposal.h] Enable sha256 kex methods based on the presence of
3 the necessary functions, not from the openssl version. 15 the necessary functions, not from the openssl version.
diff --git a/channels.c b/channels.c
index d50a4a298..b48e6aebb 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.322 2013/06/01 13:15:51 dtucker Exp $ */ 1/* $OpenBSD: channels.c,v 1.323 2013/06/07 15:37:52 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -213,6 +213,7 @@ channel_lookup(int id)
213 case SSH_CHANNEL_OPEN: 213 case SSH_CHANNEL_OPEN:
214 case SSH_CHANNEL_INPUT_DRAINING: 214 case SSH_CHANNEL_INPUT_DRAINING:
215 case SSH_CHANNEL_OUTPUT_DRAINING: 215 case SSH_CHANNEL_OUTPUT_DRAINING:
216 case SSH_CHANNEL_ABANDONED:
216 return (c); 217 return (c);
217 } 218 }
218 logit("Non-public channel %d, type %d.", id, c->type); 219 logit("Non-public channel %d, type %d.", id, c->type);
@@ -530,6 +531,7 @@ channel_still_open(void)
530 case SSH_CHANNEL_DYNAMIC: 531 case SSH_CHANNEL_DYNAMIC:
531 case SSH_CHANNEL_CONNECTING: 532 case SSH_CHANNEL_CONNECTING:
532 case SSH_CHANNEL_ZOMBIE: 533 case SSH_CHANNEL_ZOMBIE:
534 case SSH_CHANNEL_ABANDONED:
533 continue; 535 continue;
534 case SSH_CHANNEL_LARVAL: 536 case SSH_CHANNEL_LARVAL:
535 if (!compat20) 537 if (!compat20)
@@ -575,6 +577,7 @@ channel_find_open(void)
575 case SSH_CHANNEL_OPENING: 577 case SSH_CHANNEL_OPENING:
576 case SSH_CHANNEL_CONNECTING: 578 case SSH_CHANNEL_CONNECTING:
577 case SSH_CHANNEL_ZOMBIE: 579 case SSH_CHANNEL_ZOMBIE:
580 case SSH_CHANNEL_ABANDONED:
578 continue; 581 continue;
579 case SSH_CHANNEL_LARVAL: 582 case SSH_CHANNEL_LARVAL:
580 case SSH_CHANNEL_AUTH_SOCKET: 583 case SSH_CHANNEL_AUTH_SOCKET:
@@ -622,6 +625,7 @@ channel_open_message(void)
622 case SSH_CHANNEL_CLOSED: 625 case SSH_CHANNEL_CLOSED:
623 case SSH_CHANNEL_AUTH_SOCKET: 626 case SSH_CHANNEL_AUTH_SOCKET:
624 case SSH_CHANNEL_ZOMBIE: 627 case SSH_CHANNEL_ZOMBIE:
628 case SSH_CHANNEL_ABANDONED:
625 case SSH_CHANNEL_MUX_CLIENT: 629 case SSH_CHANNEL_MUX_CLIENT:
626 case SSH_CHANNEL_MUX_LISTENER: 630 case SSH_CHANNEL_MUX_LISTENER:
627 continue; 631 continue;
@@ -2491,7 +2495,7 @@ channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt)
2491 if (c == NULL) 2495 if (c == NULL)
2492 packet_disconnect("Received close confirmation for " 2496 packet_disconnect("Received close confirmation for "
2493 "out-of-range channel %d.", id); 2497 "out-of-range channel %d.", id);
2494 if (c->type != SSH_CHANNEL_CLOSED) 2498 if (c->type != SSH_CHANNEL_CLOSED && c->type != SSH_CHANNEL_ABANDONED)
2495 packet_disconnect("Received close confirmation for " 2499 packet_disconnect("Received close confirmation for "
2496 "non-closed channel %d (type %d).", id, c->type); 2500 "non-closed channel %d (type %d).", id, c->type);
2497 channel_free(c); 2501 channel_free(c);
diff --git a/channels.h b/channels.h
index a11b6227b..ffd580727 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.112 2013/06/02 21:01:51 dtucker Exp $ */ 1/* $OpenBSD: channels.h,v 1.113 2013/06/07 15:37:52 dtucker Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -55,7 +55,8 @@
55#define SSH_CHANNEL_ZOMBIE 14 /* Almost dead. */ 55#define SSH_CHANNEL_ZOMBIE 14 /* Almost dead. */
56#define SSH_CHANNEL_MUX_LISTENER 15 /* Listener for mux conn. */ 56#define SSH_CHANNEL_MUX_LISTENER 15 /* Listener for mux conn. */
57#define SSH_CHANNEL_MUX_CLIENT 16 /* Conn. to mux slave */ 57#define SSH_CHANNEL_MUX_CLIENT 16 /* Conn. to mux slave */
58#define SSH_CHANNEL_MAX_TYPE 17 58#define SSH_CHANNEL_ABANDONED 17 /* Abandoned session, eg mux */
59#define SSH_CHANNEL_MAX_TYPE 18
59 60
60#define CHANNEL_CANCEL_PORT_STATIC -1 61#define CHANNEL_CANCEL_PORT_STATIC -1
61 62
diff --git a/clientloop.c b/clientloop.c
index 6a2963583..7c1f8abba 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.252 2013/06/02 23:36:29 dtucker Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.253 2013/06/07 15:37:52 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1111,6 +1111,9 @@ process_escapes(Channel *c, Buffer *bin, Buffer *bout, Buffer *berr,
1111 chan_write_failed(c); 1111 chan_write_failed(c);
1112 if (c->detach_user) 1112 if (c->detach_user)
1113 c->detach_user(c->self, NULL); 1113 c->detach_user(c->self, NULL);
1114 c->type = SSH_CHANNEL_ABANDONED;
1115 buffer_clear(&c->input);
1116 chan_ibuf_empty(c);
1114 return 0; 1117 return 0;
1115 } else 1118 } else
1116 quit_pending = 1; 1119 quit_pending = 1;