[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] authdirservers accept the uploading of unverified descripto...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	dirserv.c routerlist.c routerparse.c 
Log Message:
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?)


Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- dirserv.c	20 Jul 2004 10:17:43 -0000	1.61
+++ dirserv.c	21 Jul 2004 09:13:12 -0000	1.62
@@ -283,6 +283,7 @@
   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 @@
   }
   /* 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 @@
   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 @@
              "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;

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- routerlist.c	21 Jul 2004 07:50:06 -0000	1.102
+++ routerlist.c	21 Jul 2004 09:13:12 -0000	1.103
@@ -836,16 +836,17 @@
           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;
       }
     }

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- routerparse.c	20 Jul 2004 10:17:43 -0000	1.15
+++ routerparse.c	21 Jul 2004 09:13:12 -0000	1.16
@@ -561,7 +561,7 @@
 
 /** 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