mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
control: Rename two HS v2 specific functions
Make control_event_hs_descriptor_received() and control_event_hs_descriptor_failed() v2 specific because they take a rend_data_t object and v3 will need to pass a different object. No behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
beacbbe210
commit
e7d606900e
@ -7284,8 +7284,8 @@ control_event_hs_descriptor_upload(const char *onion_address,
|
|||||||
/** send HS_DESC event after got response from hs directory.
|
/** send HS_DESC event after got response from hs directory.
|
||||||
*
|
*
|
||||||
* NOTE: this is an internal function used by following functions:
|
* NOTE: this is an internal function used by following functions:
|
||||||
* control_event_hs_descriptor_received
|
* control_event_hsv2_descriptor_received
|
||||||
* control_event_hs_descriptor_failed
|
* control_event_hsv2_descriptor_failed
|
||||||
*
|
*
|
||||||
* So do not call this function directly.
|
* So do not call this function directly.
|
||||||
*/
|
*/
|
||||||
@ -7360,9 +7360,9 @@ control_event_hs_descriptor_upload_end(const char *action,
|
|||||||
* called when we successfully received a hidden service descriptor.
|
* called when we successfully received a hidden service descriptor.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
control_event_hs_descriptor_received(const char *onion_address,
|
control_event_hsv2_descriptor_received(const char *onion_address,
|
||||||
const rend_data_t *rend_data,
|
const rend_data_t *rend_data,
|
||||||
const char *hsdir_id_digest)
|
const char *hsdir_id_digest)
|
||||||
{
|
{
|
||||||
char *desc_id_field = NULL;
|
char *desc_id_field = NULL;
|
||||||
const char *desc_id;
|
const char *desc_id;
|
||||||
@ -7409,9 +7409,9 @@ control_event_hs_descriptor_uploaded(const char *id_digest,
|
|||||||
* add it to REASON= field.
|
* add it to REASON= field.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
control_event_hs_descriptor_failed(const rend_data_t *rend_data,
|
control_event_hsv2_descriptor_failed(const rend_data_t *rend_data,
|
||||||
const char *hsdir_id_digest,
|
const char *hsdir_id_digest,
|
||||||
const char *reason)
|
const char *reason)
|
||||||
{
|
{
|
||||||
char *desc_id_field = NULL;
|
char *desc_id_field = NULL;
|
||||||
const char *desc_id;
|
const char *desc_id;
|
||||||
|
@ -129,14 +129,15 @@ void control_event_hs_descriptor_upload_end(const char *action,
|
|||||||
const char *onion_address,
|
const char *onion_address,
|
||||||
const char *hs_dir,
|
const char *hs_dir,
|
||||||
const char *reason);
|
const char *reason);
|
||||||
void control_event_hs_descriptor_received(const char *onion_address,
|
|
||||||
const rend_data_t *rend_data,
|
|
||||||
const char *id_digest);
|
|
||||||
void control_event_hs_descriptor_uploaded(const char *hs_dir,
|
void control_event_hs_descriptor_uploaded(const char *hs_dir,
|
||||||
const char *onion_address);
|
const char *onion_address);
|
||||||
void control_event_hs_descriptor_failed(const rend_data_t *rend_data,
|
/* Hidden service v2 HS_DESC specific. */
|
||||||
const char *id_digest,
|
void control_event_hsv2_descriptor_failed(const rend_data_t *rend_data,
|
||||||
const char *reason);
|
const char *id_digest,
|
||||||
|
const char *reason);
|
||||||
|
void control_event_hsv2_descriptor_received(const char *onion_address,
|
||||||
|
const rend_data_t *rend_data,
|
||||||
|
const char *id_digest);
|
||||||
void control_event_hs_descriptor_upload_failed(const char *hs_dir,
|
void control_event_hs_descriptor_upload_failed(const char *hs_dir,
|
||||||
const char *onion_address,
|
const char *onion_address,
|
||||||
const char *reason);
|
const char *reason);
|
||||||
|
@ -3136,9 +3136,9 @@ handle_response_fetch_renddesc_v2(dir_connection_t *conn,
|
|||||||
const size_t body_len = args->body_len;
|
const size_t body_len = args->body_len;
|
||||||
|
|
||||||
#define SEND_HS_DESC_FAILED_EVENT(reason) \
|
#define SEND_HS_DESC_FAILED_EVENT(reason) \
|
||||||
(control_event_hs_descriptor_failed(conn->rend_data, \
|
(control_event_hsv2_descriptor_failed(conn->rend_data, \
|
||||||
conn->identity_digest, \
|
conn->identity_digest, \
|
||||||
reason))
|
reason))
|
||||||
#define SEND_HS_DESC_FAILED_CONTENT() \
|
#define SEND_HS_DESC_FAILED_CONTENT() \
|
||||||
(control_event_hs_descriptor_content( \
|
(control_event_hs_descriptor_content( \
|
||||||
rend_data_get_address(conn->rend_data), \
|
rend_data_get_address(conn->rend_data), \
|
||||||
@ -3173,9 +3173,9 @@ handle_response_fetch_renddesc_v2(dir_connection_t *conn,
|
|||||||
/* success. notify pending connections about this. */
|
/* success. notify pending connections about this. */
|
||||||
log_info(LD_REND, "Successfully fetched v2 rendezvous "
|
log_info(LD_REND, "Successfully fetched v2 rendezvous "
|
||||||
"descriptor.");
|
"descriptor.");
|
||||||
control_event_hs_descriptor_received(service_id,
|
control_event_hsv2_descriptor_received(service_id,
|
||||||
conn->rend_data,
|
conn->rend_data,
|
||||||
conn->identity_digest);
|
conn->identity_digest);
|
||||||
control_event_hs_descriptor_content(service_id,
|
control_event_hs_descriptor_content(service_id,
|
||||||
conn->requested_resource,
|
conn->requested_resource,
|
||||||
conn->identity_digest,
|
conn->identity_digest,
|
||||||
|
@ -459,7 +459,8 @@ directory_get_from_hs_dir(const char *desc_id,
|
|||||||
hs_dir = hs_pick_hsdir(responsible_dirs, desc_id_base32);
|
hs_dir = hs_pick_hsdir(responsible_dirs, desc_id_base32);
|
||||||
if (!hs_dir) {
|
if (!hs_dir) {
|
||||||
/* No suitable hs dir can be found, stop right now. */
|
/* No suitable hs dir can be found, stop right now. */
|
||||||
control_event_hs_descriptor_failed(rend_query, NULL, "QUERY_NO_HSDIR");
|
control_event_hsv2_descriptor_failed(rend_query, NULL,
|
||||||
|
"QUERY_NO_HSDIR");
|
||||||
control_event_hs_descriptor_content(rend_data_get_address(rend_query),
|
control_event_hs_descriptor_content(rend_data_get_address(rend_query),
|
||||||
desc_id_base32, NULL, NULL);
|
desc_id_base32, NULL, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
@ -482,7 +483,7 @@ directory_get_from_hs_dir(const char *desc_id,
|
|||||||
REND_DESC_COOKIE_LEN,
|
REND_DESC_COOKIE_LEN,
|
||||||
0)<0) {
|
0)<0) {
|
||||||
log_warn(LD_BUG, "Could not base64-encode descriptor cookie.");
|
log_warn(LD_BUG, "Could not base64-encode descriptor cookie.");
|
||||||
control_event_hs_descriptor_failed(rend_query, hsdir_fp, "BAD_DESC");
|
control_event_hsv2_descriptor_failed(rend_query, hsdir_fp, "BAD_DESC");
|
||||||
control_event_hs_descriptor_content(rend_data_get_address(rend_query),
|
control_event_hs_descriptor_content(rend_data_get_address(rend_query),
|
||||||
desc_id_base32, hsdir_fp, NULL);
|
desc_id_base32, hsdir_fp, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -269,8 +269,8 @@ test_hs_desc_event(void *arg)
|
|||||||
|
|
||||||
/* test received event */
|
/* test received event */
|
||||||
rend_query.auth_type = REND_BASIC_AUTH;
|
rend_query.auth_type = REND_BASIC_AUTH;
|
||||||
control_event_hs_descriptor_received(rend_query.onion_address,
|
control_event_hsv2_descriptor_received(rend_query.onion_address,
|
||||||
&rend_query.base_, HSDIR_EXIST_ID);
|
&rend_query.base_, HSDIR_EXIST_ID);
|
||||||
expected_msg = "650 HS_DESC RECEIVED "STR_HS_ADDR" BASIC_AUTH "\
|
expected_msg = "650 HS_DESC RECEIVED "STR_HS_ADDR" BASIC_AUTH "\
|
||||||
STR_HSDIR_EXIST_LONGNAME " " STR_DESC_ID_BASE32"\r\n";
|
STR_HSDIR_EXIST_LONGNAME " " STR_DESC_ID_BASE32"\r\n";
|
||||||
tt_assert(received_msg);
|
tt_assert(received_msg);
|
||||||
@ -279,7 +279,7 @@ test_hs_desc_event(void *arg)
|
|||||||
|
|
||||||
/* test failed event */
|
/* test failed event */
|
||||||
rend_query.auth_type = REND_STEALTH_AUTH;
|
rend_query.auth_type = REND_STEALTH_AUTH;
|
||||||
control_event_hs_descriptor_failed(&rend_query.base_,
|
control_event_hsv2_descriptor_failed(&rend_query.base_,
|
||||||
HSDIR_NONE_EXIST_ID,
|
HSDIR_NONE_EXIST_ID,
|
||||||
"QUERY_REJECTED");
|
"QUERY_REJECTED");
|
||||||
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" STEALTH_AUTH "\
|
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" STEALTH_AUTH "\
|
||||||
@ -290,7 +290,7 @@ test_hs_desc_event(void *arg)
|
|||||||
|
|
||||||
/* test invalid auth type */
|
/* test invalid auth type */
|
||||||
rend_query.auth_type = 999;
|
rend_query.auth_type = 999;
|
||||||
control_event_hs_descriptor_failed(&rend_query.base_,
|
control_event_hsv2_descriptor_failed(&rend_query.base_,
|
||||||
HSDIR_EXIST_ID,
|
HSDIR_EXIST_ID,
|
||||||
"QUERY_REJECTED");
|
"QUERY_REJECTED");
|
||||||
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" UNKNOWN "\
|
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" UNKNOWN "\
|
||||||
@ -302,7 +302,7 @@ test_hs_desc_event(void *arg)
|
|||||||
|
|
||||||
/* test no HSDir fingerprint type */
|
/* test no HSDir fingerprint type */
|
||||||
rend_query.auth_type = REND_NO_AUTH;
|
rend_query.auth_type = REND_NO_AUTH;
|
||||||
control_event_hs_descriptor_failed(&rend_query.base_, NULL,
|
control_event_hsv2_descriptor_failed(&rend_query.base_, NULL,
|
||||||
"QUERY_NO_HSDIR");
|
"QUERY_NO_HSDIR");
|
||||||
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" NO_AUTH " \
|
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" NO_AUTH " \
|
||||||
"UNKNOWN REASON=QUERY_NO_HSDIR\r\n";
|
"UNKNOWN REASON=QUERY_NO_HSDIR\r\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user