aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-01-08 23:35:03 +0000
committerRoger Dingledine <arma@torproject.org>2008-01-08 23:35:03 +0000
commit8609c825e97b1e1edac1afbc640c983a067ab040 (patch)
tree2ccbe4b21a54e0330a59736b648962a258320020 /src/or
parent50f4cd10ad61191d66dbb6e06ac84d87e1bfeec9 (diff)
downloadtor-8609c825e97b1e1edac1afbc640c983a067ab040.tar
tor-8609c825e97b1e1edac1afbc640c983a067ab040.tar.gz
our defensive programming plan hid a bug. switch to offensive programming.
svn:r13078
Diffstat (limited to 'src/or')
-rw-r--r--src/or/router.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 5de54971b..cd7a5658b 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -565,19 +565,19 @@ init_keys(void)
v3_digest,
type);
}
- if ((ds = router_get_trusteddirserver_by_digest(digest))) {
- if (ds->type != type) {
- log_warn(LD_DIR, "Configured authority type does not match authority "
- "type in DirServer list. Adjusting. (%d v %d)",
- type, ds->type);
- ds->type = type;
- }
- if (v3_digest_set && (ds->type & V3_AUTHORITY) &&
- memcmp(v3_digest, ds->v3_identity_digest, DIGEST_LEN)) {
- log_warn(LD_DIR, "V3 identity key does not match identity declared in "
- "DirServer line. Adjusting.");
- memcpy(ds->v3_identity_digest, v3_digest, DIGEST_LEN);
- }
+ ds = router_get_trusteddirserver_by_digest(digest);
+ tor_assert(ds);
+ if (ds->type != type) {
+ log_warn(LD_DIR, "Configured authority type does not match authority "
+ "type in DirServer list. Adjusting. (%d v %d)",
+ type, ds->type);
+ ds->type = type;
+ }
+ if (v3_digest_set && (ds->type & V3_AUTHORITY) &&
+ memcmp(v3_digest, ds->v3_identity_digest, DIGEST_LEN)) {
+ log_warn(LD_DIR, "V3 identity key does not match identity declared in "
+ "DirServer line. Adjusting.");
+ memcpy(ds->v3_identity_digest, v3_digest, DIGEST_LEN);
}
return 0; /* success */