1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22: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

@ -167,7 +167,8 @@ static char *raw_init(const BackendVtable *vt, Seat *seat,
* Open socket.
*/
raw->s = new_connection(addr, *realhost, port, false, true, nodelay,
keepalive, &raw->plug, conf);
keepalive, &raw->plug, conf,
log_get_policy(logctx));
if ((err = sk_socket_error(raw->s)) != NULL)
return dupstr(err);

View File

@ -204,7 +204,8 @@ static char *rlogin_init(const BackendVtable *vt, Seat *seat,
* Open socket.
*/
rlogin->s = new_connection(addr, *realhost, port, true, false,
nodelay, keepalive, &rlogin->plug, conf);
nodelay, keepalive, &rlogin->plug, conf,
log_get_policy(logctx));
if ((err = sk_socket_error(rlogin->s)) != NULL)
return dupstr(err);

View File

@ -712,7 +712,8 @@ static char *supdup_init(const BackendVtable *x, Seat *seat,
* Open socket.
*/
supdup->s = new_connection(addr, *realhost, port, false, true,
nodelay, keepalive, &supdup->plug, supdup->conf);
nodelay, keepalive, &supdup->plug, supdup->conf,
log_get_policy(logctx));
if ((err = sk_socket_error(supdup->s)) != NULL)
return dupstr(err);

View File

@ -739,7 +739,8 @@ static char *telnet_init(const BackendVtable *vt, Seat *seat,
* Open socket.
*/
telnet->s = new_connection(addr, *realhost, port, false, true, nodelay,
keepalive, &telnet->plug, telnet->conf);
keepalive, &telnet->plug, telnet->conf,
log_get_policy(logctx));
if ((err = sk_socket_error(telnet->s)) != NULL)
return dupstr(err);