]> asedeno.scripts.mit.edu Git - PuTTY.git/commit - windows/winnet.c
Log identifying information for the other end of connections.
authorSimon Tatham <anakin@pobox.com>
Mon, 18 May 2015 12:57:45 +0000 (13:57 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 20 Jun 2015 11:47:02 +0000 (12:47 +0100)
commit41f63b6e5dc8ff83306287ae702d875edff4586f
tree1717d3391dcb5c7bd1be6e086fce728906bd9a52
parent3ba1a7cf4b469ceded01c33ec5b76b7e8714d035
Log identifying information for the other end of connections.

When anyone connects to a PuTTY tool's listening socket - whether it's
a user of a local->remote port forwarding, a connection-sharing
downstream or a client of Pageant - we'd like to log as much
information as we can find out about where the connection came from.

To that end, I've implemented a function sk_peer_info() in the socket
abstraction, which returns a freeform text string as best it can (or
NULL, if it can't get anything at all) describing the thing at the
other end of the connection. For TCP connections, this is done using
getpeername() to get an IP address and port in the obvious way; for
Unix-domain sockets, we attempt SO_PEERCRED (conditionalised on some
moderately hairy autoconfery) to get the pid and owner of the peer. I
haven't implemented anything for Windows named pipes, but I will if I
hear of anything useful.

(cherry picked from commit c8f83979a368d10e8def1796cdadd7f8f3bebf74)

Conflicts:
pageant.c

Cherry-picker's notes: the conflict was because the original commit
also added a use of the same feature in the centralised Pageant code,
which doesn't exist on this branch. Also I had to remove 'const' from
the type of the second parameter to wrap_send_port_open(), since this
branch hasn't had the same extensive const-fixing as master.
16 files changed:
Recipe
configure.ac
errsock.c
network.h
portfwd.c
proxy.c
ssh.c
ssh.h
sshshare.c
unix/unix.h
unix/uxnet.c
unix/uxpeer.c [new file with mode: 0644]
unix/uxproxy.c
windows/winhsock.c
windows/winnet.c
windows/winnps.c