summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-07-21 09:13:12 +0000
committerRoger Dingledine <arma@torproject.org>2004-07-21 09:13:12 +0000
commitecc900925606c5e7b5ad538d38a789f5d2add0d2 (patch)
tree50ee96cc258845f4442248aca72cbe80e87aeff9
parent906d1aa99fa79a6e1f6cb16ab16bae1ab6cd9030 (diff)
downloadtor-ecc900925606c5e7b5ad538d38a789f5d2add0d2.tar.gz
tor-ecc900925606c5e7b5ad538d38a789f5d2add0d2.zip
authdirservers accept the uploading of unverified descriptors.
fix a bunch of bugs in router_update_status_from_smartlist() (Nick, did I get them all, or was there a trickier one still hiding?) svn:r2081
-rw-r--r--src/or/dirserv.c32
-rw-r--r--src/or/routerlist.c5
-rw-r--r--src/or/routerparse.c2
3 files changed, 21 insertions, 18 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 82e081b34e..66980b49ff 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -283,6 +283,7 @@ dirserv_add_descriptor(const char **desc)
const char *cp;
size_t desc_len;
time_t now;
+ int verified=1; /* whether we knew its fingerprint already */
if (!descriptor_list)
descriptor_list = smartlist_create();
@@ -311,23 +312,23 @@ dirserv_add_descriptor(const char **desc)
}
/* Okay. Now check whether the fingerprint is recognized. */
r = dirserv_router_fingerprint_is_known(ri);
- if(r<1) {
- if(r==0) {
- char fp[FINGERPRINT_LEN+1];
- log_fn(LOG_WARN, "Unknown nickname %s (%s:%d). Not adding.",
- ri->nickname, ri->address, ri->or_port);
- if (crypto_pk_get_fingerprint(ri->identity_pkey, fp) < 0) {
- log_fn(LOG_WARN, "Error computing fingerprint for %s", ri->nickname);
- } else {
- log_fn(LOG_WARN, "Fingerprint line: %s %s", ri->nickname, fp);
- }
- } else {
- log_fn(LOG_WARN, "Known nickname %s, wrong fingerprint. Not adding.", ri->nickname);
- }
+ if(r==-1) {
+ log_fn(LOG_WARN, "Known nickname %s, wrong fingerprint. Not adding.", ri->nickname);
routerinfo_free(ri);
*desc = end;
return 0;
}
+ if(r==0) {
+ char fp[FINGERPRINT_LEN+1];
+ log_fn(LOG_WARN, "Unknown nickname %s (%s:%d). Adding.",
+ ri->nickname, ri->address, ri->or_port);
+ if (crypto_pk_get_fingerprint(ri->identity_pkey, fp) < 0) {
+ log_fn(LOG_WARN, "Error computing fingerprint for %s", ri->nickname);
+ } else {
+ log_fn(LOG_WARN, "Fingerprint line: %s %s", ri->nickname, fp);
+ }
+ verified = 0;
+ }
/* Is there too much clock skew? */
now = time(NULL);
if (ri->published_on > now+ROUTER_ALLOW_SKEW) {
@@ -378,7 +379,8 @@ dirserv_add_descriptor(const char **desc)
strncpy(ent->descriptor, start, desc_len);
ent->descriptor[desc_len] = '\0';
ent->router = ri;
- ent->verified = 1; /* XXXX008 support other possibilities. */
+ /* XXX008 is ent->verified useful/used for anything? */
+ ent->verified = verified; /* XXXX008 support other possibilities. */
smartlist_add(descriptor_list, ent);
*desc = end;
@@ -705,7 +707,7 @@ static int generate_runningrouters(crypto_pk_env_t *private_key)
"directory-signature %s\n"
"-----BEGIN SIGNATURE-----\n",
published, cp, options.Nickname);
- free(cp);
+ tor_free(cp);
if (router_get_runningrouters_hash(s,digest)) {
log_fn(LOG_WARN,"couldn't compute digest");
return -1;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 2ba74d7eae..0139f3874f 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -836,16 +836,17 @@ void router_update_status_from_smartlist(routerinfo_t *router,
router->status_set_at = list_time;
router->is_running = 1;
}
- router->is_verified = (name[1] != '$');
+ router->is_verified = (name[0] != '$');
return;
}
} else { /* *name == '!' */
+ name++;
if (router_nickname_matches(router, name)) {
if (router->status_set_at < list_time) {
router->status_set_at = list_time;
router->is_running = 0;
}
- router->is_verified = (name[1] != '$');
+ router->is_verified = (name[0] != '$');
return;
}
}
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 3927a2a8e0..d25f2d17cd 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -561,7 +561,7 @@ static int check_directory_signature(const char *digest,
/** Given a string *<b>s</b> containing a concatenated sequence of router
* descriptors, parses them and stores the result in *<b>dest</b>. If
- * good_nickname_list is provided, then routers are mared as
+ * good_nickname_list is provided, then routers are marked as
* running/nonrunning and verified/unverified based on their status in the
* list. Otherwise, all routers are marked running and verified. Advances
* *s to a point immediately following the last router entry. Returns 0 on