aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-06-08 19:02:39 +0000
committerNick Mathewson <nickm@torproject.org>2007-06-08 19:02:39 +0000
commit1d6db7ec3d319fe16b285cd540e3e25df74efd91 (patch)
treeecceafdddd80ab126013f890ce3d31cb70e23098 /src/or/dirserv.c
parent2bb70054813876c5e3bd32606cdeac3971d60c5c (diff)
downloadtor-1d6db7ec3d319fe16b285cd540e3e25df74efd91.tar
tor-1d6db7ec3d319fe16b285cd540e3e25df74efd91.tar.gz
r13325@catbus: nickm | 2007-06-08 15:02:37 -0400
Parse networkstatuses (v2, vote, and consensus) after generating them, and fail fast if there is a parse error. svn:r10540
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 57c95e634..612e2917a 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1983,10 +1983,19 @@ format_networkstatus_vote(crypto_pk_env_t *private_key,
note_crypto_pk_op(SIGN_DIR);
if (router_append_dirobj_signature(outp,endp-outp,digest,private_key)<0) {
- log_warn(LD_BUG, "Unable to sign router status.");
+ log_warn(LD_BUG, "Unable to sign networkstatus vote.");
goto err;
}
+ {
+ networkstatus_vote_t *v;
+ if (!(v = networkstatus_parse_vote_from_string(status, 1))) {
+ log_err(LD_BUG,"Generated a networkstatus vote we couldn't parse.");
+ goto err;
+ }
+ networkstatus_vote_free(v);
+ }
+
goto done;
err:
@@ -2196,6 +2205,15 @@ generate_networkstatus_opinion(int v2)
}
{
+ networkstatus_t *ns;
+ if (!(ns = networkstatus_parse_from_string(status))) {
+ log_err(LD_BUG,"Generated a networkstatus we couldn't parse.");
+ goto done;
+ }
+ networkstatus_free(ns);
+ }
+
+ {
cached_dir_t **ns_ptr = &the_v2_networkstatus;
if (*ns_ptr)
cached_dir_decref(*ns_ptr);