Loading doc/control-spec.txt +2 −1 Original line number Diff line number Diff line Loading @@ -412,7 +412,8 @@ $Id$ contents, provided according to the specification for the URLs listed in Section 4.4 of dir-spec.txt. Note that Tor MUST NOT provide private information, such as descriptors for routers not marked as general-purpose. general-purpose. When asked for 'authority' information for which this Tor is not authoritative, Tor replies with an empty string. Examples: C: GETINFO version desc/name/moria1 Loading src/or/control.c +21 −0 Original line number Diff line number Diff line Loading @@ -1455,6 +1455,27 @@ handle_getinfo_helper(const char *question, char **answer) smartlist_free(mappings); } else if (!strcmp(question, "dir-usage")) { *answer = directory_dump_request_log(); } else if (!strcmpstart(question, "dir/server/")) { size_t answer_len = 0, url_len = strlen(question)+2; char *url = tor_malloc(url_len); int res; smartlist_t *descs = smartlist_create(); const char *msg; char *cp; tor_snprintf(url, url_len, "/tor/%s", question+4); res = dirserv_get_routerdescs(descs, url, &msg); SMARTLIST_FOREACH(descs, signed_descriptor_t *, sd, answer_len += sd->signed_descriptor_len); cp = *answer = tor_malloc(answer_len+1); SMARTLIST_FOREACH(descs, signed_descriptor_t *, sd, { memcpy(cp, signed_descriptor_get_body(sd), sd->signed_descriptor_len); cp += sd->signed_descriptor_len; }); *cp = '\0'; tor_free(url); smartlist_free(descs); } return 0; } Loading src/or/dirserv.c +3 −0 Original line number Diff line number Diff line Loading @@ -1555,6 +1555,9 @@ dirserv_get_networkstatus_v2(smartlist_t *result, * recognize the key (URL). * If -1 is returned *<b>msg</b> will be set to an appropriate error * message. * * (Despite its name, this function is also called from the controller, which * exposes a similar means to fetch descriptors.) */ int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, Loading Loading
doc/control-spec.txt +2 −1 Original line number Diff line number Diff line Loading @@ -412,7 +412,8 @@ $Id$ contents, provided according to the specification for the URLs listed in Section 4.4 of dir-spec.txt. Note that Tor MUST NOT provide private information, such as descriptors for routers not marked as general-purpose. general-purpose. When asked for 'authority' information for which this Tor is not authoritative, Tor replies with an empty string. Examples: C: GETINFO version desc/name/moria1 Loading
src/or/control.c +21 −0 Original line number Diff line number Diff line Loading @@ -1455,6 +1455,27 @@ handle_getinfo_helper(const char *question, char **answer) smartlist_free(mappings); } else if (!strcmp(question, "dir-usage")) { *answer = directory_dump_request_log(); } else if (!strcmpstart(question, "dir/server/")) { size_t answer_len = 0, url_len = strlen(question)+2; char *url = tor_malloc(url_len); int res; smartlist_t *descs = smartlist_create(); const char *msg; char *cp; tor_snprintf(url, url_len, "/tor/%s", question+4); res = dirserv_get_routerdescs(descs, url, &msg); SMARTLIST_FOREACH(descs, signed_descriptor_t *, sd, answer_len += sd->signed_descriptor_len); cp = *answer = tor_malloc(answer_len+1); SMARTLIST_FOREACH(descs, signed_descriptor_t *, sd, { memcpy(cp, signed_descriptor_get_body(sd), sd->signed_descriptor_len); cp += sd->signed_descriptor_len; }); *cp = '\0'; tor_free(url); smartlist_free(descs); } return 0; } Loading
src/or/dirserv.c +3 −0 Original line number Diff line number Diff line Loading @@ -1555,6 +1555,9 @@ dirserv_get_networkstatus_v2(smartlist_t *result, * recognize the key (URL). * If -1 is returned *<b>msg</b> will be set to an appropriate error * message. * * (Despite its name, this function is also called from the controller, which * exposes a similar means to fetch descriptors.) */ int dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, Loading