[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Clean up some more fingerprint-checking logic
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv23892/src/or
Modified Files:
directory.c routerlist.c
Log Message:
Clean up some more fingerprint-checking logic
Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/directory.c,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- directory.c 8 Sep 2005 21:28:45 -0000 1.265
+++ directory.c 8 Sep 2005 21:39:39 -0000 1.266
@@ -899,8 +899,12 @@
}
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) {
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.279
retrieving revision 1.280
diff -u -d -r1.279 -r1.280
--- routerlist.c 8 Sep 2005 21:12:53 -0000 1.279
+++ routerlist.c 8 Sep 2005 21:39:39 -0000 1.280
@@ -1247,7 +1247,9 @@
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 @@
}
}
-
/*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 @@
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);