mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 14:02:47 -05:00
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.
This commit is contained in:
9
ssh.c
9
ssh.c
@ -7746,9 +7746,14 @@ static void ssh_check_termination(Ssh ssh)
|
||||
}
|
||||
}
|
||||
|
||||
void ssh_sharing_downstream_connected(Ssh ssh, unsigned id)
|
||||
void ssh_sharing_downstream_connected(Ssh ssh, unsigned id,
|
||||
const char *peerinfo)
|
||||
{
|
||||
logeventf(ssh, "Connection sharing downstream #%u connected", id);
|
||||
if (peerinfo)
|
||||
logeventf(ssh, "Connection sharing downstream #%u connected from %s",
|
||||
id, peerinfo);
|
||||
else
|
||||
logeventf(ssh, "Connection sharing downstream #%u connected", id);
|
||||
}
|
||||
|
||||
void ssh_sharing_downstream_disconnected(Ssh ssh, unsigned id)
|
||||
|
Reference in New Issue
Block a user