tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit aa33b88778c2eda110eb79cfe887621853010287
parent 8fbafd14021c9c9ec9b2e3f57752b96b8d2c809d
Author: Nick Mathewson <nickm@torproject.org>
Date:   Mon, 13 Jul 2020 14:47:58 -0400

connection_describe_peer(): add nonzero ports to nonscrubbed addrs.

Diffstat:
Msrc/core/mainloop/connection.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c @@ -461,8 +461,15 @@ connection_describe_peer_internal(const connection_t *conn, } } - if (scrub) { - address = safe_str(address); + char portbuf[7]; + portbuf[0]=0; + if (scrub && get_options()->SafeLogging_ != SAFELOG_SCRUB_NONE) { + address = "[scrubbed]"; + } else { + /* Only set the port if we're not scrubbing the address. */ + if (conn->port != 0) { + tor_snprintf(portbuf, sizeof(portbuf), ":%d", conn->port); + } } const char *sp = include_preposition ? " " : ""; @@ -470,7 +477,7 @@ connection_describe_peer_internal(const connection_t *conn, prep = ""; tor_snprintf(peer_buf, sizeof(peer_buf), - "%s%s%s%s", prep, sp, address, extra_buf); + "%s%s%s%s%s", prep, sp, address, portbuf, extra_buf); return peer_buf; }