1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-26 09:42:25 +00:00

do_ssh1_connection: remove user input parameters.

The connection protocol didn't have to do anything too complicated
with user input - just remember to check for it and turn it into
SSH1_CMSG_STDIN_DATA - so this is a much less involved change than the
previous user input conversions.
This commit is contained in:
Simon Tatham 2018-05-18 07:22:58 +01:00
parent a41eefff41
commit 7c47a17b4e

26
ssh.c
View File

@ -6023,8 +6023,7 @@ int ssh_agent_forwarding_permitted(Ssh ssh)
return conf_get_int(ssh->conf, CONF_agentfwd) && agent_exists(); return conf_get_int(ssh->conf, CONF_agentfwd) && agent_exists();
} }
static void do_ssh1_connection(Ssh ssh, const unsigned char *in, int inlen, static void do_ssh1_connection(Ssh ssh, struct Packet *pktin)
struct Packet *pktin)
{ {
crBegin(ssh->do_ssh1_connection_crstate); crBegin(ssh->do_ssh1_connection_crstate);
@ -6219,13 +6218,16 @@ static void do_ssh1_connection(Ssh ssh, const unsigned char *in, int inlen,
crStopV; crStopV;
} }
} else { } else {
while (inlen > 0) { while (bufchain_size(&ssh->user_input) > 0) {
int len = min(inlen, 512); void *data;
int len;
bufchain_prefix(&ssh->user_input, &data, &len);
if (len > 512)
len = 512;
send_packet(ssh, SSH1_CMSG_STDIN_DATA, send_packet(ssh, SSH1_CMSG_STDIN_DATA,
PKT_INT, len, PKT_DATA, in, len, PKT_INT, len, PKT_DATA, data, len,
PKT_END); PKT_END);
in += len; bufchain_consume(&ssh->user_input, len);
inlen -= len;
} }
} }
} }
@ -6268,13 +6270,7 @@ static void ssh1_login_input(Ssh ssh)
static void ssh1_connection_input(Ssh ssh) static void ssh1_connection_input(Ssh ssh)
{ {
while (bufchain_size(&ssh->user_input) > 0) { do_ssh1_connection(ssh, NULL);
void *data;
int len;
bufchain_prefix(&ssh->user_input, &data, &len);
do_ssh1_connection(ssh, data, len, NULL);
bufchain_consume(&ssh->user_input, len);
}
} }
static void ssh1_coro_wrapper_initial(Ssh ssh, struct Packet *pktin) static void ssh1_coro_wrapper_initial(Ssh ssh, struct Packet *pktin)
@ -6286,7 +6282,7 @@ static void ssh1_coro_wrapper_initial(Ssh ssh, struct Packet *pktin)
static void ssh1_coro_wrapper_session(Ssh ssh, struct Packet *pktin) static void ssh1_coro_wrapper_session(Ssh ssh, struct Packet *pktin)
{ {
do_ssh1_connection(ssh, NULL, 0, pktin); do_ssh1_connection(ssh, pktin);
} }
static void ssh1_protocol_setup(Ssh ssh) static void ssh1_protocol_setup(Ssh ssh)