mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -05:00
Fix mishandling of refusal to compress in SSH-1.
I've just noticed that we call ssh1_bpp_start_compression even if the server responded to our compression request with SSH1_SMSG_FAILURE! Also, while I'm here, there's a potential race condition if the server were to send an unrelated message (such as SSH1_MSG_IGNORE) immediately after the SSH1_SMSG_SUCCESS that indicates compression being enabled - the BPP would try to decode the compressed IGNORE message before the SUCCESS got to the higher layer that would tell the BPP it should have enabled compression. Fixed that by changing the method by which we tell the BPP what's going on.
This commit is contained in:
7
ssh.c
7
ssh.c
@ -3200,6 +3200,7 @@ static void do_ssh1_connection(void *vctx)
|
||||
pkt = ssh_bpp_new_pktout(ssh->bpp, SSH1_CMSG_REQUEST_COMPRESSION);
|
||||
put_uint32(pkt, 6); /* gzip compression level */
|
||||
ssh_pkt_write(ssh, pkt);
|
||||
ssh1_bpp_requested_compression(ssh->bpp);
|
||||
crMaybeWaitUntilV((pktin = pq_pop(&ssh->pq_ssh1_connection)) != NULL);
|
||||
if (pktin->type != SSH1_SMSG_SUCCESS
|
||||
&& pktin->type != SSH1_SMSG_FAILURE) {
|
||||
@ -3207,9 +3208,9 @@ static void do_ssh1_connection(void *vctx)
|
||||
crStopV;
|
||||
} else if (pktin->type == SSH1_SMSG_FAILURE) {
|
||||
c_write_str(ssh, "Server refused to compress\r\n");
|
||||
}
|
||||
logevent("Started zlib (RFC1950) compression");
|
||||
ssh1_bpp_start_compression(ssh->bpp);
|
||||
} else {
|
||||
logevent("Started zlib (RFC1950) compression");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user