summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authormeejah <meejah@meejah.ca>2017-01-28 13:49:18 -0700
committermeejah <meejah@meejah.ca>2017-01-28 13:59:29 -0700
commitfc58c37e334fec71a204b7b0787d347b647618b8 (patch)
tree0b838926387ec4879da645977a4181260c5afa38 /src/or/control.c
parent67eb6470d711b36d1b855e6423ce7bbb302af834 (diff)
downloadtor-fc58c37e334fec71a204b7b0787d347b647618b8.tar.gz
tor-fc58c37e334fec71a204b7b0787d347b647618b8.zip
Ticket #21329: GETINFO onions/current returns empty list
If there are no ephemeral or detached onion services, then "GETINFO onions/current" or "GETINFO onions/detached" should return an empty list instead of an error
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 857b7325ae..cc46cb1aa2 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;