mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -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:
@ -830,7 +830,7 @@ static int pageant_listen_accepting(Plug *plug,
|
||||
plug, struct pageant_listen_state, plug);
|
||||
struct pageant_conn_state *pc;
|
||||
const char *err;
|
||||
char *peerinfo;
|
||||
SocketPeerInfo *peerinfo;
|
||||
|
||||
pc = snew(struct pageant_conn_state);
|
||||
pc->plug.vt = &pageant_connection_plugvt;
|
||||
@ -848,12 +848,13 @@ static int pageant_listen_accepting(Plug *plug,
|
||||
sk_set_frozen(pc->connsock, 0);
|
||||
|
||||
peerinfo = sk_peer_info(pc->connsock);
|
||||
if (peerinfo) {
|
||||
if (peerinfo && peerinfo->log_text) {
|
||||
plog(pl->logctx, pl->logfn, "%p: new connection from %s",
|
||||
pc, peerinfo);
|
||||
pc, peerinfo->log_text);
|
||||
} else {
|
||||
plog(pl->logctx, pl->logfn, "%p: new connection", pc);
|
||||
}
|
||||
sk_free_peer_info(peerinfo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user