Mercurial > dropbear
diff common-channel.c @ 910:89555751c489 asm
merge up to 2013.63, improve ASM makefile rules a bit
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 27 Feb 2014 21:35:58 +0800 |
parents | 4696755c4cac |
children | d93a6bcf616f |
line wrap: on
line diff
--- a/common-channel.c Sun Oct 06 22:32:03 2013 +0800 +++ b/common-channel.c Thu Feb 27 21:35:58 2014 +0800 @@ -59,6 +59,13 @@ #define ERRFD_IS_READ(channel) ((channel)->extrabuf == NULL) #define ERRFD_IS_WRITE(channel) (!ERRFD_IS_READ(channel)) +/* allow space for: + * 1 byte byte SSH_MSG_CHANNEL_DATA + * 4 bytes uint32 recipient channel + * 4 bytes string data + */ +#define RECV_MAX_CHANNEL_DATA_LEN (RECV_MAX_PAYLOAD_LEN-(1+4+4)) + /* Initialise all the channels */ void chaninitialise(const struct ChanType *chantypes[]) { @@ -165,7 +172,7 @@ newchan->extrabuf = NULL; /* The user code can set it up */ newchan->recvdonelen = 0; - newchan->recvmaxpacket = RECV_MAX_PAYLOAD_LEN; + newchan->recvmaxpacket = RECV_MAX_CHANNEL_DATA_LEN; ses.channels[i] = newchan; ses.chancount++; @@ -474,8 +481,13 @@ continue; } - /* Stuff to put over the wire */ - if (channel->transwindow > 0) { + /* Stuff to put over the wire. + 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) { FD_SET(channel->readfd, readfds); @@ -1023,7 +1035,7 @@ buf_putstring(ses.writepayload, type->name, strlen(type->name)); buf_putint(ses.writepayload, chan->index); buf_putint(ses.writepayload, opts.recv_window); - buf_putint(ses.writepayload, RECV_MAX_PAYLOAD_LEN); + buf_putint(ses.writepayload, RECV_MAX_CHANNEL_DATA_LEN); TRACE(("leave send_msg_channel_open_init()")) return DROPBEAR_SUCCESS;