mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
if we fetch the dir from a mirror that has a wildly skewed
clock, then don't bother checking recommended-versions: it will just make us sad. as a side effect, people running obsolete versions and whose clocks are wildly skewed will not be auto-shut-down. but they will still get warns about their clock skew. svn:r3459
This commit is contained in:
parent
191e52179c
commit
d273891107
@ -592,6 +592,7 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
int delta;
|
||||
int compression;
|
||||
int plausible;
|
||||
int skewed=0;
|
||||
|
||||
switch (fetch_from_buf_http(conn->inbuf,
|
||||
&headers, MAX_HEADERS_SIZE,
|
||||
@ -621,6 +622,7 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
conn->address,
|
||||
abs(delta)/60, delta>0 ? "ahead" : "behind",
|
||||
abs(delta)/60, delta>0 ? "behind" : "ahead");
|
||||
skewed = 1; /* don't check the recommended-versions line */
|
||||
} else {
|
||||
log_fn(LOG_INFO, "Time on received directory is within tolerance; we are %d seconds skewed. (That's okay.)", delta);
|
||||
}
|
||||
@ -692,9 +694,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
tor_free(body); tor_free(headers);
|
||||
return -1;
|
||||
}
|
||||
/* xxx maybe we can tell router_... here that it was skewed so don't believe it all. */
|
||||
if (router_load_routerlist_from_directory(body, NULL, 1, 0) < 0) {
|
||||
log_fn(LOG_WARN,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
|
||||
if (router_load_routerlist_from_directory(body, NULL, skewed, 0) < 0) {
|
||||
log_fn(LOG_NOTICE,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
|
||||
} else {
|
||||
log_fn(LOG_INFO,"updated routers.");
|
||||
}
|
||||
|
@ -843,7 +843,11 @@ routerlist_remove_old_routers(int age)
|
||||
* signed directory <b>s</b>. If pkey is provided, check the signature against
|
||||
* pkey; else check against the pkey of the signing directory server.
|
||||
*
|
||||
* DOCDOC dir_is_recent/cached
|
||||
* If <b>dir_is_recent</b> is non-zero, then examine the
|
||||
* Recommended-versions line and take appropriate action.
|
||||
*
|
||||
* If <b>dir_is_cached</b> is non-zero, then we're reading it
|
||||
* from the cache so don't bother to re-write it to the cache.
|
||||
*/
|
||||
int router_load_routerlist_from_directory(const char *s,
|
||||
crypto_pk_env_t *pkey,
|
||||
|
@ -289,10 +289,17 @@ int check_software_version_against_directory(const char *directory,
|
||||
}
|
||||
|
||||
/** Parse a directory from <b>str</b> and, when done, store the
|
||||
* resulting routerlist in *<b>dest</b>, freeing the old value if necessary.
|
||||
* resulting routerlist in *<b>dest</b>, freeing the old value if
|
||||
* necessary.
|
||||
*
|
||||
* If <b>pkey</b> is provided, we check the directory signature with pkey.
|
||||
*
|
||||
* DOCDOC check_version, write_to_cache.
|
||||
* If <b>check_version</b> is non-zero, then examine the
|
||||
* Recommended-versions * line in the directory, and warn or quit
|
||||
* as needed.
|
||||
*
|
||||
* If <b>write_to_cache</b> is non-zero, then store this directory in
|
||||
* memory and/or disk as well.
|
||||
*/
|
||||
int /* Should be static; exposed for unit tests */
|
||||
router_parse_routerlist_from_directory(const char *str,
|
||||
|
Loading…
Reference in New Issue
Block a user