mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -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:
20
network.h
20
network.h
@ -110,13 +110,22 @@ struct PlugVtable {
|
||||
*/
|
||||
};
|
||||
|
||||
/* proxy indirection layer */
|
||||
/* NB, control of 'addr' is passed via new_connection, which takes
|
||||
* responsibility for freeing it */
|
||||
/* Proxy indirection layer.
|
||||
*
|
||||
* Calling new_connection transfers ownership of 'addr': the proxy
|
||||
* layer is now responsible for freeing it, and the caller shouldn't
|
||||
* assume it exists any more.
|
||||
*
|
||||
* You can optionally pass a LogPolicy to this function, which will be
|
||||
* passed on in turn to proxy types that can use one (e.g. SSH jump
|
||||
* host proxy). If you don't have one, all proxy types are required to
|
||||
* be able to manage without (and will just degrade their logging
|
||||
* control).
|
||||
*/
|
||||
Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
Plug *plug, Conf *conf);
|
||||
Plug *plug, Conf *conf, LogPolicy *lp);
|
||||
Socket *new_listener(const char *srcaddr, int port, Plug *plug,
|
||||
bool local_host_only, Conf *conf, int addressfamily);
|
||||
SockAddr *name_lookup(const char *host, int port, char **canonicalname,
|
||||
@ -134,7 +143,8 @@ Socket *platform_new_connection(SockAddr *addr, const char *hostname,
|
||||
Socket *sshproxy_new_connection(SockAddr *addr, const char *hostname,
|
||||
int port, bool privport,
|
||||
bool oobinline, bool nodelay, bool keepalive,
|
||||
Plug *plug, Conf *conf);
|
||||
Plug *plug, Conf *conf,
|
||||
LogPolicy *clientlp);
|
||||
|
||||
/* socket functions */
|
||||
|
||||
|
Reference in New Issue
Block a user