diff --git a/ssh.h b/ssh.h index 34a8909d..d4729d5f 100644 --- a/ssh.h +++ b/ssh.h @@ -299,9 +299,15 @@ struct ConnectionLayerVtable { * subsequent channel-opens). */ void (*enable_x_fwd)(ConnectionLayer *cl); - /* Communicate to the connection layer whether the main session - * channel currently wants user input. */ + /* Communicate / query whether the main session channel currently + * wants user input. The set function is called by mainchan; the + * query function is called by the top-level ssh.c. */ void (*set_wants_user_input)(ConnectionLayer *cl, bool wanted); + bool (*get_wants_user_input)(ConnectionLayer *cl); + + /* Notify the connection layer that more data has been added to + * the user input queue. */ + void (*got_user_input)(ConnectionLayer *cl); }; struct ConnectionLayer { @@ -371,6 +377,10 @@ static inline void ssh_enable_x_fwd(ConnectionLayer *cl) { cl->vt->enable_x_fwd(cl); } static inline void ssh_set_wants_user_input(ConnectionLayer *cl, bool wanted) { cl->vt->set_wants_user_input(cl, wanted); } +static inline bool ssh_get_wants_user_input(ConnectionLayer *cl) +{ return cl->vt->get_wants_user_input(cl); } +static inline void ssh_got_user_input(ConnectionLayer *cl) +{ cl->vt->got_user_input(cl); } /* Exports from portfwd.c */ PortFwdManager *portfwdmgr_new(ConnectionLayer *cl); diff --git a/ssh/common.c b/ssh/common.c index b6391729..c67a2dfb 100644 --- a/ssh/common.c +++ b/ssh/common.c @@ -682,7 +682,6 @@ void ssh_ppl_replace(PacketProtocolLayer *old, PacketProtocolLayer *new) new->bpp = old->bpp; ssh_ppl_setup_queues(new, old->in_pq, old->out_pq); new->selfptr = old->selfptr; - new->user_input = old->user_input; new->seat = old->seat; new->ssh = old->ssh; diff --git a/ssh/connection1.c b/ssh/connection1.c index bff09f51..e0b4aac6 100644 --- a/ssh/connection1.c +++ b/ssh/connection1.c @@ -31,8 +31,6 @@ static void ssh1_connection_free(PacketProtocolLayer *); static void ssh1_connection_process_queue(PacketProtocolLayer *); static void ssh1_connection_special_cmd(PacketProtocolLayer *ppl, SessionSpecialCode code, int arg); -static bool ssh1_connection_want_user_input(PacketProtocolLayer *ppl); -static void ssh1_connection_got_user_input(PacketProtocolLayer *ppl); static void ssh1_connection_reconfigure(PacketProtocolLayer *ppl, Conf *conf); static const PacketProtocolLayerVtable ssh1_connection_vtable = { @@ -40,8 +38,6 @@ static const PacketProtocolLayerVtable ssh1_connection_vtable = { .process_queue = ssh1_connection_process_queue, .get_specials = ssh1_common_get_specials, .special_cmd = ssh1_connection_special_cmd, - .want_user_input = ssh1_connection_want_user_input, - .got_user_input = ssh1_connection_got_user_input, .reconfigure = ssh1_connection_reconfigure, .queued_data_size = ssh_ppl_default_queued_data_size, .name = NULL, /* no layer names in SSH-1 */ @@ -63,6 +59,8 @@ static bool ssh1_ldisc_option(ConnectionLayer *cl, int option); static void ssh1_set_ldisc_option(ConnectionLayer *cl, int option, bool value); static void ssh1_enable_x_fwd(ConnectionLayer *cl); static void ssh1_set_wants_user_input(ConnectionLayer *cl, bool wanted); +static bool ssh1_get_wants_user_input(ConnectionLayer *cl); +static void ssh1_got_user_input(ConnectionLayer *cl); static const ConnectionLayerVtable ssh1_connlayer_vtable = { .rportfwd_alloc = ssh1_rportfwd_alloc, @@ -81,6 +79,8 @@ static const ConnectionLayerVtable ssh1_connlayer_vtable = { .set_ldisc_option = ssh1_set_ldisc_option, .enable_x_fwd = ssh1_enable_x_fwd, .set_wants_user_input = ssh1_set_wants_user_input, + .get_wants_user_input = ssh1_get_wants_user_input, + .got_user_input = ssh1_got_user_input, /* other methods are NULL */ }; @@ -138,7 +138,7 @@ void ssh1_channel_free(struct ssh1_channel *c) } PacketProtocolLayer *ssh1_connection_new( - Ssh *ssh, Conf *conf, ConnectionLayer **cl_out) + Ssh *ssh, Conf *conf, bufchain *user_input, ConnectionLayer **cl_out) { struct ssh1_connection_state *s = snew(struct ssh1_connection_state); memset(s, 0, sizeof(*s)); @@ -150,6 +150,8 @@ PacketProtocolLayer *ssh1_connection_new( s->x11authtree = newtree234(x11_authcmp); + s->user_input = user_input; + /* Need to get the log context for s->cl now, because we won't be * helpfully notified when a copy is written into s->ppl by our * owner. */ @@ -771,28 +773,28 @@ static void ssh1_set_wants_user_input(ConnectionLayer *cl, bool wanted) ssh_check_sendok(s->ppl.ssh); } -static bool ssh1_connection_want_user_input(PacketProtocolLayer *ppl) +static bool ssh1_get_wants_user_input(ConnectionLayer *cl) { struct ssh1_connection_state *s = - container_of(ppl, struct ssh1_connection_state, ppl); + container_of(cl, struct ssh1_connection_state, cl); return s->want_user_input; } -static void ssh1_connection_got_user_input(PacketProtocolLayer *ppl) +static void ssh1_got_user_input(ConnectionLayer *cl) { struct ssh1_connection_state *s = - container_of(ppl, struct ssh1_connection_state, ppl); + container_of(cl, struct ssh1_connection_state, cl); - while (s->mainchan && bufchain_size(s->ppl.user_input) > 0) { + while (s->mainchan && bufchain_size(s->user_input) > 0) { /* * Add user input to the main channel's buffer. */ - ptrlen data = bufchain_prefix(s->ppl.user_input); + ptrlen data = bufchain_prefix(s->user_input); if (data.len > 512) data.len = 512; sshfwd_write(&s->mainchan_sc, data.ptr, data.len); - bufchain_consume(s->ppl.user_input, data.len); + bufchain_consume(s->user_input, data.len); } } diff --git a/ssh/connection1.h b/ssh/connection1.h index 44370787..7d136d60 100644 --- a/ssh/connection1.h +++ b/ssh/connection1.h @@ -25,6 +25,7 @@ struct ssh1_connection_state { bool want_user_input; bool session_terminated; int term_width, term_height, term_width_orig, term_height_orig; + bufchain *user_input; bool X11_fwd_enabled; struct X11Display *x11disp; diff --git a/ssh/connection2.c b/ssh/connection2.c index df542f63..a6bc553b 100644 --- a/ssh/connection2.c +++ b/ssh/connection2.c @@ -18,8 +18,6 @@ static bool ssh2_connection_get_specials( PacketProtocolLayer *ppl, add_special_fn_t add_special, void *ctx); static void ssh2_connection_special_cmd(PacketProtocolLayer *ppl, SessionSpecialCode code, int arg); -static bool ssh2_connection_want_user_input(PacketProtocolLayer *ppl); -static void ssh2_connection_got_user_input(PacketProtocolLayer *ppl); static void ssh2_connection_reconfigure(PacketProtocolLayer *ppl, Conf *conf); static const PacketProtocolLayerVtable ssh2_connection_vtable = { @@ -27,8 +25,6 @@ static const PacketProtocolLayerVtable ssh2_connection_vtable = { .process_queue = ssh2_connection_process_queue, .get_specials = ssh2_connection_get_specials, .special_cmd = ssh2_connection_special_cmd, - .want_user_input = ssh2_connection_want_user_input, - .got_user_input = ssh2_connection_got_user_input, .reconfigure = ssh2_connection_reconfigure, .queued_data_size = ssh_ppl_default_queued_data_size, .name = "ssh-connection", @@ -63,6 +59,8 @@ static bool ssh2_ldisc_option(ConnectionLayer *cl, int option); static void ssh2_set_ldisc_option(ConnectionLayer *cl, int option, bool value); static void ssh2_enable_x_fwd(ConnectionLayer *cl); static void ssh2_set_wants_user_input(ConnectionLayer *cl, bool wanted); +static bool ssh2_get_wants_user_input(ConnectionLayer *cl); +static void ssh2_got_user_input(ConnectionLayer *cl); static const ConnectionLayerVtable ssh2_connlayer_vtable = { .rportfwd_alloc = ssh2_rportfwd_alloc, @@ -88,6 +86,8 @@ static const ConnectionLayerVtable ssh2_connlayer_vtable = { .set_ldisc_option = ssh2_set_ldisc_option, .enable_x_fwd = ssh2_enable_x_fwd, .set_wants_user_input = ssh2_set_wants_user_input, + .get_wants_user_input = ssh2_get_wants_user_input, + .got_user_input = ssh2_got_user_input, }; static char *ssh2_channel_open_failure_error_text(PktIn *pktin) @@ -239,7 +239,8 @@ static void ssh2_channel_free(struct ssh2_channel *c) PacketProtocolLayer *ssh2_connection_new( Ssh *ssh, ssh_sharing_state *connshare, bool is_simple, - Conf *conf, const char *peer_verstring, ConnectionLayer **cl_out) + Conf *conf, const char *peer_verstring, bufchain *user_input, + ConnectionLayer **cl_out) { struct ssh2_connection_state *s = snew(struct ssh2_connection_state); memset(s, 0, sizeof(*s)); @@ -264,6 +265,8 @@ PacketProtocolLayer *ssh2_connection_new( s->x11authtree = newtree234(x11_authcmp); + s->user_input = user_input; + /* Need to get the log context for s->cl now, because we won't be * helpfully notified when a copy is written into s->ppl by our * owner. */ @@ -1705,25 +1708,25 @@ static void ssh2_set_wants_user_input(ConnectionLayer *cl, bool wanted) ssh_check_sendok(s->ppl.ssh); } -static bool ssh2_connection_want_user_input(PacketProtocolLayer *ppl) +static bool ssh2_get_wants_user_input(ConnectionLayer *cl) { struct ssh2_connection_state *s = - container_of(ppl, struct ssh2_connection_state, ppl); + container_of(cl, struct ssh2_connection_state, cl); return s->want_user_input; } -static void ssh2_connection_got_user_input(PacketProtocolLayer *ppl) +static void ssh2_got_user_input(ConnectionLayer *cl) { struct ssh2_connection_state *s = - container_of(ppl, struct ssh2_connection_state, ppl); + container_of(cl, struct ssh2_connection_state, cl); - while (s->mainchan && bufchain_size(s->ppl.user_input) > 0) { + while (s->mainchan && bufchain_size(s->user_input) > 0) { /* * Add user input to the main channel's buffer. */ - ptrlen data = bufchain_prefix(s->ppl.user_input); + ptrlen data = bufchain_prefix(s->user_input); sshfwd_write(s->mainchan_sc, data.ptr, data.len); - bufchain_consume(s->ppl.user_input, data.len); + bufchain_consume(s->user_input, data.len); } } diff --git a/ssh/connection2.h b/ssh/connection2.h index d3bb240a..7971632c 100644 --- a/ssh/connection2.h +++ b/ssh/connection2.h @@ -16,6 +16,7 @@ struct ssh2_connection_state { int session_attempt, session_status; int term_width, term_height; bool want_user_input; + bufchain *user_input; bool ssh_is_simple; bool persistent; diff --git a/ssh/login1-server.c b/ssh/login1-server.c index 14f5edd6..30ff9026 100644 --- a/ssh/login1-server.c +++ b/ssh/login1-server.c @@ -51,9 +51,6 @@ static bool ssh1_login_server_get_specials( void *ctx) { return false; } static void ssh1_login_server_special_cmd(PacketProtocolLayer *ppl, SessionSpecialCode code, int arg) {} -static bool ssh1_login_server_want_user_input( - PacketProtocolLayer *ppl) { return false; } -static void ssh1_login_server_got_user_input(PacketProtocolLayer *ppl) {} static void ssh1_login_server_reconfigure( PacketProtocolLayer *ppl, Conf *conf) {} @@ -62,8 +59,6 @@ static const PacketProtocolLayerVtable ssh1_login_server_vtable = { .process_queue = ssh1_login_server_process_queue, .get_specials = ssh1_login_server_get_specials, .special_cmd = ssh1_login_server_special_cmd, - .want_user_input = ssh1_login_server_want_user_input, - .got_user_input = ssh1_login_server_got_user_input, .reconfigure = ssh1_login_server_reconfigure, .queued_data_size = ssh_ppl_default_queued_data_size, .name = NULL, /* no layer names in SSH-1 */ diff --git a/ssh/login1.c b/ssh/login1.c index a700e02a..1e2d7d3e 100644 --- a/ssh/login1.c +++ b/ssh/login1.c @@ -61,7 +61,6 @@ struct ssh1_login_state { int dlgret; Filename *keyfile; RSAKey servkey, hostkey; - bool want_user_input; StripCtrlChars *tis_scc; bool tis_scc_initialised; @@ -74,8 +73,6 @@ static void ssh1_login_process_queue(PacketProtocolLayer *); static void ssh1_login_dialog_callback(void *, int); static void ssh1_login_special_cmd(PacketProtocolLayer *ppl, SessionSpecialCode code, int arg); -static bool ssh1_login_want_user_input(PacketProtocolLayer *ppl); -static void ssh1_login_got_user_input(PacketProtocolLayer *ppl); static void ssh1_login_reconfigure(PacketProtocolLayer *ppl, Conf *conf); static const PacketProtocolLayerVtable ssh1_login_vtable = { @@ -83,8 +80,6 @@ static const PacketProtocolLayerVtable ssh1_login_vtable = { .process_queue = ssh1_login_process_queue, .get_specials = ssh1_common_get_specials, .special_cmd = ssh1_login_special_cmd, - .want_user_input = ssh1_login_want_user_input, - .got_user_input = ssh1_login_got_user_input, .reconfigure = ssh1_login_reconfigure, .queued_data_size = ssh_ppl_default_queued_data_size, .name = NULL, /* no layer names in SSH-1 */ @@ -1205,21 +1200,6 @@ static void ssh1_login_special_cmd(PacketProtocolLayer *ppl, } } -static bool ssh1_login_want_user_input(PacketProtocolLayer *ppl) -{ - struct ssh1_login_state *s = - container_of(ppl, struct ssh1_login_state, ppl); - return s->want_user_input; -} - -static void ssh1_login_got_user_input(PacketProtocolLayer *ppl) -{ - struct ssh1_login_state *s = - container_of(ppl, struct ssh1_login_state, ppl); - if (s->want_user_input) - queue_idempotent_callback(&s->ppl.ic_process_queue); -} - static void ssh1_login_reconfigure(PacketProtocolLayer *ppl, Conf *conf) { struct ssh1_login_state *s = diff --git a/ssh/mainchan.c b/ssh/mainchan.c index 2e690547..04993620 100644 --- a/ssh/mainchan.c +++ b/ssh/mainchan.c @@ -322,7 +322,7 @@ static void mainchan_ready(mainchan *mc) mc->ready = true; ssh_set_wants_user_input(mc->cl, true); - ssh_ppl_got_user_input(mc->ppl); /* in case any is already queued */ + ssh_got_user_input(mc->cl); /* in case any is already queued */ /* If an EOF arrived before we were ready, handle it now. */ if (mc->eof_pending) { diff --git a/ssh/ppl.h b/ssh/ppl.h index 5ba1e9d3..66f46038 100644 --- a/ssh/ppl.h +++ b/ssh/ppl.h @@ -17,8 +17,6 @@ struct PacketProtocolLayerVtable { PacketProtocolLayer *ppl, add_special_fn_t add_special, void *ctx); void (*special_cmd)( PacketProtocolLayer *ppl, SessionSpecialCode code, int arg); - bool (*want_user_input)(PacketProtocolLayer *ppl); - void (*got_user_input)(PacketProtocolLayer *ppl); void (*reconfigure)(PacketProtocolLayer *ppl, Conf *conf); size_t (*queued_data_size)(PacketProtocolLayer *ppl); @@ -48,10 +46,6 @@ struct PacketProtocolLayer { * pointer and then freeing itself. */ PacketProtocolLayer **selfptr; - /* Bufchain of keyboard input from the user, for login prompts and - * similar. */ - bufchain *user_input; - /* Logging and error-reporting facilities. */ LogContext *logctx; Seat *seat; /* for dialog boxes, session output etc */ @@ -69,10 +63,6 @@ static inline bool ssh_ppl_get_specials( static inline void ssh_ppl_special_cmd( PacketProtocolLayer *ppl, SessionSpecialCode code, int arg) { ppl->vt->special_cmd(ppl, code, arg); } -static inline bool ssh_ppl_want_user_input(PacketProtocolLayer *ppl) -{ return ppl->vt->want_user_input(ppl); } -static inline void ssh_ppl_got_user_input(PacketProtocolLayer *ppl) -{ ppl->vt->got_user_input(ppl); } static inline void ssh_ppl_reconfigure(PacketProtocolLayer *ppl, Conf *conf) { ppl->vt->reconfigure(ppl, conf); } static inline size_t ssh_ppl_queued_data_size(PacketProtocolLayer *ppl) @@ -103,7 +93,7 @@ PacketProtocolLayer *ssh1_login_new( Conf *conf, const char *host, int port, PacketProtocolLayer *successor_layer); PacketProtocolLayer *ssh1_connection_new( - Ssh *ssh, Conf *conf, ConnectionLayer **cl_out); + Ssh *ssh, Conf *conf, bufchain *user_input, ConnectionLayer **cl_out); struct DataTransferStats; struct ssh_connection_shared_gss_state; @@ -123,7 +113,8 @@ PacketProtocolLayer *ssh2_userauth_new( bool gssapi_fwd, struct ssh_connection_shared_gss_state *shgss); PacketProtocolLayer *ssh2_connection_new( Ssh *ssh, ssh_sharing_state *connshare, bool is_simple, - Conf *conf, const char *peer_verstring, ConnectionLayer **cl_out); + Conf *conf, const char *peer_verstring, bufchain *user_input, + ConnectionLayer **cl_out); /* Can't put this in the userauth constructor without having a * dependency loop at setup time (transport and userauth can't _both_ diff --git a/ssh/server.c b/ssh/server.c index a3c400c0..4a3676ec 100644 --- a/ssh/server.c +++ b/ssh/server.c @@ -372,7 +372,6 @@ static void server_connect_bpp(server *srv) static void server_connect_ppl(server *srv, PacketProtocolLayer *ppl) { ppl->bpp = srv->bpp; - ppl->user_input = &srv->dummy_user_input; ppl->logctx = srv->logctx; ppl->ssh = &srv->ssh; ppl->seat = &srv->seat; @@ -516,7 +515,8 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv, connection_layer = ssh2_connection_new( &srv->ssh, NULL, false, srv->conf, - ssh_verstring_get_local(old_bpp), &srv->cl); + ssh_verstring_get_local(old_bpp), &srv->dummy_user_input, + &srv->cl); ssh2connection_server_configure(connection_layer, srv->sftpserver_vt, srv->ssc); server_connect_ppl(srv, connection_layer); @@ -530,7 +530,8 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv, connection_layer = ssh2_connection_new( &srv->ssh, NULL, false, srv->conf, - ssh_verstring_get_local(old_bpp), &srv->cl); + ssh_verstring_get_local(old_bpp), &srv->dummy_user_input, + &srv->cl); ssh2connection_server_configure(connection_layer, srv->sftpserver_vt, srv->ssc); server_connect_ppl(srv, connection_layer); @@ -566,7 +567,8 @@ static void server_got_ssh_version(struct ssh_version_receiver *rcv, srv->bpp = ssh1_bpp_new(srv->logctx); server_connect_bpp(srv); - connection_layer = ssh1_connection_new(&srv->ssh, srv->conf, &srv->cl); + connection_layer = ssh1_connection_new( + &srv->ssh, srv->conf, &srv->dummy_user_input, &srv->cl); ssh1connection_server_configure(connection_layer, srv->ssc); server_connect_ppl(srv, connection_layer); diff --git a/ssh/ssh.c b/ssh/ssh.c index 10c52001..4e7f8c06 100644 --- a/ssh/ssh.c +++ b/ssh/ssh.c @@ -165,7 +165,6 @@ static void ssh_connect_bpp(Ssh *ssh) static void ssh_connect_ppl(Ssh *ssh, PacketProtocolLayer *ppl) { ppl->bpp = ssh->bpp; - ppl->user_input = &ssh->user_input; ppl->seat = ssh->seat; ppl->ssh = ssh; ppl->logctx = ssh->logctx; @@ -241,7 +240,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, connection_layer = ssh2_connection_new( ssh, ssh->connshare, is_simple, ssh->conf, - ssh_verstring_get_remote(old_bpp), &ssh->cl); + ssh_verstring_get_remote(old_bpp), &ssh->user_input, &ssh->cl); ssh_connect_ppl(ssh, connection_layer); if (conf_get_bool(ssh->conf, CONF_ssh_no_userauth)) { @@ -299,7 +298,8 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, ssh->bpp = ssh1_bpp_new(ssh->logctx); ssh_connect_bpp(ssh); - connection_layer = ssh1_connection_new(ssh, ssh->conf, &ssh->cl); + connection_layer = ssh1_connection_new( + ssh, ssh->conf, &ssh->user_input, &ssh->cl); ssh_connect_ppl(ssh, connection_layer); ssh->base_layer = ssh1_login_new( @@ -314,7 +314,7 @@ static void ssh_got_ssh_version(struct ssh_version_receiver *rcv, connection_layer = ssh2_connection_new( ssh, ssh->connshare, false, ssh->conf, - ssh_verstring_get_remote(old_bpp), &ssh->cl); + ssh_verstring_get_remote(old_bpp), &ssh->user_input, &ssh->cl); ssh_connect_ppl(ssh, connection_layer); ssh->base_layer = connection_layer; } @@ -1024,8 +1024,8 @@ static void ssh_send(Backend *be, const char *buf, size_t len) return; bufchain_add(&ssh->user_input, buf, len); - if (ssh->base_layer) - ssh_ppl_got_user_input(ssh->base_layer); + if (ssh->cl) + ssh_got_user_input(ssh->cl); } /* @@ -1153,7 +1153,7 @@ static bool ssh_connected(Backend *be) static bool ssh_sendok(Backend *be) { Ssh *ssh = container_of(be, Ssh, backend); - return ssh->base_layer && ssh_ppl_want_user_input(ssh->base_layer); + return ssh->cl && ssh_get_wants_user_input(ssh->cl); } void ssh_check_sendok(Ssh *ssh) diff --git a/ssh/transport2.c b/ssh/transport2.c index 2966f2d7..9c49d55c 100644 --- a/ssh/transport2.c +++ b/ssh/transport2.c @@ -73,8 +73,6 @@ static bool ssh2_transport_get_specials( PacketProtocolLayer *ppl, add_special_fn_t add_special, void *ctx); static void ssh2_transport_special_cmd(PacketProtocolLayer *ppl, SessionSpecialCode code, int arg); -static bool ssh2_transport_want_user_input(PacketProtocolLayer *ppl); -static void ssh2_transport_got_user_input(PacketProtocolLayer *ppl); static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf); static size_t ssh2_transport_queued_data_size(PacketProtocolLayer *ppl); @@ -87,8 +85,6 @@ static const PacketProtocolLayerVtable ssh2_transport_vtable = { .process_queue = ssh2_transport_process_queue, .get_specials = ssh2_transport_get_specials, .special_cmd = ssh2_transport_special_cmd, - .want_user_input = ssh2_transport_want_user_input, - .got_user_input = ssh2_transport_got_user_input, .reconfigure = ssh2_transport_reconfigure, .queued_data_size = ssh2_transport_queued_data_size, .name = NULL, /* no protocol name for this layer */ @@ -2132,24 +2128,6 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf) ssh_ppl_reconfigure(s->higher_layer, conf); } -static bool ssh2_transport_want_user_input(PacketProtocolLayer *ppl) -{ - struct ssh2_transport_state *s = - container_of(ppl, struct ssh2_transport_state, ppl); - - /* Just delegate this to the higher layer */ - return ssh_ppl_want_user_input(s->higher_layer); -} - -static void ssh2_transport_got_user_input(PacketProtocolLayer *ppl) -{ - struct ssh2_transport_state *s = - container_of(ppl, struct ssh2_transport_state, ppl); - - /* Just delegate this to the higher layer */ - ssh_ppl_got_user_input(s->higher_layer); -} - static int weak_algorithm_compare(void *av, void *bv) { uintptr_t a = (uintptr_t)av, b = (uintptr_t)bv; diff --git a/ssh/userauth2-client.c b/ssh/userauth2-client.c index 51872ebf..d4f546b5 100644 --- a/ssh/userauth2-client.c +++ b/ssh/userauth2-client.c @@ -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 =