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
This commit is contained in:
Nick Mathewson 2007-09-11 20:17:20 +00:00
parent c0130f9611
commit 3c7652ccdb
2 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,4 @@
$Id$
yes$Id$
Legend:
SPEC!! - Not specified
SPEC - Spec not finalized
@ -52,7 +52,7 @@ Things we'd like to do in 0.2.0.x:
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 @@ Things we'd like to do in 0.2.0.x:
- 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.

View File

@ -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,