[tor-commits] [tor/master] Rename a verified unverified-consensus to cached-consensus on the disk

nickm at torproject.org nickm at torproject.org
Sat Mar 3 17:03:52 UTC 2018


commit 1c8f55310f6a9969dc8ae5e8566e971fd2ac50b4
Author: Deepesh Pathak <deepshpathak at gmail.com>
Date:   Sat Feb 3 06:45:52 2018 +0530

    Rename a verified unverified-consensus to cached-consensus on the disk
    
    - Fixes ticket #4187
    - Change the name of a unverified-*consensus to cached-*consensus
    on disk when it has been verified.
---
 changes/ticket4187     |  3 +++
 src/or/networkstatus.c | 11 ++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/ticket4187 b/changes/ticket4187
new file mode 100644
index 000000000..6f6cba15b
--- /dev/null
+++ b/changes/ticket4187
@@ -0,0 +1,3 @@
+  o Minor bugfix (rename verfied unverified consensus):
+    - Rename a verified unverfied consensus to cached-consenus on the disk.
+      Fixes bug 4187; bugfix on 0.3.3.0-alpha
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 31ecb2098..2a83bf008 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -237,7 +237,7 @@ router_reload_consensus_networkstatus(void)
     s = networkstatus_read_cached_consensus_impl(flav, flavor, 1);
     if (s) {
       if (networkstatus_set_current_consensus(s, flavor,
-                                     flags|NSSET_WAS_WAITING_FOR_CERTS,
+                                     flags | NSSET_WAS_WAITING_FOR_CERTS,
                                      NULL)) {
         log_info(LD_FS, "Couldn't load unverified consensus %s networkstatus "
                  "from cache", flavor);
@@ -1928,6 +1928,15 @@ networkstatus_set_current_consensus(const char *consensus,
     }
   }
 
+  /* Signatures from the consensus are verified */
+  if (from_cache && was_waiting_for_certs) {
+    /* We check if the consensus is loaded from disk cache and that it
+     * it is an unverified consensus. If it is unverified, rename it to
+     * cached-*-consensus since it has been verified. */
+    log_info(LD_DIR, "Unverified consensus signatures verified.");
+    tor_rename(unverified_fname, consensus_fname);
+  }
+
   if (!from_cache && flav == usable_consensus_flavor())
     control_event_client_status(LOG_NOTICE, "CONSENSUS_ARRIVED");
 





More information about the tor-commits mailing list