diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-08-13 20:31:08 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-08-13 20:31:08 +0000 |
commit | 4e4dcb2571963a7ec6df2e34b6a7b8262396b0f4 (patch) | |
tree | d18235c41f5287def446864ef64cc4c88f01a0e4 /src/or | |
parent | 94c90c42e3883b37f392951fa1867cf94c0930d7 (diff) | |
download | tor-4e4dcb2571963a7ec6df2e34b6a7b8262396b0f4.tar.gz tor-4e4dcb2571963a7ec6df2e34b6a7b8262396b0f4.zip |
r13989@Kushana: nickm | 2007-08-13 16:31:03 -0400
Actually store the v3 authority id digest of a trusteddirserver
svn:r11091
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 3 | ||||
-rw-r--r-- | src/or/or.h | 4 | ||||
-rw-r--r-- | src/or/router.c | 11 | ||||
-rw-r--r-- | src/or/routerlist.c | 5 |
4 files changed, 19 insertions, 4 deletions
diff --git a/src/or/config.c b/src/or/config.c index 1e069e83e5..8866db97a4 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3801,7 +3801,8 @@ parse_dir_server_line(const char *line, int validate_only) log_debug(LD_DIR, "Trusted dirserver at %s:%d (%s)", address, (int)dir_port, (char*)smartlist_get(items,0)); - add_trusted_dir_server(nickname, address, dir_port, or_port, digest, type); + add_trusted_dir_server(nickname, address, dir_port, or_port, digest, + v3_digest, type); } r = 0; diff --git a/src/or/or.h b/src/or/or.h index 96d0e74153..80e90924d8 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3418,7 +3418,9 @@ int router_exit_policy_rejects_all(routerinfo_t *router); void add_trusted_dir_server(const char *nickname, const char *address, uint16_t dir_port, uint16_t or_port, - const char *digest, authority_type_t type); + const char *digest, + const char *v3_auth_digest, + authority_type_t type); void clear_trusted_dir_servers(void); int any_trusted_dir_is_v1_authority(void); networkstatus_t *networkstatus_get_by_digest(const char *digest); diff --git a/src/or/router.c b/src/or/router.c index 3fa3546b79..135c115d1d 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -327,6 +327,7 @@ init_keys(void) const char *mydesc, *datadir; crypto_pk_env_t *prkey; char digest[20]; + char v3_digest[20]; char *cp; or_options_t *options = get_options(); or_state_t *state = get_or_state(); @@ -364,8 +365,14 @@ init_keys(void) } /* 1a. Read v3 directory authority key/cert information. */ - if (authdir_mode(options) && options->V3AuthoritativeDir) + memset(v3_digest, 0, sizeof(v3_digest)); + if (authdir_mode(options) && options->V3AuthoritativeDir) { init_v3_authority_keys(keydir); + if (get_my_v3_authority_cert()) { + crypto_pk_get_digest(get_my_v3_authority_cert()->identity_key, + v3_digest); + } + } /* 1. Read identity key. Make it if none is found. */ tor_snprintf(keydir,sizeof(keydir), @@ -473,6 +480,7 @@ init_keys(void) crypto_pk_get_digest(get_identity_key(), digest); type = ((options->V1AuthoritativeDir ? V1_AUTHORITY : 0) | (options->V2AuthoritativeDir ? V2_AUTHORITY : 0) | + (options->V3AuthoritativeDir ? V3_AUTHORITY : 0) | (options->BridgeAuthoritativeDir ? BRIDGE_AUTHORITY : 0) | (options->HSAuthoritativeDir ? HIDSERV_AUTHORITY : 0)); @@ -481,6 +489,7 @@ init_keys(void) (uint16_t)options->DirPort, (uint16_t)options->ORPort, digest, + v3_digest, type); } return 0; /* success */ diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 39518b6fac..50f3a7dbd1 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -3726,7 +3726,8 @@ router_exit_policy_rejects_all(routerinfo_t *router) void add_trusted_dir_server(const char *nickname, const char *address, uint16_t dir_port, uint16_t or_port, - const char *digest, authority_type_t type) + const char *digest, const char *v3_auth_digest, + authority_type_t type) { trusted_dir_server_t *ent; uint32_t a; @@ -3761,6 +3762,8 @@ add_trusted_dir_server(const char *nickname, const char *address, ent->is_running = 1; ent->type = type; memcpy(ent->digest, digest, DIGEST_LEN); + if (v3_auth_digest) + memcpy(ent->v3_identity_digest, v3_auth_digest, DIGEST_LEN); dlen = 64 + strlen(hostname) + (nickname?strlen(nickname):0); ent->description = tor_malloc(dlen); |