mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -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:
14
portfwd.c
14
portfwd.c
@ -153,18 +153,18 @@ static SshChannel *wrap_lportfwd_open(
|
||||
ConnectionLayer *cl, const char *hostname, int port,
|
||||
Socket *s, Channel *chan)
|
||||
{
|
||||
char *peerinfo, *description;
|
||||
SocketPeerInfo *pi;
|
||||
char *description;
|
||||
SshChannel *toret;
|
||||
|
||||
peerinfo = sk_peer_info(s);
|
||||
if (peerinfo) {
|
||||
description = dupprintf("forwarding from %s", peerinfo);
|
||||
sfree(peerinfo);
|
||||
pi = sk_peer_info(s);
|
||||
if (pi && pi->log_text) {
|
||||
description = dupprintf("forwarding from %s", pi->log_text);
|
||||
} else {
|
||||
description = dupstr("forwarding");
|
||||
}
|
||||
|
||||
toret = ssh_lportfwd_open(cl, hostname, port, description, chan);
|
||||
toret = ssh_lportfwd_open(cl, hostname, port, description, pi, chan);
|
||||
sk_free_peer_info(pi);
|
||||
|
||||
sfree(description);
|
||||
return toret;
|
||||
|
Reference in New Issue
Block a user