Mercurial > dropbear
comparison 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 |
comparison
equal
deleted
inserted
replaced
909:e4b75744acab | 910:89555751c489 |
---|---|
57 #define FD_CLOSED (-1) | 57 #define FD_CLOSED (-1) |
58 | 58 |
59 #define ERRFD_IS_READ(channel) ((channel)->extrabuf == NULL) | 59 #define ERRFD_IS_READ(channel) ((channel)->extrabuf == NULL) |
60 #define ERRFD_IS_WRITE(channel) (!ERRFD_IS_READ(channel)) | 60 #define ERRFD_IS_WRITE(channel) (!ERRFD_IS_READ(channel)) |
61 | 61 |
62 /* allow space for: | |
63 * 1 byte byte SSH_MSG_CHANNEL_DATA | |
64 * 4 bytes uint32 recipient channel | |
65 * 4 bytes string data | |
66 */ | |
67 #define RECV_MAX_CHANNEL_DATA_LEN (RECV_MAX_PAYLOAD_LEN-(1+4+4)) | |
68 | |
62 /* Initialise all the channels */ | 69 /* Initialise all the channels */ |
63 void chaninitialise(const struct ChanType *chantypes[]) { | 70 void chaninitialise(const struct ChanType *chantypes[]) { |
64 | 71 |
65 /* may as well create space for a single channel */ | 72 /* may as well create space for a single channel */ |
66 ses.channels = (struct Channel**)m_malloc(sizeof(struct Channel*)); | 73 ses.channels = (struct Channel**)m_malloc(sizeof(struct Channel*)); |
163 newchan->writebuf = cbuf_new(0); /* resized later by chan_initwritebuf */ | 170 newchan->writebuf = cbuf_new(0); /* resized later by chan_initwritebuf */ |
164 newchan->recvwindow = 0; | 171 newchan->recvwindow = 0; |
165 | 172 |
166 newchan->extrabuf = NULL; /* The user code can set it up */ | 173 newchan->extrabuf = NULL; /* The user code can set it up */ |
167 newchan->recvdonelen = 0; | 174 newchan->recvdonelen = 0; |
168 newchan->recvmaxpacket = RECV_MAX_PAYLOAD_LEN; | 175 newchan->recvmaxpacket = RECV_MAX_CHANNEL_DATA_LEN; |
169 | 176 |
170 ses.channels[i] = newchan; | 177 ses.channels[i] = newchan; |
171 ses.chancount++; | 178 ses.chancount++; |
172 | 179 |
173 TRACE(("leave newchannel")) | 180 TRACE(("leave newchannel")) |
472 channel = ses.channels[i]; | 479 channel = ses.channels[i]; |
473 if (channel == NULL) { | 480 if (channel == NULL) { |
474 continue; | 481 continue; |
475 } | 482 } |
476 | 483 |
477 /* Stuff to put over the wire */ | 484 /* Stuff to put over the wire. |
478 if (channel->transwindow > 0) { | 485 Avoid queueing data to send if we're in the middle of a |
486 key re-exchange (!dataallowed), but still read from the | |
487 FD if there's the possibility of "~."" to kill an | |
488 interactive session (the read_mangler) */ | |
489 if (channel->transwindow > 0 | |
490 && (ses.dataallowed || channel->read_mangler)) { | |
479 | 491 |
480 if (channel->readfd >= 0) { | 492 if (channel->readfd >= 0) { |
481 FD_SET(channel->readfd, readfds); | 493 FD_SET(channel->readfd, readfds); |
482 } | 494 } |
483 | 495 |
1021 | 1033 |
1022 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_OPEN); | 1034 buf_putbyte(ses.writepayload, SSH_MSG_CHANNEL_OPEN); |
1023 buf_putstring(ses.writepayload, type->name, strlen(type->name)); | 1035 buf_putstring(ses.writepayload, type->name, strlen(type->name)); |
1024 buf_putint(ses.writepayload, chan->index); | 1036 buf_putint(ses.writepayload, chan->index); |
1025 buf_putint(ses.writepayload, opts.recv_window); | 1037 buf_putint(ses.writepayload, opts.recv_window); |
1026 buf_putint(ses.writepayload, RECV_MAX_PAYLOAD_LEN); | 1038 buf_putint(ses.writepayload, RECV_MAX_CHANNEL_DATA_LEN); |
1027 | 1039 |
1028 TRACE(("leave send_msg_channel_open_init()")) | 1040 TRACE(("leave send_msg_channel_open_init()")) |
1029 return DROPBEAR_SUCCESS; | 1041 return DROPBEAR_SUCCESS; |
1030 } | 1042 } |
1031 | 1043 |