mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
More strictness in ssh_channel_msg().
Now it disconnects if the server sends SSH_MSG_CHANNEL_OPEN_CONFIRMATION or SSH_MSG_CHANNEL_OPEN_FAILURE for a channel that isn't half-open. Assertions in the SSH-2 handlers for these messages rely on this behaviour even though it's never been enforced before.
This commit is contained in:
parent
d17b9733a9
commit
08d4ca0787
6
ssh.c
6
ssh.c
@ -7986,10 +7986,12 @@ static struct ssh_channel *ssh_channel_msg(Ssh ssh, struct Packet *pktin)
|
|||||||
halfopen_ok = (pktin->type == SSH2_MSG_CHANNEL_OPEN_CONFIRMATION ||
|
halfopen_ok = (pktin->type == SSH2_MSG_CHANNEL_OPEN_CONFIRMATION ||
|
||||||
pktin->type == SSH2_MSG_CHANNEL_OPEN_FAILURE);
|
pktin->type == SSH2_MSG_CHANNEL_OPEN_FAILURE);
|
||||||
c = find234(ssh->channels, &localid, ssh_channelfind);
|
c = find234(ssh->channels, &localid, ssh_channelfind);
|
||||||
if (!c || (c->type != CHAN_SHARING && c->halfopen && !halfopen_ok)) {
|
if (!c || (c->type != CHAN_SHARING && (c->halfopen != halfopen_ok))) {
|
||||||
char *buf = dupprintf("Received %s for %s channel %u",
|
char *buf = dupprintf("Received %s for %s channel %u",
|
||||||
ssh_pkt_type(ssh, pktin->type),
|
ssh_pkt_type(ssh, pktin->type),
|
||||||
c ? "half-open" : "nonexistent", localid);
|
!c ? "nonexistent" :
|
||||||
|
c->halfopen ? "half-open" : "open",
|
||||||
|
localid);
|
||||||
ssh_disconnect(ssh, NULL, buf, SSH2_DISCONNECT_PROTOCOL_ERROR, FALSE);
|
ssh_disconnect(ssh, NULL, buf, SSH2_DISCONNECT_PROTOCOL_ERROR, FALSE);
|
||||||
sfree(buf);
|
sfree(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user