1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Localise user_input to SSH connection layers.

Now that the SSH backend's user_input bufchain is no longer needed for
handling userpass input, it doesn't have to be awkwardly shared
between all the packet protocol layers any more. So we can turn the
want_user_input and got_user_input methods of PacketProtocolLayer into
methods of ConnectionLayer, and then only the two connection layers
have to bother implementing them, or store a pointer to the bufchain
they read from.
This commit is contained in:
Simon Tatham
2021-09-14 14:00:05 +01:00
parent d1374c5890
commit 3037258808
14 changed files with 60 additions and 118 deletions

View File

@ -81,7 +81,6 @@ struct ssh2_userauth_state {
unsigned signflags;
int len;
PktOut *pktout;
bool want_user_input;
bool is_trivial_auth;
agent_pending_query *auth_agent_query;
@ -103,8 +102,6 @@ static bool ssh2_userauth_get_specials(
PacketProtocolLayer *ppl, add_special_fn_t add_special, void *ctx);
static void ssh2_userauth_special_cmd(PacketProtocolLayer *ppl,
SessionSpecialCode code, int arg);
static bool ssh2_userauth_want_user_input(PacketProtocolLayer *ppl);
static void ssh2_userauth_got_user_input(PacketProtocolLayer *ppl);
static void ssh2_userauth_reconfigure(PacketProtocolLayer *ppl, Conf *conf);
static void ssh2_userauth_agent_query(struct ssh2_userauth_state *, strbuf *);
@ -125,8 +122,6 @@ static const PacketProtocolLayerVtable ssh2_userauth_vtable = {
.process_queue = ssh2_userauth_process_queue,
.get_specials = ssh2_userauth_get_specials,
.special_cmd = ssh2_userauth_special_cmd,
.want_user_input = ssh2_userauth_want_user_input,
.got_user_input = ssh2_userauth_got_user_input,
.reconfigure = ssh2_userauth_reconfigure,
.queued_data_size = ssh_ppl_default_queued_data_size,
.name = "ssh-userauth",
@ -1882,21 +1877,6 @@ static void ssh2_userauth_special_cmd(PacketProtocolLayer *ppl,
/* No specials provided by this layer. */
}
static bool ssh2_userauth_want_user_input(PacketProtocolLayer *ppl)
{
struct ssh2_userauth_state *s =
container_of(ppl, struct ssh2_userauth_state, ppl);
return s->want_user_input;
}
static void ssh2_userauth_got_user_input(PacketProtocolLayer *ppl)
{
struct ssh2_userauth_state *s =
container_of(ppl, struct ssh2_userauth_state, ppl);
if (s->want_user_input)
queue_idempotent_callback(&s->ppl.ic_process_queue);
}
static void ssh2_userauth_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
{
struct ssh2_userauth_state *s =