summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorArthur Edelstein <arthuredelstein@gmail.com>2014-07-15 21:27:59 -0700
committerNick Mathewson <nickm@torproject.org>2015-01-28 12:02:15 -0500
commitcb714d896c4436f80bca9e82fc978a245d802eb3 (patch)
treea9840a033370a1bb3c35c93eaded1114855db84b /src/or
parentf75ca04520f9494e10ea8c4a5de584270efa3462 (diff)
downloadtor-cb714d896c4436f80bca9e82fc978a245d802eb3.tar.gz
tor-cb714d896c4436f80bca9e82fc978a245d802eb3.zip
Bug #8405: Report SOCKS username/password in CIRC status events
Introduces two new circuit status name-value parameters: SOCKS_USERNAME and SOCKS_PASSWORD. Values are enclosing in quotes and unusual characters are escaped. Example: 650 CIRC 5 EXTENDED [...] SOCKS_USERNAME="my_username" SOCKS_PASSWORD="my_password"
Diffstat (limited to 'src/or')
-rw-r--r--src/or/control.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 00cb4311fb..e963aeab7f 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1882,6 +1882,20 @@ circuit_describe_status_for_controller(origin_circuit_t *circ)
smartlist_add_asprintf(descparts, "TIME_CREATED=%s", tbuf);
}
+ // Show username and/or password if available.
+ if (circ->socks_username_len > 0) {
+ char* socks_username_escaped = esc_for_log_len(circ->socks_username,
+ (size_t) circ->socks_username_len);
+ smartlist_add_asprintf(descparts, "SOCKS_USERNAME=%s", socks_username_escaped);
+ tor_free(socks_username_escaped);
+ }
+ if (circ->socks_password_len > 0) {
+ char* socks_password_escaped = esc_for_log_len(circ->socks_password,
+ (size_t) circ->socks_password_len);
+ smartlist_add_asprintf(descparts, "SOCKS_PASSWORD=%s", socks_password_escaped);
+ tor_free(socks_password_escaped);
+ }
+
rv = smartlist_join_strings(descparts, " ", 0, NULL);
SMARTLIST_FOREACH(descparts, char *, cp, tor_free(cp));