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

sshproxy: share the caller's LogPolicy.

Now new_connection() takes an optional LogPolicy * argument, and
passes it on to the SshProxy setup. This means that SshProxy's
implementation of the LogPolicy trait can answer queries like
askappend() and logging_error() by passing them on to the same
LogPolicy used by the main backend.

Not all callers of new_connection have a LogPolicy, so we still have
to fall back to the previous conservative default behaviour if
SshProxy doesn't have a LogPolicy it can ask.

The main backend implementations didn't _quite_ have access to a
LogPolicy already, but they do have a LogContext, which has a
LogPolicy vtable pointer inside it; so I've added a query function
log_get_policy() which allows them to extract that pointer to pass to
new_connection.

This is the first step of fixing the non-interactivity limitations of
SshProxy. But it's also the easiest step: the next ones will be more
involved.
This commit is contained in:
Simon Tatham
2021-09-13 17:17:20 +01:00
parent a4b8ff911b
commit a08f953bd6
16 changed files with 90 additions and 51 deletions

View File

@ -1189,7 +1189,8 @@ void run_agent(FILE *logfp, const char *symlink_path)
conn->plug.vt = &X11Connection_plugvt;
s = new_connection(sk_addr_dup(disp->addr),
disp->realhost, disp->port,
false, true, false, false, &conn->plug, conf);
false, true, false, false, &conn->plug, conf,
NULL);
if ((err = sk_socket_error(s)) != NULL) {
fprintf(stderr, "pageant: unable to connect to X server: %s", err);
exit(1);

View File

@ -297,7 +297,7 @@ int platform_ssh_share(const char *pi_name, Conf *conf,
if (can_downstream) {
retsock = new_connection(unix_sock_addr(sockname),
"", 0, false, true, false, false,
downplug, conf);
downplug, conf, NULL);
if (sk_socket_error(retsock) == NULL) {
sfree(*logtext);
*logtext = sockname;