Diff

Differences From Artifact [5520497782]:

To Artifact [c9374d6544]:


3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364

	    } else if (pktin.type == SSH1_MSG_CHANNEL_CLOSE ||
		       pktin.type == SSH1_MSG_CHANNEL_CLOSE_CONFIRMATION) {
		/* Remote side closes a channel. */
		unsigned i = GET_32BIT(pktin.body);
		struct ssh_channel *c;
		c = find234(ssh_channels, &i, ssh_channelfind);
		if (c) {
		    int closetype;
		    closetype =
			(pktin.type == SSH1_MSG_CHANNEL_CLOSE ? 1 : 2);

		    if ((c->closes == 0) && (c->type == CHAN_X11)) {
			logevent("Forwarded X11 connection terminated");
			assert(c->u.x11.s != NULL);







|







3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364

	    } else if (pktin.type == SSH1_MSG_CHANNEL_CLOSE ||
		       pktin.type == SSH1_MSG_CHANNEL_CLOSE_CONFIRMATION) {
		/* Remote side closes a channel. */
		unsigned i = GET_32BIT(pktin.body);
		struct ssh_channel *c;
		c = find234(ssh_channels, &i, ssh_channelfind);
		if (c && ((int)c->remoteid) != -1) {
		    int closetype;
		    closetype =
			(pktin.type == SSH1_MSG_CHANNEL_CLOSE ? 1 : 2);

		    if ((c->closes == 0) && (c->type == CHAN_X11)) {
			logevent("Forwarded X11 connection terminated");
			assert(c->u.x11.s != NULL);
3379
3380
3381
3382
3383
3384
3385





3386
3387
3388
3389
3390
3391
3392
			c->closes |= closetype;      /* sent it too */
		    }

		    if (c->closes == 15) {
			del234(ssh_channels, c);
			sfree(c);
		    }





		}
	    } else if (pktin.type == SSH1_MSG_CHANNEL_DATA) {
		/* Data sent down one of our channels. */
		int i = GET_32BIT(pktin.body);
		int len = GET_32BIT(pktin.body + 4);
		unsigned char *p = pktin.body + 8;
		struct ssh_channel *c;







>
>
>
>
>







3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
			c->closes |= closetype;      /* sent it too */
		    }

		    if (c->closes == 15) {
			del234(ssh_channels, c);
			sfree(c);
		    }
		} else {
		    bombout(("Received CHANNEL_CLOSE%s for %s channel %d\n",
			     pktin.type == SSH1_MSG_CHANNEL_CLOSE ? "" :
			     "_CONFIRMATION", c ? "half-open" : "nonexistent",
			     i));
		}
	    } else if (pktin.type == SSH1_MSG_CHANNEL_DATA) {
		/* Data sent down one of our channels. */
		int i = GET_32BIT(pktin.body);
		int len = GET_32BIT(pktin.body + 4);
		unsigned char *p = pktin.body + 8;
		struct ssh_channel *c;
5355
5356
5357
5358
5359
5360
5361
5362

5363

5364
5365
5366
5367
5368
5369
5370
		    sshfwd_close(c);
		}
	    } else if (pktin.type == SSH2_MSG_CHANNEL_CLOSE) {
		unsigned i = ssh2_pkt_getuint32();
		struct ssh_channel *c;

		c = find234(ssh_channels, &i, ssh_channelfind);
		if (!c)

		    continue;	       /* nonexistent channel */

		/* Do pre-close processing on the channel. */
		switch (c->type) {
		  case CHAN_MAINSESSION:
		    break;	       /* nothing to see here, move along */
		  case CHAN_X11:
		    if (c->u.x11.s != NULL)
			x11_close(c->u.x11.s);







|
>
|
>







5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
		    sshfwd_close(c);
		}
	    } else if (pktin.type == SSH2_MSG_CHANNEL_CLOSE) {
		unsigned i = ssh2_pkt_getuint32();
		struct ssh_channel *c;

		c = find234(ssh_channels, &i, ssh_channelfind);
		if (!c || ((int)c->remoteid) == -1) {
		    bombout(("Received CHANNEL_CLOSE for %s channel %d\n",
			     c ? "half-open" : "nonexistent", i));
		}
		/* Do pre-close processing on the channel. */
		switch (c->type) {
		  case CHAN_MAINSESSION:
		    break;	       /* nothing to see here, move along */
		  case CHAN_X11:
		    if (c->u.x11.s != NULL)
			x11_close(c->u.x11.s);