diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-07-25 22:57:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-07-25 22:57:02 +0000 |
commit | 025a81fc18428800d60b6a5093628cec5aaa8dad (patch) | |
tree | 155c7744580515e8517d9aee2f9dd4f4fc0e9fc2 /src/or/control.c | |
parent | 5b821883332a9d557e85ae07c69e77cc9a0d0165 (diff) | |
download | tor-025a81fc18428800d60b6a5093628cec5aaa8dad.tar.gz tor-025a81fc18428800d60b6a5093628cec5aaa8dad.zip |
r13907@catbus: nickm | 2007-07-25 18:51:25 -0400
Patch from tup: translate LFs to CRLFs in NS replies and
ensures the data section is properly terminated with "\r\n.\r\n
svn:r10932
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/or/control.c b/src/or/control.c index d99fb4b8c6..45ef63be73 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3159,7 +3159,7 @@ int control_event_networkstatus_changed(smartlist_t *statuses) { smartlist_t *strs; - char *s; + char *s, *esc = NULL; if (!EVENT_IS_INTERESTING(EVENT_NS) || !smartlist_len(statuses)) return 0; @@ -3171,17 +3171,14 @@ control_event_networkstatus_changed(smartlist_t *statuses) if (!s) continue; smartlist_add(strs, s); }); - smartlist_add(strs, tor_strdup("\r\n.\r\n")); - /* XXX020 the above strdup has an extra \r\n in it, resulting in - * a blank line in the NS output. Can we remove it, or is that - * bad since the output of networkstatus_getinfo_helper_single() - * only adds \n, not \r\n? */ s = smartlist_join_strings(strs, "", 0, NULL); + write_escaped_data(s, strlen(s), 1, &esc); SMARTLIST_FOREACH(strs, char *, cp, tor_free(cp)); smartlist_free(strs); - send_control_event_string(EVENT_NS, ALL_NAMES|ALL_FORMATS, s); tor_free(s); + send_control_event_string(EVENT_NS, ALL_NAMES|ALL_FORMATS, esc); + tor_free(esc); return 0; } |