aboutsummaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-19 00:45:17 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-19 00:45:17 +0000
commit58d27cfc2974af6d70a1b616f29230f5cc8d6620 (patch)
tree5f9bd060a497356ff40e0fd643228cd753a53ea2 /src/or/router.c
parent61a116b3da49bb8c49e4ca05da09ef7550cf0282 (diff)
downloadtor-58d27cfc2974af6d70a1b616f29230f5cc8d6620.tar.gz
tor-58d27cfc2974af6d70a1b616f29230f5cc8d6620.zip
r12800@catbus: nickm | 2007-05-18 20:45:15 -0400
Possible fix for bug 417 and bug 404: do not insert our routerinfo directly; instead, re-parse it first. svn:r10217
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 28a801bf9e..3bd8d41f8f 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -319,6 +319,7 @@ init_keys(void)
mydesc = router_get_my_descriptor();
if (authdir_mode(options)) {
const char *m;
+ routerinfo_t *ri;
/* We need to add our own fingerprint so it gets recognized. */
if (dirserv_add_own_fingerprint(options->Nickname, get_identity_key())) {
log_err(LD_GENERAL,"Error adding own fingerprint to approved set");
@@ -328,7 +329,13 @@ init_keys(void)
log_err(LD_GENERAL,"Error initializing descriptor.");
return -1;
}
- if (dirserv_add_descriptor(router_get_my_routerinfo(), &m) < 0) {
+ ri = router_parse_entry_from_string(mydesc, NULL, 1);
+ if (!ri) {
+ log_err(LD_GENERAL,"Generated a routerinfo we couldn't parse.");
+ return -1;
+ }
+ if (dirserv_add_descriptor(ri, &m)
+ < 0) {
log_err(LD_GENERAL,"Unable to add own descriptor to directory: %s",
m?m:"<unknown error>");
return -1;