diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-11-09 18:22:17 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-11-09 18:22:17 +0000 |
commit | cd753df7bf741f5063d672afaf23390ebbd55c48 (patch) | |
tree | 9434a2526b72f8d577f87a3991a14827e705217b /src/or/routerparse.c | |
parent | b9605745566610dddf51be3c1b4018961d0ab3ca (diff) | |
download | tor-cd753df7bf741f5063d672afaf23390ebbd55c48.tar.gz tor-cd753df7bf741f5063d672afaf23390ebbd55c48.zip |
Resolve many XXXs and all DOCDOCs
svn:r2755
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 27e59ea9fa..59b4fac277 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -345,12 +345,6 @@ router_parse_routerlist_from_directory(const char *str, smartlist_free(tokens); tokens = NULL; - if(!get_options()->AuthoritativeDir) { - /* Now that we know the signature is okay, cache the directory. */ - /* XXXX009 extract published time if possible. */ - dirserv_set_cached_directory(str, time(NULL)); - } - /* Now that we know the signature is okay, check the version. */ if (check_version) check_software_version_against_directory(str, get_options()->IgnoreVersion); @@ -393,6 +387,12 @@ router_parse_routerlist_from_directory(const char *str, goto err; } + if(!get_options()->AuthoritativeDir) { + /* Now that we know the signature is okay, and we have a + * publication time, cache the directory. */ + dirserv_set_cached_directory(str, published_on); + } + if (!(tok = find_first_by_keyword(tokens, K_RECOMMENDED_SOFTWARE))) { log_fn(LOG_WARN, "Missing recommended-software line from directory."); goto err; @@ -863,14 +863,22 @@ routerinfo_t *router_parse_entry_from_string(const char *s, if (!(tok = find_first_by_keyword(tokens, K_ONION_KEY))) { log_fn(LOG_WARN, "Missing onion key"); goto err; } - /* XXX Check key length */ + if (crypto_pk_keysize(tok->key) != PK_BYTES) { + log_fn(LOG_WARN, "Wrong size on onion key: %d bits!", + crypto_pk_keysize(tok->key)*8); + goto err; + } router->onion_pkey = tok->key; tok->key = NULL; /* Prevent free */ if (!(tok = find_first_by_keyword(tokens, K_SIGNING_KEY))) { log_fn(LOG_WARN, "Missing identity key"); goto err; } - /* XXX Check key length */ + if (crypto_pk_keysize(tok->key) != PK_BYTES) { + log_fn(LOG_WARN, "Wrong size on identity key: %d bits!", + crypto_pk_keysize(tok->key)*8); + goto err; + } router->identity_pkey = tok->key; tok->key = NULL; /* Prevent free */ if (crypto_pk_get_digest(router->identity_pkey,router->identity_digest)){ @@ -1420,7 +1428,8 @@ int tor_version_as_new_as(const char *platform, const char *cutoff) { return tor_version_compare(&router_version, &cutoff_version) >= 0; } -/** DOCDOC */ +/** Parse a tor version from <b>s</b>, and store the result in <b>out</b>. + * Return 0 on success, -1 on failure. */ int tor_version_parse(const char *s, tor_version_t *out) { char *eos=NULL, *cp=NULL; |