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

[or-cvs] r11426: Reject incoming votes when the valid-after time does not mat (in tor/trunk: . doc src/or)



Author: nickm
Date: 2007-09-11 16:17:20 -0400 (Tue, 11 Sep 2007)
New Revision: 11426

Modified:
   tor/trunk/
   tor/trunk/doc/TODO
   tor/trunk/src/or/dirvote.c
Log:
 r15045@catbus:  nickm | 2007-09-11 11:52:29 -0400
 Reject incoming votes when the valid-after time does not match the period that we're trying to vote for.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15045] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2007-09-11 20:17:18 UTC (rev 11425)
+++ tor/trunk/doc/TODO	2007-09-11 20:17:20 UTC (rev 11426)
@@ -1,4 +1,4 @@
-$Id$
+yes$Id$
 Legend:
 SPEC!!  - Not specified
 SPEC    - Spec not finalized
@@ -52,7 +52,7 @@
         o Code to manage key certificates
           o Download as needed.
             o Code to download
-            o Code to retry download.
+            . Code to retry download.
         . Code to generate consensus from a list of votes
           * Detect whether votes are really all for the same period.
         . Push/pull documents as appropriate.
@@ -66,7 +66,7 @@
         - Fix all XXXX020s in vote code
       - Validate information properly.
         - Warn if we get a vote with different authorities than we know.
-        - Don't count votes with a different valid-after when generating
+        o Don't count votes with a different valid-after when generating
           the same consensus.
         - Dump certificates with the wrong time.  Or just warn?
         - Warn authority ops when their certs are nearly invalid.

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2007-09-11 20:17:18 UTC (rev 11425)
+++ tor/trunk/src/or/dirvote.c	2007-09-11 20:17:20 UTC (rev 11426)
@@ -1338,8 +1338,18 @@
     }
   }
 
-  /* XXXX020 check times; make sure epochs match. */
+  /* Is it for the right period? */
+  if (vote->valid_after != voting_schedule.interval_starts) {
+    char tbuf1[ISO_TIME_LEN+1], tbuf2[ISO_TIME_LEN+1];
+    format_iso_time(tbuf1, vote->valid_after);
+    format_iso_time(tbuf2, voting_schedule.interval_starts);
+    log_warn(LD_DIR, "Rejecting vote with valid-after time of %s; we were "
+             "expecting %s", tbuf1, tbuf2);
+    *msg_out = "Bad valid-after time";
+    goto err;
+  }
 
+  /* Now see whether we already have a vote from this authority.*/
   SMARTLIST_FOREACH(pending_vote_list, pending_vote_t *, v, {
       if (! memcmp(v->vote->cert->cache_info.identity_digest,
                    vote->cert->cache_info.identity_digest,