mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-11 16:23:55 -05:00
Improve sk_peer_info.
Previously, it returned a human-readable string suitable for log files, which tried to say something useful about the remote end of a socket. Now it returns a whole SocketPeerInfo structure, of which that human-friendly log string is just one field, but also some of the same information - remote IP address and port, in particular - is provided in machine-readable form where it's available.
This commit is contained in:
@ -270,7 +270,7 @@ static const char *sk_handle_socket_error(Socket *s)
|
||||
return hs->error;
|
||||
}
|
||||
|
||||
static char *sk_handle_peer_info(Socket *s)
|
||||
static SocketPeerInfo *sk_handle_peer_info(Socket *s)
|
||||
{
|
||||
HandleSocket *hs = container_of(s, HandleSocket, sock);
|
||||
ULONG pid;
|
||||
@ -299,8 +299,14 @@ static char *sk_handle_peer_info(Socket *s)
|
||||
* to log what we can find out about the client end.
|
||||
*/
|
||||
if (p_GetNamedPipeClientProcessId &&
|
||||
p_GetNamedPipeClientProcessId(hs->send_H, &pid))
|
||||
return dupprintf("process id %lu", (unsigned long)pid);
|
||||
p_GetNamedPipeClientProcessId(hs->send_H, &pid)) {
|
||||
SocketPeerInfo *pi = snew(SocketPeerInfo);
|
||||
pi->addressfamily = ADDRTYPE_LOCAL;
|
||||
pi->addr_text = NULL;
|
||||
pi->port = -1;
|
||||
pi->log_text = dupprintf("process id %lu", (unsigned long)pid);
|
||||
return pi;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user