mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Fix some more bugs; add a temporary log.
svn:r4936
This commit is contained in:
parent
eab005c948
commit
1e2f1679c8
@ -175,11 +175,14 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
|
||||
|
||||
if (directconn) {
|
||||
if (fetch_fresh_first && purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS &&
|
||||
strlen(resource) == HEX_DIGEST_LEN) {
|
||||
!strcmpstart(resource,"fp/") && strlen(resource) == HEX_DIGEST_LEN+3) {
|
||||
/* Try to ask the actual dirserver its opinion. */
|
||||
char digest[DIGEST_LEN];
|
||||
base16_decode(digest, DIGEST_LEN, resource, HEX_DIGEST_LEN);
|
||||
base16_decode(digest, DIGEST_LEN, resource+3, HEX_DIGEST_LEN);
|
||||
ds = router_get_trusteddirserver_by_digest(digest);
|
||||
// XXXXX NM remove this.
|
||||
log_fn(LOG_NOTICE, "Going straight to the authority for %s? %s",resource,
|
||||
ds? "Ok.":"Oops. I can't.");
|
||||
}
|
||||
if (!ds && fetch_fresh_first) {
|
||||
/* only ask authdirservers, and don't ask myself */
|
||||
@ -450,6 +453,7 @@ directory_send_command(connection_t *conn, const char *platform,
|
||||
httpcommand = "GET";//XXXX
|
||||
len = strlen(resource)+32;
|
||||
url = tor_malloc(len);
|
||||
log_fn(LOG_NOTICE, "Asking for %s", resource);
|
||||
tor_snprintf(url, len, "/tor/status/%s", resource);
|
||||
break;
|
||||
case DIR_PURPOSE_FETCH_SERVERDESC:
|
||||
@ -884,7 +888,7 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
|
||||
/* XXXX NM We *must* make certain we get the one(s) we asked for or we
|
||||
* could be partitioned. */
|
||||
log_fn(LOG_INFO,"Received networkstatus objects (size %d)",(int) body_len);
|
||||
log_fn(LOG_INFO,"Received networkstatus objects (size %d) from server '%s'",(int) body_len, conn->address);
|
||||
if (status_code != 200) {
|
||||
log_fn(LOG_WARN,"Received http status code %d (\"%s\") from server '%s'. Failing.",
|
||||
status_code, reason, conn->address);
|
||||
|
@ -896,7 +896,8 @@ networkstatus_free(networkstatus_t *ns)
|
||||
{
|
||||
tor_free(ns->source_address);
|
||||
tor_free(ns->contact);
|
||||
crypto_free_pk_env(ns->signing_key);
|
||||
if (ns->signing_key)
|
||||
crypto_free_pk_env(ns->signing_key);
|
||||
tor_free(ns->client_versions);
|
||||
tor_free(ns->server_versions);
|
||||
if (ns->entries) {
|
||||
@ -1207,6 +1208,8 @@ router_set_networkstatus(const char *s, time_t arrived_at, int is_cached)
|
||||
time_t now;
|
||||
char fp[HEX_DIGEST_LEN+1];
|
||||
|
||||
log_fn(LOG_NOTICE, "setting status (%d)", is_cached);
|
||||
|
||||
ns = networkstatus_parse_from_string(s);
|
||||
if (!ns) {
|
||||
log_fn(LOG_WARN, "Couldn't parse network status.");
|
||||
@ -1330,12 +1333,13 @@ update_networkstatus_downloads(void)
|
||||
/* XXXX NM This could compress multiple downloads into a single request.
|
||||
* It could also be smarter on failures. */
|
||||
for (i = most_recent_idx+1; needed; ++i) {
|
||||
char resource[HEX_DIGEST_LEN+1];
|
||||
char resource[HEX_DIGEST_LEN+4];
|
||||
trusted_dir_server_t *ds;
|
||||
if (i >= n_dirservers)
|
||||
i = 0;
|
||||
ds = smartlist_get(trusted_dir_servers, i);
|
||||
base16_encode(resource, sizeof(resource), ds->digest, DIGEST_LEN);
|
||||
strlcpy(resource, "fp/", sizeof(resource));
|
||||
base16_encode(resource+3, sizeof(resource)-3, ds->digest, DIGEST_LEN);
|
||||
directory_get_from_dirserver(DIR_PURPOSE_FETCH_NETWORKSTATUS, resource, 1);
|
||||
--needed;
|
||||
}
|
||||
|
@ -1212,7 +1212,7 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (tor_inet_aton(tok->args[5], &in) != 0) {
|
||||
if (tor_inet_aton(tok->args[5], &in) == 0) {
|
||||
log_fn(LOG_WARN, "Error parsing address '%s'", tok->args[5]);
|
||||
goto err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user