From 5000e59b5ff4234c6119c5ac0e9f419430c8b699 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 13 Jul 2011 12:44:41 -0400 Subject: [PATCH] Change GETINFO fingerprint to look at server_mode, not my_descriptor It's possible for us to be a server and have a fingerprint without having yet generated a descriptor. Fixes bug 3577; bugfix on 0.2.0.1-alpha --- changes/bug3577 | 4 ++++ src/or/control.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 changes/bug3577 diff --git a/changes/bug3577 b/changes/bug3577 new file mode 100644 index 0000000000..6335272752 --- /dev/null +++ b/changes/bug3577 @@ -0,0 +1,4 @@ + o Minor bugfixes: + - Allow GETINFO fingerprint to return a fingerprint even when + we have not yet built a router descriptor. Fixes bug 3577; + bugfix on 0.2.0.1-alpha. diff --git a/src/or/control.c b/src/or/control.c index da0a95da15..d33d33734e 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1394,14 +1394,14 @@ getinfo_helper_misc(control_connection_t *conn, const char *question, } else if (!strcmp(question, "dir-usage")) { *answer = directory_dump_request_log(); } else if (!strcmp(question, "fingerprint")) { - routerinfo_t *me = router_get_my_routerinfo(); - if (!me) { + crypto_pk_env_t *server_key; + if (!server_mode(get_options())) { *errmsg = "No routerdesc known; am I really a server?"; return -1; } + server_key = get_server_identity_key(); *answer = tor_malloc(HEX_DIGEST_LEN+1); - base16_encode(*answer, HEX_DIGEST_LEN+1, me->cache_info.identity_digest, - DIGEST_LEN); + crypto_pk_get_fingerprint(server_key, *answer, 0); } return 0; }