From 339384238c2cd48c1bf4737a08a6faf700940a2f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 24 Dec 2006 04:09:42 +0000 Subject: [PATCH] r11693@Kushana: nickm | 2006-12-23 22:42:11 -0500 Stop requiring the "opt" keyword before unrecognized directory items. svn:r9180 --- ChangeLog | 2 ++ doc/TODO | 6 ++++- src/or/routerparse.c | 55 ++++++++------------------------------------ 3 files changed, 17 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6108ef19b9..e57bae908d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -48,6 +48,8 @@ Changes in version 0.1.2.5-xxxx - 200?-??-?? - We no longer look for identity and onion keys in "identity.key" and "onion.key" -- these were replaced by secret_id_key and secret_onion_key in 0.0.8pre1. + - We no longer require unrecognized directory entries to be preceded by + "opt". o Security bugfixes: - Stop sending the HttpProxyAuthenticator string to directory diff --git a/doc/TODO b/doc/TODO index 7ed870776c..703d8b164c 100644 --- a/doc/TODO +++ b/doc/TODO @@ -196,7 +196,11 @@ R - "bandwidth classes", for incoming vs initiated-here conns, - Stop requiring "opt" to ignore options in descriptors, networkstatuses, and so on. - Caches should start trying to cache consensus docs? - - Start uploading short and long descriptors? + - Start uploading short and long descriptors; authorities should support + URLs to retrieve long descriptors, and should discard short descriptors + for now. Later, once tools use the "long descriptor" URLs, authorities + will serve the short descriptors every time they're asked for + a descriptor. Topics to think about during 0.1.2.x development: * Figure out incentives. diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 874925d1a6..0a4184706f 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -467,11 +467,6 @@ router_parse_runningrouters(const char *str) if (tokenize_string(str,str+strlen(str),tokens,DIR)) { log_warn(LD_DIR, "Error tokenizing running-routers"); goto err; } - if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) { - log_warn(LD_DIR, "Unrecognized keyword %s; can't parse running-routers", - escaped(tok->args[0])); - goto err; - } tok = smartlist_get(tokens,0); if (tok->tp != K_NETWORK_STATUS) { log_warn(LD_DIR, "Network-status starts with wrong token"); @@ -759,13 +754,6 @@ router_parse_entry_from_string(const char *s, const char *end, log_warn(LD_DIR, "Impossibly short router descriptor."); goto err; } - if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) { - log_warn(LD_DIR, - "Unrecognized critical keyword %s; skipping descriptor. " - "(It may be from another version of Tor.)", - escaped(tok->args[0])); - goto err; - } tok = smartlist_get(tokens,0); if (tok->tp != K_ROUTER) { @@ -1018,11 +1006,6 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens) log_warn(LD_DIR, "Impossibly short router status"); goto err; } - if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) { - log_warn(LD_DIR, "Unrecognized keyword %s in router status; skipping.", - escaped(tok->args[0])); - goto err; - } if (!(tok = find_first_by_keyword(tokens, K_R))) { log_warn(LD_DIR, "Missing 'r' keywork in router status; skipping."); goto err; @@ -1156,11 +1139,6 @@ networkstatus_parse_from_string(const char *s) log_warn(LD_DIR, "Error tokenizing network-status header."); goto err; } - if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) { - log_warn(LD_DIR, "Unrecognized keyword %s; can't parse network-status", - escaped(tok->args[0])); - goto err; - } ns = tor_malloc_zero(sizeof(networkstatus_t)); memcpy(ns->networkstatus_digest, ns_digest, DIGEST_LEN); @@ -1629,29 +1607,16 @@ get_next_token(const char **s, where_syntax where) } } if (tok->tp == _ERR) { - if (is_opt) { - tok->tp = K_OPT; - *s = eat_whitespace_no_nl(next); - next = strchr(*s,'\n'); - if (!next) - RET_ERR("Unexpected EOF"); - tok->args = tor_malloc(sizeof(char*)); - tok->args[0] = tor_strndup(*s,next-*s); - tok->n_args = 1; - *s = eat_whitespace_no_nl(next+1); - o_syn = OBJ_OK; - } else { - tok->tp = _UNRECOGNIZED; - next = strchr(*s, '\n'); - if (!next) { - RET_ERR("Unexpected EOF"); - } - tok->args = tor_malloc(sizeof(char*)); - tok->args[0] = tor_strndup(*s,next-*s); - tok->n_args = 1; - *s = next+1; - o_syn = OBJ_OK; - } + tok->tp = K_OPT; + *s = eat_whitespace_no_nl(next); + next = strchr(*s,'\n'); + if (!next) + RET_ERR("Unexpected EOF"); + tok->args = tor_malloc(sizeof(char*)); + tok->args[0] = tor_strndup(*s,next-*s); + tok->n_args = 1; + *s = eat_whitespace_no_nl(next+1); + o_syn = OBJ_OK; } *s = eat_whitespace(*s); if (strcmpstart(*s, "-----BEGIN ")) {