Add PURPOSE= field to getinfo circuit-status. With luck, controllers are ignoring extra fields (like they are supposed to) and this will not break any controllers.

svn:r17245
This commit is contained in:
Nick Mathewson 2008-11-11 15:59:24 +00:00
parent a95e0e7355
commit e08cbe2029
2 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,9 @@ Changes in version 0.2.1.8-alpha - 2008-??-??
- Get file locking working on win32. Bugfix on 0.2.1.6-alpha. Fixes - Get file locking working on win32. Bugfix on 0.2.1.6-alpha. Fixes
bug 859. bug 859.
o Minor features (controller):
- Return circuit purposes in response to GETINFO circuit-status. Fixes
bug 858.
Changes in version 0.2.1.7-alpha - 2008-11-08 Changes in version 0.2.1.7-alpha - 2008-11-08
o Security fixes: o Security fixes:

View File

@ -1631,6 +1631,7 @@ getinfo_helper_events(control_connection_t *control_conn,
char *s, *path; char *s, *path;
size_t slen; size_t slen;
const char *state; const char *state;
const char *purpose;
if (! CIRCUIT_IS_ORIGIN(circ) || circ->marked_for_close) if (! CIRCUIT_IS_ORIGIN(circ) || circ->marked_for_close)
continue; continue;
if (control_conn->use_long_names) if (control_conn->use_long_names)
@ -1644,11 +1645,12 @@ getinfo_helper_events(control_connection_t *control_conn,
else else
state = "LAUNCHED"; state = "LAUNCHED";
slen = strlen(path)+strlen(state)+20; purpose = circuit_purpose_to_controller_string(circ->purpose);
slen = strlen(path)+strlen(state)+strlen(purpose)+30;
s = tor_malloc(slen+1); s = tor_malloc(slen+1);
tor_snprintf(s, slen, "%lu %s%s%s", tor_snprintf(s, slen, "%lu %s%s%s PURPOSE=%s",
(unsigned long)TO_ORIGIN_CIRCUIT(circ)->global_identifier, (unsigned long)TO_ORIGIN_CIRCUIT(circ)->global_identifier,
state, *path ? " " : "", path); state, *path ? " " : "", path, purpose);
smartlist_add(status, s); smartlist_add(status, s);
tor_free(path); tor_free(path);
} }