commit 31da3898e72cc2b9e8c25f6b4e89d34bbb17737e Author: David Goulet dgoulet@torproject.org Date: Wed Aug 9 11:45:29 2017 -0400
prop224: Add directory_request_fetch_set_hs_ident()
Needed by the client when fetching a descriptor. This function checks the directory purpose and hard assert if it is not for fetching.
Signed-off-by: David Goulet dgoulet@torproject.org --- src/or/directory.c | 14 ++++++++++++++ src/or/directory.h | 2 ++ src/or/hs_client.c | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/or/directory.c b/src/or/directory.c index f3e76be62..57dfdd9ca 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1292,6 +1292,20 @@ directory_request_upload_set_hs_ident(directory_request_t *req, } req->hs_ident = ident; } +/** + * Set an object containing HS connection identifier to be associated with + * this fetch request. Note that only an alias to <b>ident</b> is stored, so + * the <b>ident</b> object must outlive the request. + */ +void +directory_request_fetch_set_hs_ident(directory_request_t *req, + const hs_ident_dir_conn_t *ident) +{ + if (ident) { + tor_assert(req->dir_purpose == DIR_PURPOSE_FETCH_HSDESC); + } + req->hs_ident = ident; +} /** Set a static circuit_guard_state_t object to affliate with the request in * <b>req</b>. This object will receive notification when the attempt to * connect to the guard either succeeds or fails. */ diff --git a/src/or/directory.h b/src/or/directory.h index 1acdff346..fc71bf800 100644 --- a/src/or/directory.h +++ b/src/or/directory.h @@ -75,6 +75,8 @@ void directory_request_set_rend_query(directory_request_t *req, const rend_data_t *query); void directory_request_upload_set_hs_ident(directory_request_t *req, const hs_ident_dir_conn_t *ident); +void directory_request_fetch_set_hs_ident(directory_request_t *req, + const hs_ident_dir_conn_t *ident);
void directory_request_set_routerstatus(directory_request_t *req, const routerstatus_t *rs); diff --git a/src/or/hs_client.c b/src/or/hs_client.c index e7e3eb72a..77348f23e 100644 --- a/src/or/hs_client.c +++ b/src/or/hs_client.c @@ -102,7 +102,7 @@ directory_launch_v3_desc_fetch(const ed25519_public_key_t *onion_identity_pk, directory_request_set_routerstatus(req, hsdir); directory_request_set_indirection(req, DIRIND_ANONYMOUS); directory_request_set_resource(req, base64_blinded_pubkey); - directory_request_upload_set_hs_ident(req, &hs_conn_dir_ident); + directory_request_fetch_set_hs_ident(req, &hs_conn_dir_ident); directory_initiate_request(req); directory_request_free(req);