[or-cvs] r11091: Actually store the v3 authority id digest of a trusteddirser (in tor/trunk: . src/or)
nickm at seul.org
nickm at seul.org
Mon Aug 13 20:31:08 UTC 2007
Author: nickm
Date: 2007-08-13 16:31:08 -0400 (Mon, 13 Aug 2007)
New Revision: 11091
Modified:
tor/trunk/
tor/trunk/src/or/config.c
tor/trunk/src/or/or.h
tor/trunk/src/or/router.c
tor/trunk/src/or/routerlist.c
Log:
r13989 at Kushana: nickm | 2007-08-13 16:31:03 -0400
Actually store the v3 authority id digest of a trusteddirserver
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r13989] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2007-08-13 20:17:14 UTC (rev 11090)
+++ tor/trunk/src/or/config.c 2007-08-13 20:31:08 UTC (rev 11091)
@@ -3801,7 +3801,8 @@
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;
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2007-08-13 20:17:14 UTC (rev 11090)
+++ tor/trunk/src/or/or.h 2007-08-13 20:31:08 UTC (rev 11091)
@@ -3418,7 +3418,9 @@
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);
Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c 2007-08-13 20:17:14 UTC (rev 11090)
+++ tor/trunk/src/or/router.c 2007-08-13 20:31:08 UTC (rev 11091)
@@ -327,6 +327,7 @@
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 @@
}
/* 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 @@
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 @@
(uint16_t)options->DirPort,
(uint16_t)options->ORPort,
digest,
+ v3_digest,
type);
}
return 0; /* success */
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2007-08-13 20:17:14 UTC (rev 11090)
+++ tor/trunk/src/or/routerlist.c 2007-08-13 20:31:08 UTC (rev 11091)
@@ -3726,7 +3726,8 @@
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 @@
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);
More information about the tor-commits
mailing list