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

[or-cvs] r13078: our defensive programming plan hid a bug. switch to offensiv (tor/trunk/src/or)



Author: arma
Date: 2008-01-08 18:35:03 -0500 (Tue, 08 Jan 2008)
New Revision: 13078

Modified:
   tor/trunk/src/or/router.c
Log:
our defensive programming plan hid a bug. switch to offensive programming.


Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2008-01-08 23:31:25 UTC (rev 13077)
+++ tor/trunk/src/or/router.c	2008-01-08 23:35:03 UTC (rev 13078)
@@ -565,20 +565,20 @@
                            v3_digest,
                            type);
   }
-  if ((ds = router_get_trusteddirserver_by_digest(digest))) {
-    if (ds->type != type) {
-      log_warn(LD_DIR,  "Configured authority type does not match authority "
-               "type in DirServer list.  Adjusting. (%d v %d)",
-               type, ds->type);
-      ds->type = type;
-    }
-    if (v3_digest_set && (ds->type & V3_AUTHORITY) &&
-        memcmp(v3_digest, ds->v3_identity_digest, DIGEST_LEN)) {
-      log_warn(LD_DIR, "V3 identity key does not match identity declared in "
-               "DirServer line.  Adjusting.");
-      memcpy(ds->v3_identity_digest, v3_digest, DIGEST_LEN);
-    }
+  ds = router_get_trusteddirserver_by_digest(digest);
+  tor_assert(ds);
+  if (ds->type != type) {
+    log_warn(LD_DIR,  "Configured authority type does not match authority "
+             "type in DirServer list.  Adjusting. (%d v %d)",
+             type, ds->type);
+    ds->type = type;
   }
+  if (v3_digest_set && (ds->type & V3_AUTHORITY) &&
+      memcmp(v3_digest, ds->v3_identity_digest, DIGEST_LEN)) {
+    log_warn(LD_DIR, "V3 identity key does not match identity declared in "
+             "DirServer line.  Adjusting.");
+    memcpy(ds->v3_identity_digest, v3_digest, DIGEST_LEN);
+  }
 
   return 0; /* success */
 }