mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 09:12:24 +00:00
Be proactively pedantic about channel-close irregularities: we no
longer just sit there like a lemon if we can't find the channel in question, we bomb out and complain. With any luck, remaining problems of this type should be easier to catch under this policy. [originally from svn r1962]
This commit is contained in:
parent
9b69e1b8aa
commit
30e159d112
13
ssh.c
13
ssh.c
@ -3354,7 +3354,7 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt)
|
|||||||
unsigned i = GET_32BIT(pktin.body);
|
unsigned i = GET_32BIT(pktin.body);
|
||||||
struct ssh_channel *c;
|
struct ssh_channel *c;
|
||||||
c = find234(ssh_channels, &i, ssh_channelfind);
|
c = find234(ssh_channels, &i, ssh_channelfind);
|
||||||
if (c) {
|
if (c && ((int)c->remoteid) != -1) {
|
||||||
int closetype;
|
int closetype;
|
||||||
closetype =
|
closetype =
|
||||||
(pktin.type == SSH1_MSG_CHANNEL_CLOSE ? 1 : 2);
|
(pktin.type == SSH1_MSG_CHANNEL_CLOSE ? 1 : 2);
|
||||||
@ -3383,6 +3383,11 @@ static void ssh1_protocol(unsigned char *in, int inlen, int ispkt)
|
|||||||
del234(ssh_channels, c);
|
del234(ssh_channels, c);
|
||||||
sfree(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) {
|
} else if (pktin.type == SSH1_MSG_CHANNEL_DATA) {
|
||||||
/* Data sent down one of our channels. */
|
/* Data sent down one of our channels. */
|
||||||
@ -5359,8 +5364,10 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
|
|||||||
struct ssh_channel *c;
|
struct ssh_channel *c;
|
||||||
|
|
||||||
c = find234(ssh_channels, &i, ssh_channelfind);
|
c = find234(ssh_channels, &i, ssh_channelfind);
|
||||||
if (!c)
|
if (!c || ((int)c->remoteid) == -1) {
|
||||||
continue; /* nonexistent channel */
|
bombout(("Received CHANNEL_CLOSE for %s channel %d\n",
|
||||||
|
c ? "half-open" : "nonexistent", i));
|
||||||
|
}
|
||||||
/* Do pre-close processing on the channel. */
|
/* Do pre-close processing on the channel. */
|
||||||
switch (c->type) {
|
switch (c->type) {
|
||||||
case CHAN_MAINSESSION:
|
case CHAN_MAINSESSION:
|
||||||
|
Loading…
Reference in New Issue
Block a user