diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-01-07 18:54:58 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-01-07 18:54:58 +0000 |
commit | a62ab48d30bc26ba761752269d0129fe159d477f (patch) | |
tree | f4a9ddef005cc484dc43f94274d2e6886382d0d1 | |
parent | dd35fe59c4ab562de32288cd984adeac2e931bb6 (diff) | |
download | tor-a62ab48d30bc26ba761752269d0129fe159d477f.tar.gz tor-a62ab48d30bc26ba761752269d0129fe159d477f.zip |
r17500@catbus: nickm | 2008-01-07 13:54:51 -0500
More messing about with bug 557 issues: do not let bizarre settings for myfamily or contactinfo muck with generated router descriptors.
svn:r13057
-rw-r--r-- | src/or/router.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/or/router.c b/src/or/router.c index c9482275c6..de4e5daf23 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1252,16 +1252,24 @@ router_rebuild_descriptor(int force) else member = router_get_by_nickname(name, 1); if (!member) { + int is_legal = is_legal_nickname_or_hexdigest(name); if (!smartlist_string_isin(warned_nonexistent_family, name) && !is_legal_hexdigest(name)) { - log_warn(LD_CONFIG, - "I have no descriptor for the router named \"%s\" " - "in my declared family; I'll use the nickname as is, but " - "this may confuse clients.", name); + if (is_legal) + log_warn(LD_CONFIG, + "I have no descriptor for the router named \"%s\" in my " + "declared family; I'll use the nickname as is, but " + "this may confuse clients.", name); + else + log_warn(LD_CONFIG, "There is a router named \"%s\" in my " + "declared family, but that isn't a legal nickname. " + "Skipping it.", escaped(name)); smartlist_add(warned_nonexistent_family, tor_strdup(name)); } - smartlist_add(ri->declared_family, name); - name = NULL; + if (is_legal) { + smartlist_add(ri->declared_family, name); + name = NULL; + } } else if (router_is_me(member)) { /* Don't list ourself in our own family; that's redundant */ } else { @@ -1621,8 +1629,10 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, written = result; if (options->ContactInfo && strlen(options->ContactInfo)) { - result = tor_snprintf(s+written,maxlen-written, "contact %s\n", - options->ContactInfo); + const char *ci = options->ContactInfo; + if (strchr(ci, '\n') || strchr(ci, '\r')) + ci = escaped(ci); + result = tor_snprintf(s+written,maxlen-written, "contact %s\n", ci); if (result<0) { log_warn(LD_BUG,"descriptor snprintf #2 ran out of room!"); return -1; |