From 5ca0a7563671c3a088617d6f120a45078a01fe17 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 16 Sep 2021 17:20:16 +0100 Subject: [PATCH] SshProxy: display auth banners from proxy connections. Now the banners (plus their surrounding antispoof prompts) have their own SeatOutputType, it's easy to distinguish them in sshproxy_output and do the right thing with them. --- sshproxy.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sshproxy.c b/sshproxy.c index d1448219..20815629 100644 --- a/sshproxy.c +++ b/sshproxy.c @@ -258,9 +258,21 @@ static size_t sshproxy_output(Seat *seat, SeatOutputType type, const void *data, size_t len) { SshProxy *sp = container_of(seat, SshProxy, seat); - bufchain_add(&sp->ssh_to_socket, data, len); - try_send_ssh_to_socket(sp); - return bufchain_size(&sp->ssh_to_socket); + if (type == SEAT_OUTPUT_AUTH_BANNER) { + if (sp->clientseat) { + /* + * If we have access to the outer Seat, pass the SSH login + * banner on to it. + */ + return seat_output(sp->clientseat, type, data, len); + } else { + return 0; + } + } else { + bufchain_add(&sp->ssh_to_socket, data, len); + try_send_ssh_to_socket(sp); + return bufchain_size(&sp->ssh_to_socket); + } } static bool sshproxy_eof(Seat *seat)