summaryrefslogtreecommitdiff
path: root/src/or/dirvote.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-09-11 20:17:20 +0000
committerNick Mathewson <nickm@torproject.org>2007-09-11 20:17:20 +0000
commit3c7652ccdbb352351b92c2d00106646e01c87cb6 (patch)
tree06511309396f7c8f396a88ecce115364aaf2568e /src/or/dirvote.c
parentc0130f9611b17c9201ef95461f7cade92ab372a3 (diff)
downloadtor-3c7652ccdbb352351b92c2d00106646e01c87cb6.tar.gz
tor-3c7652ccdbb352351b92c2d00106646e01c87cb6.zip
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. svn:r11426
Diffstat (limited to 'src/or/dirvote.c')
-rw-r--r--src/or/dirvote.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 2642679821..ea503a1eb4 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -1338,8 +1338,18 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
}
}
- /* 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,