diff options
Diffstat (limited to 'src/or/router.c')
-rw-r--r-- | src/or/router.c | 11 |
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); |