mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Make sure that router_get_by_* can always return "me"
svn:r3702
This commit is contained in:
parent
1630fa560f
commit
8efb2a957d
4
doc/TODO
4
doc/TODO
@ -209,8 +209,8 @@ N - IPv6 support (For exit addresses)
|
|||||||
extend-data cells can be extend requests.
|
extend-data cells can be extend requests.
|
||||||
|
|
||||||
- Code cleanup
|
- Code cleanup
|
||||||
- fix router_get_by_* functions so they can get ourselves too,
|
o fix router_get_by_* functions so they can get ourselves too ...
|
||||||
and audit everything to make sure rend and intro points are
|
- and audit everything to make sure rend and intro points are
|
||||||
just as likely to be us as not.
|
just as likely to be us as not.
|
||||||
|
|
||||||
- tor should be able to have a pool of outgoing IP addresses
|
- tor should be able to have a pool of outgoing IP addresses
|
||||||
|
@ -582,6 +582,9 @@ routerinfo_t *router_get_by_nickname(const char *nickname)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (nickname[0] == '$')
|
if (nickname[0] == '$')
|
||||||
return router_get_by_hexdigest(nickname);
|
return router_get_by_hexdigest(nickname);
|
||||||
|
if (server_mode(get_options()) &&
|
||||||
|
!strcasecmp(nickname, get_options()->Nickname))
|
||||||
|
return router_get_my_routerinfo();
|
||||||
|
|
||||||
maybedigest = (strlen(nickname) == HEX_DIGEST_LEN) &&
|
maybedigest = (strlen(nickname) == HEX_DIGEST_LEN) &&
|
||||||
(base16_decode(digest,DIGEST_LEN,nickname,HEX_DIGEST_LEN) == 0);
|
(base16_decode(digest,DIGEST_LEN,nickname,HEX_DIGEST_LEN) == 0);
|
||||||
@ -632,6 +635,10 @@ routerinfo_t *router_get_by_digest(const char *digest) {
|
|||||||
|
|
||||||
tor_assert(digest);
|
tor_assert(digest);
|
||||||
if (!routerlist) return NULL;
|
if (!routerlist) return NULL;
|
||||||
|
if (server_mode(get_options()) &&
|
||||||
|
(router = router_get_my_routerinfo()) &&
|
||||||
|
!memcmp(digest, router->identity_digest, DIGEST_LEN))
|
||||||
|
return router;
|
||||||
|
|
||||||
for (i=0;i<smartlist_len(routerlist->routers);i++) {
|
for (i=0;i<smartlist_len(routerlist->routers);i++) {
|
||||||
router = smartlist_get(routerlist->routers, i);
|
router = smartlist_get(routerlist->routers, i);
|
||||||
|
Loading…
Reference in New Issue
Block a user