summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-02-16 09:40:56 -0500
committerNick Mathewson <nickm@torproject.org>2017-02-16 09:40:56 -0500
commit31be66ea5ae243644f79d7f8a7d728cd9537c79d (patch)
treef16567e3702a705a465fbfea087eda1fef71eb2e /src/or
parent832d4636f5e05cd4e500b590749ca6bf9e9c10cd (diff)
parentfc58c37e334fec71a204b7b0787d347b647618b8 (diff)
downloadtor-31be66ea5ae243644f79d7f8a7d728cd9537c79d.tar.gz
tor-31be66ea5ae243644f79d7f8a7d728cd9537c79d.zip
Merge remote-tracking branch 'meejah/ticket-21329-onions-current'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/control.c13
-rw-r--r--src/or/control.h5
2 files changed, 12 insertions, 6 deletions
diff --git a/src/or/control.c b/src/or/control.c
index b0a687679d..8ab31f18f7 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2824,12 +2824,13 @@ getinfo_helper_events(control_connection_t *control_conn,
/** Implementation helper for GETINFO: knows how to enumerate hidden services
* created via the control port. */
-static int
+STATIC int
getinfo_helper_onions(control_connection_t *control_conn,
const char *question, char **answer,
const char **errmsg)
{
smartlist_t *onion_list = NULL;
+ (void) errmsg; /* no errors from this method */
if (control_conn && !strcmp(question, "onions/current")) {
onion_list = control_conn->ephemeral_onion_services;
@@ -2839,13 +2840,13 @@ getinfo_helper_onions(control_connection_t *control_conn,
return 0;
}
if (!onion_list || smartlist_len(onion_list) == 0) {
- if (errmsg) {
- *errmsg = "No onion services of the specified type.";
+ if (answer) {
+ *answer = tor_strdup("");
}
- return -1;
- }
- if (answer) {
+ } else {
+ if (answer) {
*answer = smartlist_join_strings(onion_list, "\r\n", 0, NULL);
+ }
}
return 0;
diff --git a/src/or/control.h b/src/or/control.h
index 6330c85571..16ba1ed8f0 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -262,6 +262,11 @@ STATIC crypto_pk_t *add_onion_helper_keyarg(const char *arg, int discard_pk,
STATIC rend_authorized_client_t *
add_onion_helper_clientauth(const char *arg, int *created, char **err_msg_out);
+STATIC int getinfo_helper_onions(
+ control_connection_t *control_conn,
+ const char *question,
+ char **answer,
+ const char **errmsg);
STATIC void getinfo_helper_downloads_networkstatus(
const char *flavor,
download_status_t **dl_to_emit,