mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
a08f953bd6
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.
33 lines
1.2 KiB
C
33 lines
1.2 KiB
C
/*
|
|
* noproxy.c: an alternative to proxy.c, for use by auxiliary programs
|
|
* that need to make network connections but don't want to include all
|
|
* the full-on support for endless network proxies (and its
|
|
* configuration requirements). Implements the primary APIs of
|
|
* proxy.c, but maps them straight to the underlying network layer.
|
|
*/
|
|
|
|
#include "putty.h"
|
|
#include "network.h"
|
|
#include "proxy.h"
|
|
|
|
SockAddr *name_lookup(const char *host, int port, char **canonicalname,
|
|
Conf *conf, int addressfamily, LogContext *logctx,
|
|
const char *reason)
|
|
{
|
|
return sk_namelookup(host, canonicalname, addressfamily);
|
|
}
|
|
|
|
Socket *new_connection(SockAddr *addr, const char *hostname,
|
|
int port, bool privport,
|
|
bool oobinline, bool nodelay, bool keepalive,
|
|
Plug *plug, Conf *conf, LogPolicy *lp)
|
|
{
|
|
return sk_new(addr, port, privport, oobinline, nodelay, keepalive, plug);
|
|
}
|
|
|
|
Socket *new_listener(const char *srcaddr, int port, Plug *plug,
|
|
bool local_host_only, Conf *conf, int addressfamily)
|
|
{
|
|
return sk_newlistener(srcaddr, port, plug, local_host_only, addressfamily);
|
|
}
|