diff options
author | Neel Chauhan <neel@neelc.org> | 2020-08-06 22:32:30 -0700 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2020-08-20 14:34:21 +0300 |
commit | 6e37086f85aa3e421ebc6f4d64de1cd82bcdeaa6 (patch) | |
tree | b25c1eac5189bedcf695c649e31d1f17a3cb2085 /src/feature | |
parent | b1b007967599ccac2de91aa36d3a11a9bcb4ffdb (diff) | |
download | tor-6e37086f85aa3e421ebc6f4d64de1cd82bcdeaa6.tar.gz tor-6e37086f85aa3e421ebc6f4d64de1cd82bcdeaa6.zip |
v3 control: Persist ONION_CLIENT_AUTH_ADD client name
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/control/control_hs.c | 11 | ||||
-rw-r--r-- | src/feature/hs/hs_client.c | 2 | ||||
-rw-r--r-- | src/feature/hs/hs_client.h | 3 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/feature/control/control_hs.c b/src/feature/control/control_hs.c index c8de03b318..54b767cd0d 100644 --- a/src/feature/control/control_hs.c +++ b/src/feature/control/control_hs.c @@ -134,6 +134,13 @@ handle_control_onion_client_auth_add(control_connection_t *conn, } } SMARTLIST_FOREACH_END(flag); } + if (!strcasecmp(line->key, "ClientName")) { + if (strlen(line->value) > REND_CLIENTNAME_MAX_LEN) { + control_printf_endreply(conn, 512, "ClientName longer than %d chars", + REND_CLIENTNAME_MAX_LEN); + } + creds->client_name = tor_strdup(line->value); + } } hs_client_register_auth_status_t register_status; @@ -255,6 +262,10 @@ encode_client_auth_cred_for_control_port( } } + if (cred->client_name) { + smartlist_add_asprintf(control_line, " ClientName=%s", cred->client_name); + } + /* Join all the components into a single string */ msg_str = smartlist_join_strings(control_line, "", 0, NULL); diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c index d9c5d8ca1d..fc1fd76efc 100644 --- a/src/feature/hs/hs_client.c +++ b/src/feature/hs/hs_client.c @@ -2168,6 +2168,8 @@ client_service_authorization_free_(hs_client_service_authorization_t *auth) return; } + tor_free(auth->client_name); + memwipe(auth, 0, sizeof(*auth)); tor_free(auth); } diff --git a/src/feature/hs/hs_client.h b/src/feature/hs/hs_client.h index a11caa309f..88dede8126 100644 --- a/src/feature/hs/hs_client.h +++ b/src/feature/hs/hs_client.h @@ -71,6 +71,9 @@ typedef struct hs_client_service_authorization_t { /** An onion address that is used to connect to the onion service. */ char onion_address[HS_SERVICE_ADDR_LEN_BASE32+1]; + /** An client name used to connect to the onion service. */ + char *client_name; + /* Optional flags for this client. */ int flags; } hs_client_service_authorization_t; |