summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-08 21:39:39 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-08 21:39:39 +0000
commitd410c49965f4f31b2bf79aaebd7d82741d8c229c (patch)
treeec77b4e96b21a31b262c555311cc39f695c44b2b
parent587b513ec0a3edb20b326254c4b4defa8861d4bb (diff)
downloadtor-d410c49965f4f31b2bf79aaebd7d82741d8c229c.tar.gz
tor-d410c49965f4f31b2bf79aaebd7d82741d8c229c.zip
Clean up some more fingerprint-checking logic
svn:r4954
-rw-r--r--src/or/directory.c4
-rw-r--r--src/or/routerlist.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index e3ae92cd71..25132aeb73 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -899,8 +899,12 @@ connection_dir_client_reached_eof(connection_t *conn)
}
if (conn->requested_resource &&
!strcmpstart(conn->requested_resource,"fp/")) {
+ int n;
which = smartlist_create();
smartlist_split_string(which, conn->requested_resource+3, "+", 0, -1);
+ n = smartlist_len(which);
+ if (n && strlen(smartlist_get(which,n-1))==HEX_DIGEST_LEN+2)
+ ((char*)smartlist_get(which,n-1))[HEX_DIGEST_LEN] = '\0';
}
cp = body;
while (*cp) {
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 9cbfd71de2..d7bf5fbaca 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1247,7 +1247,9 @@ router_set_networkstatus(const char *s, time_t arrived_at,
if (requested_fingerprints &&
!smartlist_string_isin(requested_fingerprints, fp)) {
- log_fn(LOG_WARN, "We received a network status with a fingerprint (%s) that we never requested. Dropping.", fp);
+ char *requested = smartlist_join_strings(requested_fingerprints," ",0,NULL);
+ log_fn(LOG_WARN, "We received a network status with a fingerprint (%s) that we never requested. (%s) Dropping.", fp, requested);
+ tor_free(requested);
return 0;
}
@@ -1333,7 +1335,6 @@ update_networkstatus_cache_downloads(time_t now)
}
}
-
/*XXXX Should these be configurable? NM*/
/** How old (in seconds) can a network-status be before we stop believing it? */
#define NETWORKSTATUS_MAX_VALIDITY (48*60*60)
@@ -1405,8 +1406,9 @@ update_networkstatus_client_downloads(time_t now)
ds = smartlist_get(trusted_dir_servers, i);
base16_encode(cp, HEX_DIGEST_LEN+1, ds->digest, DIGEST_LEN);
cp += HEX_DIGEST_LEN;
- *cp++ = '+';
--needed;
+ if (needed)
+ *cp++ = '+';
}
memcpy(cp, ".z", 3);
directory_get_from_dirserver(DIR_PURPOSE_FETCH_NETWORKSTATUS, resource, 1);