summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-11-08 16:15:55 +1100
committerDamien Miller <djm@mindrot.org>1999-11-08 16:15:55 +1100
commitfd7c911f090749774cf1869420523c4811beeeb0 (patch)
treecd57567ddb3371c0c805a8bd8ace0c66df02fa53 /channels.c
parent5ac5f1ca6b5270e1a755d75120f8217f5850c9b2 (diff)
Merged OpenBSD CVS changes that go away
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/channels.c b/channels.c
index 79a02c88b..032e8f2af 100644
--- a/channels.c
+++ b/channels.c
@@ -16,7 +16,7 @@ arbitrary tcp/ip connections, and the authentication agent connection.
16*/ 16*/
17 17
18#include "includes.h" 18#include "includes.h"
19RCSID("$Id: channels.c,v 1.3 1999/10/30 01:39:56 damien Exp $"); 19RCSID("$Id: channels.c,v 1.4 1999/11/08 05:15:55 damien Exp $");
20 20
21#include "ssh.h" 21#include "ssh.h"
22#include "packet.h" 22#include "packet.h"
@@ -166,8 +166,10 @@ int channel_allocate(int type, int sock, char *remote_name)
166 166
167void channel_free(int channel) 167void channel_free(int channel)
168{ 168{
169 assert(channel >= 0 && channel < channels_alloc && 169 if (channel < 0 || channel >= channels_alloc ||
170 channels[channel].type != SSH_CHANNEL_FREE); 170 channels[channel].type == SSH_CHANNEL_FREE)
171 packet_disconnect("channel free: bad local channel %d", channel);
172
171 if(compat13) 173 if(compat13)
172 shutdown(channels[channel].sock, SHUT_RDWR); 174 shutdown(channels[channel].sock, SHUT_RDWR);
173 close(channels[channel].sock); 175 close(channels[channel].sock);
@@ -307,9 +309,17 @@ void channel_prepare_select(fd_set *readset, fd_set *writeset)
307 goto reject; 309 goto reject;
308 } 310 }
309 311
312 /* Check fake data length */
313 if (x11_fake_data_len != x11_saved_data_len)
314 {
315 error("X11 fake_data_len %d != saved_data_len %d",
316 x11_fake_data_len, x11_saved_data_len);
317 ch->type = SSH_CHANNEL_OPEN;
318 goto reject;
319 }
320
310 /* Received authentication protocol and data match our fake data. 321 /* Received authentication protocol and data match our fake data.
311 Substitute the fake data with real data. */ 322 Substitute the fake data with real data. */
312 assert(x11_fake_data_len == x11_saved_data_len);
313 memcpy(ucp + 12 + ((proto_len + 3) & ~3), 323 memcpy(ucp + 12 + ((proto_len + 3) & ~3),
314 x11_saved_data, x11_saved_data_len); 324 x11_saved_data, x11_saved_data_len);
315 325