diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-07-13 14:47:58 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-07-16 09:02:10 -0400 |
commit | aa33b88778c2eda110eb79cfe887621853010287 (patch) | |
tree | e1846d27b24745c95f8d917b7fa26bb33a1d1d3c /src/core/mainloop | |
parent | 8fbafd14021c9c9ec9b2e3f57752b96b8d2c809d (diff) | |
download | tor-aa33b88778c2eda110eb79cfe887621853010287.tar.gz tor-aa33b88778c2eda110eb79cfe887621853010287.zip |
connection_describe_peer(): add nonzero ports to nonscrubbed addrs.
Diffstat (limited to 'src/core/mainloop')
-rw-r--r-- | src/core/mainloop/connection.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c index bde002fd2e..a3cebfecdd 100644 --- 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; } |