Read (and enqueue) packets from interactive input even when

we're waiting for a key exchange.

This should hopefully fix the situation where "~." doesn't work to terminate a
client session when a laptop wakes up. The client will be stuck waiting for a
key exchange on a dead connection, so won't have read the escape character
This commit is contained in:
Matt Johnston 2014-02-17 21:41:06 +08:00
parent 0c9a643216
commit bf6f3f613d
2 changed files with 11 additions and 9 deletions

View File

@ -474,8 +474,13 @@ void setchannelfds(fd_set *readfds, fd_set *writefds) {
continue; continue;
} }
/* Stuff to put over the wire */ /* Stuff to put over the wire.
if (channel->transwindow > 0) { Avoid queueing data to send if we're in the middle of a
key re-exchange (!dataallowed), but still read from the
FD if there's the possibility of "~."" to kill an
interactive session (the read_mangler) */
if (channel->transwindow > 0
&& (ses.dataallowed || channel->read_mangler)) {
if (channel->readfd >= 0) { if (channel->readfd >= 0) {
FD_SET(channel->readfd, readfds); FD_SET(channel->readfd, readfds);

View File

@ -153,10 +153,9 @@ void session_loop(void(*loophandler)()) {
SIGCHLD in svr-chansession is the only one currently. */ SIGCHLD in svr-chansession is the only one currently. */
FD_SET(ses.signal_pipe[0], &readfd); FD_SET(ses.signal_pipe[0], &readfd);
/* set up for channels which require reading/writing */ /* set up for channels which can be read/written */
if (ses.dataallowed) { setchannelfds(&readfd, &writefd);
setchannelfds(&readfd, &writefd);
}
val = select(ses.maxfd+1, &readfd, &writefd, NULL, &timeout); val = select(ses.maxfd+1, &readfd, &writefd, NULL, &timeout);
if (exitflag) { if (exitflag) {
@ -217,9 +216,7 @@ void session_loop(void(*loophandler)()) {
/* process pipes etc for the channels, ses.dataallowed == 0 /* process pipes etc for the channels, ses.dataallowed == 0
* during rekeying ) */ * during rekeying ) */
if (ses.dataallowed) { channelio(&readfd, &writefd);
channelio(&readfd, &writefd);
}
if (loophandler) { if (loophandler) {
loophandler(); loophandler();