diff options
author | Simon Tatham <anakin@pobox.com> | 2021-09-13 19:17:20 +0300 |
---|---|---|
committer | Simon Tatham <anakin@pobox.com> | 2021-09-13 19:18:31 +0300 |
commit | a08f953bd6c1a3d19e125c7958243b64a0136823 (patch) | |
tree | 7293db81526af4ba833d0c60e934712d899f31e4 /logging.c | |
parent | a4b8ff911b4abfa1c2247c91d1507687459bab68 (diff) |
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.
Diffstat (limited to 'logging.c')
-rw-r--r-- | logging.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -81,6 +81,11 @@ void logflush(LogContext *ctx) fflush(ctx->lgfp); } +LogPolicy *log_get_policy(LogContext *ctx) +{ + return ctx->lp; +} + static void logfopen_callback(void *vctx, int mode) { LogContext *ctx = (LogContext *)vctx; |