mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Allow sockets to retrieve their local endpoint info.
The peer_info method in the Socket vtable is replaced with endpoint_info, which takes a boolean indicating which end you're asking about. sk_peer_info still exists, as a wrapper on the new sk_endpoint_info.
This commit is contained in:
@ -415,6 +415,19 @@ SockAddr *name_lookup(const char *host, int port, char **canonicalname,
|
||||
}
|
||||
}
|
||||
|
||||
static SocketEndpointInfo *sk_proxy_endpoint_info(Socket *s, bool peer)
|
||||
{
|
||||
ProxySocket *ps = container_of(s, ProxySocket, sock);
|
||||
|
||||
/* We can't reliably find out where we ended up connecting _to_:
|
||||
* that's at the far end of the proxy, and might be anything. */
|
||||
if (peer)
|
||||
return NULL;
|
||||
|
||||
/* But we can at least tell where we're coming _from_. */
|
||||
return sk_endpoint_info(ps->sub_socket, false);
|
||||
}
|
||||
|
||||
static const SocketVtable ProxySocket_sockvt = {
|
||||
.plug = sk_proxy_plug,
|
||||
.close = sk_proxy_close,
|
||||
@ -423,7 +436,7 @@ static const SocketVtable ProxySocket_sockvt = {
|
||||
.write_eof = sk_proxy_write_eof,
|
||||
.set_frozen = sk_proxy_set_frozen,
|
||||
.socket_error = sk_proxy_socket_error,
|
||||
.peer_info = NULL,
|
||||
.endpoint_info = sk_proxy_endpoint_info,
|
||||
};
|
||||
|
||||
static const PlugVtable ProxySocket_plugvt = {
|
||||
|
@ -123,7 +123,7 @@ static const char *sshproxy_socket_error(Socket *s)
|
||||
return sp->errmsg;
|
||||
}
|
||||
|
||||
static SocketEndpointInfo *sshproxy_peer_info(Socket *s)
|
||||
static SocketEndpointInfo *sshproxy_endpoint_info(Socket *s, bool peer)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -136,7 +136,7 @@ static const SocketVtable SshProxy_sock_vt = {
|
||||
.write_eof = sshproxy_write_eof,
|
||||
.set_frozen = sshproxy_set_frozen,
|
||||
.socket_error = sshproxy_socket_error,
|
||||
.peer_info = sshproxy_peer_info,
|
||||
.endpoint_info = sshproxy_endpoint_info,
|
||||
};
|
||||
|
||||
static void sshproxy_eventlog(LogPolicy *lp, const char *event)
|
||||
|
Reference in New Issue
Block a user