diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-09-30 19:27:54 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-09-30 19:27:54 +0000 |
commit | 01786266caa4b15207f559a10a8759532f4cdf07 (patch) | |
tree | 0142e9b0f3ab45794fb3c2d665427f22dc8c815b /src/or/main.c | |
parent | d0273ee135773fbb1e3094f2f29fb04a4ed32f94 (diff) | |
download | tor-01786266caa4b15207f559a10a8759532f4cdf07.tar.gz tor-01786266caa4b15207f559a10a8759532f4cdf07.zip |
Bugfixes in directory code:
Improve debugging output on fingerprint checking.
Make sure to add our own fingerprint to the fingerprint list _before_
adding our own descriptor, or else we'll reject ourself.
Don't call a directory invalid just because we have a newer descriptor
for some router.
Use router_get_dir_hash to generate hashes for signed directories.
Make sure we add our own descriptor successfully.
Don't fall-through on failed base64-endode.
svn:r514
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c index 37e506ac07..1d1d42bb16 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -472,8 +472,16 @@ static int init_keys(void) log_fn(LOG_ERR, "Error initializing descriptor."); return -1; } + /* We need to add our own fingerprint so it gets recognized. */ + if (dirserv_add_own_fingerprint(options.Nickname, get_identity_key())) { + log_fn(LOG_ERR, "Error adding own fingerprint to approved set"); + return -1; + } tmp = mydesc = router_get_my_descriptor(); - dirserv_add_descriptor(&tmp); + if (dirserv_add_descriptor(&tmp)) { + log(LOG_ERR, "Unable to add own descriptor to directory."); + return -1; + } sprintf(keydir,"%s/router.desc", options.DataDirectory); log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir); if (write_str_to_file(keydir, mydesc)) { @@ -744,7 +752,7 @@ int dump_router_to_string(char *s, int maxlen, routerinfo_t *router, written += strlen(s+written); if (base64_encode(s+written, maxlen-written, signature, 128) < 0) { log_fn(LOG_WARNING, "Couldn't base64-encode signature"); - /* XXX Nick: do we really mean to fall through here? */ + return -1; } written += strlen(s+written); strcat(s+written, "-----END SIGNATURE-----\n"); |