mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-26 09:42:25 +00:00
Simplify handling of responses to channel requests.
The various setup routines can only receive CHANNEL_SUCCESS or CHANNEL_FAILURE, so there's no need for the to worry about receiving anything else. Strange packets will end up in do_ssh2_authconn instead. [originally from svn r9619]
This commit is contained in:
parent
1c4eac5fa3
commit
ab6d966f91
49
ssh.c
49
ssh.c
@ -7490,18 +7490,11 @@ static void ssh2_maybe_setup_x11(struct ssh_channel *c, struct Packet *pktin,
|
|||||||
|
|
||||||
crWaitUntilV(pktin);
|
crWaitUntilV(pktin);
|
||||||
|
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_SUCCESS) {
|
if (pktin->type == SSH2_MSG_CHANNEL_SUCCESS) {
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_FAILURE) {
|
|
||||||
bombout(("Unexpected response to X11 forwarding request:"
|
|
||||||
" packet type %d", pktin->type));
|
|
||||||
sfree(s);
|
|
||||||
crStopV;
|
|
||||||
}
|
|
||||||
logevent("X11 forwarding refused");
|
|
||||||
} else {
|
|
||||||
logevent("X11 forwarding enabled");
|
logevent("X11 forwarding enabled");
|
||||||
ssh->X11_fwd_enabled = TRUE;
|
ssh->X11_fwd_enabled = TRUE;
|
||||||
}
|
} else
|
||||||
|
logevent("X11 forwarding refused");
|
||||||
}
|
}
|
||||||
sfree(s);
|
sfree(s);
|
||||||
crFinishV;
|
crFinishV;
|
||||||
@ -7531,17 +7524,11 @@ static void ssh2_maybe_setup_agent(struct ssh_channel *c, struct Packet *pktin,
|
|||||||
|
|
||||||
crWaitUntilV(pktin);
|
crWaitUntilV(pktin);
|
||||||
|
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_SUCCESS) {
|
if (pktin->type == SSH2_MSG_CHANNEL_SUCCESS) {
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_FAILURE) {
|
|
||||||
bombout(("Unexpected response to agent forwarding request:"
|
|
||||||
" packet type %d", pktin->type));
|
|
||||||
crStopV;
|
|
||||||
}
|
|
||||||
logevent("Agent forwarding refused");
|
|
||||||
} else {
|
|
||||||
logevent("Agent forwarding enabled");
|
logevent("Agent forwarding enabled");
|
||||||
ssh->agentfwd_enabled = TRUE;
|
ssh->agentfwd_enabled = TRUE;
|
||||||
}
|
} else
|
||||||
|
logevent("Agent forwarding refused");
|
||||||
}
|
}
|
||||||
sfree(s);
|
sfree(s);
|
||||||
crFinishV;
|
crFinishV;
|
||||||
@ -7588,18 +7575,13 @@ static void ssh2_maybe_setup_pty(struct ssh_channel *c, struct Packet *pktin,
|
|||||||
|
|
||||||
crWaitUntilV(pktin);
|
crWaitUntilV(pktin);
|
||||||
|
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_SUCCESS) {
|
if (pktin->type == SSH2_MSG_CHANNEL_SUCCESS) {
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_FAILURE) {
|
|
||||||
bombout(("Unexpected response to pty request:"
|
|
||||||
" packet type %d", pktin->type));
|
|
||||||
crStopV;
|
|
||||||
}
|
|
||||||
c_write_str(ssh, "Server refused to allocate pty\r\n");
|
|
||||||
ssh->editing = ssh->echoing = 1;
|
|
||||||
} else {
|
|
||||||
logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
|
logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
|
||||||
ssh->ospeed, ssh->ispeed);
|
ssh->ospeed, ssh->ispeed);
|
||||||
ssh->got_pty = TRUE;
|
ssh->got_pty = TRUE;
|
||||||
|
} else {
|
||||||
|
c_write_str(ssh, "Server refused to allocate pty\r\n");
|
||||||
|
ssh->editing = ssh->echoing = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ssh->editing = ssh->echoing = 1;
|
ssh->editing = ssh->echoing = 1;
|
||||||
@ -7655,17 +7637,8 @@ static void ssh2_setup_env(struct ssh_channel *c, struct Packet *pktin,
|
|||||||
|
|
||||||
while (s->env_left > 0) {
|
while (s->env_left > 0) {
|
||||||
crWaitUntilV(pktin);
|
crWaitUntilV(pktin);
|
||||||
|
if (pktin->type == SSH2_MSG_CHANNEL_SUCCESS)
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_SUCCESS) {
|
|
||||||
if (pktin->type != SSH2_MSG_CHANNEL_FAILURE) {
|
|
||||||
bombout(("Unexpected response to environment request:"
|
|
||||||
" packet type %d", pktin->type));
|
|
||||||
crStopV;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
s->env_ok++;
|
s->env_ok++;
|
||||||
}
|
|
||||||
|
|
||||||
s->env_left--;
|
s->env_left--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user