diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-10-19 16:41:32 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-10-19 16:41:32 +0000 |
commit | 24317c75a9e6bfab78bda01faeac94debeb4e9d1 (patch) | |
tree | c86158ba1b8e91b9a713c4ba5d90def4971f6197 /src/or/dirvote.c | |
parent | 53f9fe7dc51fb5cecca0bd344ffb59063a98d5ac (diff) | |
download | tor-24317c75a9e6bfab78bda01faeac94debeb4e9d1.tar.gz tor-24317c75a9e6bfab78bda01faeac94debeb4e9d1.zip |
r15961@catbus: nickm | 2007-10-19 12:40:15 -0400
Learn the difference between "mismatched vote digest" and "mismatched vote times": the latter is more informative.
svn:r12049
Diffstat (limited to 'src/or/dirvote.c')
-rw-r--r-- | src/or/dirvote.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c index c5c92e6a06..66c7cc4ac7 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -810,17 +810,36 @@ networkstatus_check_consensus_signature(networkstatus_vote_t *consensus, * document as <b>target</b>. */ int networkstatus_add_detached_signatures(networkstatus_vote_t *target, - ns_detached_signatures_t *sigs) + ns_detached_signatures_t *sigs, + const char **msg_out) { int r = 0; tor_assert(sigs); tor_assert(target); tor_assert(!target->is_vote); + /* Do the times seem right? */ + if (target->valid_after != sigs->valid_after) { + *msg_out = "Valid-After times do not match " + "when adding detached signatures to consensus"; + return -1; + } + if (target->fresh_until != sigs->fresh_until) { + *msg_out = "Fresh-until times do not match " + "when adding detached signatures to consensus"; + return -1; + } + if (target->valid_until != sigs->valid_until) { + *msg_out = "Valid-until times do not match " + "when adding detached signatures to consensus"; + return -1; + } /* Are they the same consensus? */ if (memcmp(target->networkstatus_digest, sigs->networkstatus_digest, - DIGEST_LEN)) + DIGEST_LEN)) { + *msg_out = "Digest mismatch when adding detached signatures to consensus"; return -1; + } /* For each voter in src... */ SMARTLIST_FOREACH(sigs->signatures, networkstatus_voter_info_t *, src_voter, @@ -1612,7 +1631,7 @@ dirvote_add_signatures_to_pending_consensus( } r = networkstatus_add_detached_signatures(pending_consensus, - sigs); + sigs, msg_out); if (r >= 0) { char *new_detached = @@ -1644,7 +1663,7 @@ dirvote_add_signatures_to_pending_consensus( pending_consensus_signatures = new_detached; *msg_out = "Signatures added"; } else { - *msg_out = "Digest mismatch when adding detached signatures"; + goto err; } goto done; |