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

SSH proxy: separate stdout from stderr.

In the initial version of SSH proxying that only opened direct-tcpip
channels, this wasn't important. But as of commit 6f7c52dcce, we
now support invoking a command or subsystem on the proxy SSH server,
and those _can_ generate stderr data which we must now separate from
stdout.

Happily, we have a perfectly sensible thing to _do_ with it: the same
thing we'd do with stderr coming from a local proxy subprocess, to
wit, pass it to log_proxy_stderr so that it can appear in the terminal
window (if configured to) and the Event Log.
This commit is contained in:
Simon Tatham 2022-04-29 16:28:58 +01:00
parent e22df74545
commit a2ac5ec287

View File

@ -255,8 +255,15 @@ 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);
switch (type) {
case SEAT_OUTPUT_STDOUT:
bufchain_add(&sp->ssh_to_socket, data, len);
try_send_ssh_to_socket(sp);
break;
case SEAT_OUTPUT_STDERR:
log_proxy_stderr(sp->plug, &sp->psb, data, len);
break;
}
return bufchain_size(&sp->ssh_to_socket);
}