mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
Spotted by Dimitry Andric: `ssh-termspeed' implementation was not taking
account of coroutines and used local variables over a crFoo. I believe the impact was cosmetic, affecting the speeds reported in the Event Log only. I've put the variables `ispeed' and `ospeed' in the main ssh_tag structure, even though they're only live for a short duration; I did this rather than create a new state struct for ssh1_protocol() (since ssh_tag already has short-duration junk like portfwd_strptr). [originally from svn r4272]
This commit is contained in:
parent
a2acc6ae0d
commit
14d9628130
21
ssh.c
21
ssh.c
@ -573,6 +573,7 @@ struct ssh_tag {
|
|||||||
|
|
||||||
void *frontend;
|
void *frontend;
|
||||||
|
|
||||||
|
int ospeed, ispeed; /* temporaries */
|
||||||
int term_width, term_height;
|
int term_width, term_height;
|
||||||
|
|
||||||
tree234 *channels; /* indexed by local id */
|
tree234 *channels; /* indexed by local id */
|
||||||
@ -3403,16 +3404,16 @@ static void ssh1_protocol(Ssh ssh, unsigned char *in, int inlen, int ispkt)
|
|||||||
if (!ssh->cfg.nopty) {
|
if (!ssh->cfg.nopty) {
|
||||||
/* Unpick the terminal-speed string. */
|
/* Unpick the terminal-speed string. */
|
||||||
/* XXX perhaps we should allow no speeds to be sent. */
|
/* XXX perhaps we should allow no speeds to be sent. */
|
||||||
int ospeed = 38400, ispeed = 38400; /* last-resort defaults */
|
ssh->ospeed = 38400; ssh->ispeed = 38400; /* last-resort defaults */
|
||||||
sscanf(ssh->cfg.termspeed, "%d,%d", &ospeed, &ispeed);
|
sscanf(ssh->cfg.termspeed, "%d,%d", &ssh->ospeed, &ssh->ispeed);
|
||||||
/* Send the pty request. */
|
/* Send the pty request. */
|
||||||
send_packet(ssh, SSH1_CMSG_REQUEST_PTY,
|
send_packet(ssh, SSH1_CMSG_REQUEST_PTY,
|
||||||
PKT_STR, ssh->cfg.termtype,
|
PKT_STR, ssh->cfg.termtype,
|
||||||
PKT_INT, ssh->term_height,
|
PKT_INT, ssh->term_height,
|
||||||
PKT_INT, ssh->term_width,
|
PKT_INT, ssh->term_width,
|
||||||
PKT_INT, 0, PKT_INT, 0, /* width,height in pixels */
|
PKT_INT, 0, PKT_INT, 0, /* width,height in pixels */
|
||||||
PKT_CHAR, 192, PKT_INT, ispeed, /* TTY_OP_ISPEED */
|
PKT_CHAR, 192, PKT_INT, ssh->ispeed, /* TTY_OP_ISPEED */
|
||||||
PKT_CHAR, 193, PKT_INT, ospeed, /* TTY_OP_OSPEED */
|
PKT_CHAR, 193, PKT_INT, ssh->ospeed, /* TTY_OP_OSPEED */
|
||||||
PKT_CHAR, 0, PKT_END);
|
PKT_CHAR, 0, PKT_END);
|
||||||
ssh->state = SSH_STATE_INTERMED;
|
ssh->state = SSH_STATE_INTERMED;
|
||||||
do {
|
do {
|
||||||
@ -3427,7 +3428,7 @@ static void ssh1_protocol(Ssh ssh, unsigned char *in, int inlen, int ispkt)
|
|||||||
ssh->editing = ssh->echoing = 1;
|
ssh->editing = ssh->echoing = 1;
|
||||||
}
|
}
|
||||||
logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
|
logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
|
||||||
ospeed, ispeed);
|
ssh->ospeed, ssh->ispeed);
|
||||||
} else {
|
} else {
|
||||||
ssh->editing = ssh->echoing = 1;
|
ssh->editing = ssh->echoing = 1;
|
||||||
}
|
}
|
||||||
@ -5594,8 +5595,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt)
|
|||||||
if (!ssh->cfg.nopty) {
|
if (!ssh->cfg.nopty) {
|
||||||
/* Unpick the terminal-speed string. */
|
/* Unpick the terminal-speed string. */
|
||||||
/* XXX perhaps we should allow no speeds to be sent. */
|
/* XXX perhaps we should allow no speeds to be sent. */
|
||||||
int ospeed = 38400, ispeed = 38400; /* last-resort defaults */
|
ssh->ospeed = 38400; ssh->ispeed = 38400; /* last-resort defaults */
|
||||||
sscanf(ssh->cfg.termspeed, "%d,%d", &ospeed, &ispeed);
|
sscanf(ssh->cfg.termspeed, "%d,%d", &ssh->ospeed, &ssh->ispeed);
|
||||||
/* Build the pty request. */
|
/* Build the pty request. */
|
||||||
ssh2_pkt_init(ssh, SSH2_MSG_CHANNEL_REQUEST);
|
ssh2_pkt_init(ssh, SSH2_MSG_CHANNEL_REQUEST);
|
||||||
ssh2_pkt_adduint32(ssh, ssh->mainchan->remoteid); /* recipient channel */
|
ssh2_pkt_adduint32(ssh, ssh->mainchan->remoteid); /* recipient channel */
|
||||||
@ -5608,9 +5609,9 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt)
|
|||||||
ssh2_pkt_adduint32(ssh, 0); /* pixel height */
|
ssh2_pkt_adduint32(ssh, 0); /* pixel height */
|
||||||
ssh2_pkt_addstring_start(ssh);
|
ssh2_pkt_addstring_start(ssh);
|
||||||
ssh2_pkt_addbyte(ssh, 128); /* TTY_OP_ISPEED */
|
ssh2_pkt_addbyte(ssh, 128); /* TTY_OP_ISPEED */
|
||||||
ssh2_pkt_adduint32(ssh, ispeed);
|
ssh2_pkt_adduint32(ssh, ssh->ispeed);
|
||||||
ssh2_pkt_addbyte(ssh, 129); /* TTY_OP_OSPEED */
|
ssh2_pkt_addbyte(ssh, 129); /* TTY_OP_OSPEED */
|
||||||
ssh2_pkt_adduint32(ssh, ospeed);
|
ssh2_pkt_adduint32(ssh, ssh->ospeed);
|
||||||
ssh2_pkt_addstring_data(ssh, "\0", 1); /* TTY_OP_END */
|
ssh2_pkt_addstring_data(ssh, "\0", 1); /* TTY_OP_END */
|
||||||
ssh2_pkt_send(ssh);
|
ssh2_pkt_send(ssh);
|
||||||
ssh->state = SSH_STATE_INTERMED;
|
ssh->state = SSH_STATE_INTERMED;
|
||||||
@ -5637,7 +5638,7 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, int ispkt)
|
|||||||
ssh->editing = ssh->echoing = 1;
|
ssh->editing = ssh->echoing = 1;
|
||||||
} else {
|
} else {
|
||||||
logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
|
logeventf(ssh, "Allocated pty (ospeed %dbps, ispeed %dbps)",
|
||||||
ospeed, ispeed);
|
ssh->ospeed, ssh->ispeed);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ssh->editing = ssh->echoing = 1;
|
ssh->editing = ssh->echoing = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user