]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
prop250: Only trust known authority when computing SRV
authorDavid Goulet <dgoulet@torproject.org>
Wed, 11 May 2016 20:02:18 +0000 (16:02 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Fri, 1 Jul 2016 18:01:41 +0000 (14:01 -0400)
Signed-off-by: David Goulet <dgoulet@torproject.org>
src/or/shared_random.c

index 6e6ff3baa37804937ed4a1f5b06af7e927724843..d409d109ac383ca3bd2c4df2bc293571acd44a9a 100644 (file)
@@ -951,6 +951,16 @@ sr_compute_srv(void)
   DIGESTMAP_FOREACH(state_commits, key, sr_commit_t *, c) {
     /* Extra safety net, make sure we have valid commit before using it. */
     ASSERT_COMMIT_VALID(c);
+    /* Let's not use a commit from an authority that we don't know. It's
+     * possible that an authority could be removed during a protocol run so
+     * that commit value should never be used in the SRV computation. */
+    if (trusteddirserver_get_by_v3_auth_digest(c->rsa_identity) == NULL) {
+      log_warn(LD_DIR, "SR: Fingerprint %s is not from a recognized "
+               "authority. Discarding commit for the SRV computation.",
+               sr_commit_get_rsa_fpr(c));
+      continue;
+    }
+    /* We consider this commit valid. */
     smartlist_add(commits, c);
   } DIGESTMAP_FOREACH_END;
   smartlist_sort(commits, compare_reveal_);