summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-14 01:44:32 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-14 01:44:32 +0000
commit0d5a847f12724d1a86898ca3246850c06ceaebf1 (patch)
tree69b36dff2fd5411525ff0f99540c3b4268058255 /src/or/router.c
parent55634e4eec5924985d74c8590b6a8c7291988e9c (diff)
downloadtor-0d5a847f12724d1a86898ca3246850c06ceaebf1.tar.gz
tor-0d5a847f12724d1a86898ca3246850c06ceaebf1.zip
Remove need for dirservers file: now, we note trusted dirservers in configuration options, and only need to remember addr:port and key digest for each one.
svn:r2479
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c
index aec6426386..da7b707194 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -228,6 +228,7 @@ int init_keys(void) {
char *cp;
const char *tmp, *mydesc, *datadir;
crypto_pk_env_t *prkey;
+ char digest[20];
if (!key_lock)
key_lock = tor_mutex_new();
@@ -345,6 +346,16 @@ int init_keys(void) {
log_fn(LOG_ERR, "Error loading fingerprints");
return -1;
}
+ /* 6b. [authdirserver only] add own key to approved directories. */
+ crypto_pk_get_digest(get_identity_key(), digest);
+ if (!router_digest_is_trusted_dir(digest)) {
+ uint32_t addr;
+ if(resolve_my_address(options.Address, &addr) < 0) {
+ log_fn(LOG_WARN,"options.Address didn't resolve into an IP.");
+ return -1;
+ }
+ add_trusted_dir_server(addr, options.DirPort, digest);
+ }
/* 7. [authdirserver only] load old directory, if it's there */
sprintf(keydir,"%s/cached-directory", datadir);
log_fn(LOG_INFO,"Loading cached directory from %s...",keydir);