Browse Source

r15862@catbus: nickm | 2007-10-16 13:19:29 -0400
Correct mismatches between DirServer lines and authority configuration.


svn:r11992

Nick Mathewson 18 years ago
parent
commit
29173560b8
2 changed files with 21 additions and 0 deletions
  1. 3 0
      ChangeLog
  2. 18 0
      src/or/router.c

+ 3 - 0
ChangeLog

@@ -26,6 +26,9 @@ Changes in version 0.2.0.9-alpha - 2007-10-??
     - Correctly check for bad options to the "PublishServerDescriptor"
     - Correctly check for bad options to the "PublishServerDescriptor"
       config option. Bugfix on 0.2.0.1-alpha; reported by Matt Edman.
       config option. Bugfix on 0.2.0.1-alpha; reported by Matt Edman.
     - When we discard a vote as a duplicate, do not report this as an error.
     - When we discard a vote as a duplicate, do not report this as an error.
+    - When we're configured to be a v3 authority, but we're only listed
+      as a non-v3 authority in our DirServer line for ourself, correct the
+      listing.
 
 
   o Minor bugfixes (memory leaks):
   o Minor bugfixes (memory leaks):
     - Stop leaking memory on failing case of base32_decode.  Bugfix on
     - Stop leaking memory on failing case of base32_decode.  Bugfix on

+ 18 - 0
src/or/router.c

@@ -384,6 +384,8 @@ init_keys(void)
   or_options_t *options = get_options();
   or_options_t *options = get_options();
   authority_type_t type;
   authority_type_t type;
   time_t now = time(NULL);
   time_t now = time(NULL);
+  trusted_dir_server_t *ds;
+  int v3_digest_set = 0;
 
 
   if (!key_lock)
   if (!key_lock)
     key_lock = tor_mutex_new();
     key_lock = tor_mutex_new();
@@ -423,6 +425,7 @@ init_keys(void)
     if (get_my_v3_authority_cert()) {
     if (get_my_v3_authority_cert()) {
       crypto_pk_get_digest(get_my_v3_authority_cert()->identity_key,
       crypto_pk_get_digest(get_my_v3_authority_cert()->identity_key,
                            v3_digest);
                            v3_digest);
+      v3_digest_set = 1;
     }
     }
   }
   }
 
 
@@ -550,6 +553,21 @@ init_keys(void)
                            v3_digest,
                            v3_digest,
                            type);
                            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);
+    }
+  }
+
   return 0; /* success */
   return 0; /* success */
 }
 }