diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/clientloop.c b/clientloop.c index 74610c6b1..ad20b2f0e 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -59,7 +59,7 @@ | |||
59 | */ | 59 | */ |
60 | 60 | ||
61 | #include "includes.h" | 61 | #include "includes.h" |
62 | RCSID("$OpenBSD: clientloop.c,v 1.59 2001/04/05 20:01:10 markus Exp $"); | 62 | RCSID("$OpenBSD: clientloop.c,v 1.60 2001/04/05 21:05:23 markus Exp $"); |
63 | 63 | ||
64 | #include "ssh.h" | 64 | #include "ssh.h" |
65 | #include "ssh1.h" | 65 | #include "ssh1.h" |
@@ -128,6 +128,7 @@ static u_int buffer_high;/* Soft max buffer size. */ | |||
128 | static int connection_in; /* Connection to server (input). */ | 128 | static int connection_in; /* Connection to server (input). */ |
129 | static int connection_out; /* Connection to server (output). */ | 129 | static int connection_out; /* Connection to server (output). */ |
130 | static int need_rekeying; /* Set to non-zero if rekeying is requested. */ | 130 | static int need_rekeying; /* Set to non-zero if rekeying is requested. */ |
131 | static int session_closed = 0; /* In SSH2: login session closed. */ | ||
131 | 132 | ||
132 | void client_init_dispatch(void); | 133 | void client_init_dispatch(void); |
133 | int session_ident = -1; | 134 | int session_ident = -1; |
@@ -788,6 +789,15 @@ simple_escape_filter(Channel *c, char *buf, int len) | |||
788 | return process_escapes(&c->input, &c->output, &c->extended, buf, len); | 789 | return process_escapes(&c->input, &c->output, &c->extended, buf, len); |
789 | } | 790 | } |
790 | 791 | ||
792 | void | ||
793 | client_channel_closed(int id, void *arg) | ||
794 | { | ||
795 | if (id != session_ident) | ||
796 | error("client_channel_closed: id %d != session_ident %d", | ||
797 | id, session_ident); | ||
798 | session_closed = 1; | ||
799 | } | ||
800 | |||
791 | /* | 801 | /* |
792 | * Implements the interactive session with the server. This is called after | 802 | * Implements the interactive session with the server. This is called after |
793 | * the user has been authenticated, and a command has been started on the | 803 | * the user has been authenticated, and a command has been started on the |
@@ -851,6 +861,9 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
851 | if (escape_char != -1) | 861 | if (escape_char != -1) |
852 | channel_register_filter(session_ident, | 862 | channel_register_filter(session_ident, |
853 | simple_escape_filter); | 863 | simple_escape_filter); |
864 | if (session_ident != -1) | ||
865 | channel_register_cleanup(session_ident, | ||
866 | client_channel_closed); | ||
854 | } else { | 867 | } else { |
855 | /* Check if we should immediately send eof on stdin. */ | 868 | /* Check if we should immediately send eof on stdin. */ |
856 | client_check_initial_eof_on_stdin(); | 869 | client_check_initial_eof_on_stdin(); |
@@ -862,12 +875,10 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
862 | /* Process buffered packets sent by the server. */ | 875 | /* Process buffered packets sent by the server. */ |
863 | client_process_buffered_input_packets(); | 876 | client_process_buffered_input_packets(); |
864 | 877 | ||
865 | rekeying = (xxx_kex != NULL && !xxx_kex->done); | 878 | if (compat20 && session_closed && !channel_still_open()) |
866 | |||
867 | if (compat20 && !channel_still_open()) { | ||
868 | debug2("!channel_still_open."); | ||
869 | break; | 879 | break; |
870 | } | 880 | |
881 | rekeying = (xxx_kex != NULL && !xxx_kex->done); | ||
871 | 882 | ||
872 | if (rekeying) { | 883 | if (rekeying) { |
873 | debug("rekeying in progress"); | 884 | debug("rekeying in progress"); |