aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@ev0ke.net>2015-03-11 14:52:28 -0400
committerDavid Goulet <dgoulet@ev0ke.net>2015-04-21 14:22:54 -0400
commit28cf9f2186a96bba74b0870b95a9fa1630305388 (patch)
tree6cb72af857cfeedb5ac200dece63581af4cb95be /src/test/test_hs.c
parent59f8dced114f20a147a5425ece67d7d44a81867b (diff)
downloadtor-28cf9f2186a96bba74b0870b95a9fa1630305388.tar.gz
tor-28cf9f2186a96bba74b0870b95a9fa1630305388.zip
Control: unbolt rend_data from HS desc event
The HS_DESC event was using rend_data_t from the dir connection to reply the onion address and authentication type. With the new HSFETCH command, it's now possible to fetch a descriptor only using the descriptor id thus resulting in not having an onion address in any HS_DESC event. This patch removes rend_query from the hs desc control functions and replace it by an onion address string and an auth type. On a successful fetch, the service id is taken from the fetched descriptor. For that, an extra parameter is added to "store as a client" function that contains the cache entry stored. This will make the control event functions scale more easily over time if other values not present in rend_data_t are needed since the rend_data from the dir connection might not contained everything we need. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/test/test_hs.c')
-rw-r--r--src/test/test_hs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 910ac39c1a..130411efcb 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -159,7 +159,8 @@ test_hs_desc_event(void *arg)
/* test received event */
rend_query.auth_type = 1;
- control_event_hs_descriptor_received(&rend_query, HSDIR_EXIST_ID);
+ control_event_hs_descriptor_received(rend_query.onion_address,
+ rend_query.auth_type, HSDIR_EXIST_ID);
expected_msg = "650 HS_DESC RECEIVED "STR_HS_ADDR" BASIC_AUTH "\
STR_HSDIR_EXIST_LONGNAME"\r\n";
tt_assert(received_msg);
@@ -168,7 +169,8 @@ test_hs_desc_event(void *arg)
/* test failed event */
rend_query.auth_type = 2;
- control_event_hs_descriptor_failed(&rend_query, HSDIR_NONE_EXIST_ID,
+ control_event_hs_descriptor_failed(rend_query.onion_address,
+ rend_query.auth_type, HSDIR_NONE_EXIST_ID,
"QUERY_REJECTED");
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" STEALTH_AUTH "\
STR_HSDIR_NONE_EXIST_LONGNAME" REASON=QUERY_REJECTED\r\n";
@@ -178,7 +180,8 @@ test_hs_desc_event(void *arg)
/* test invalid auth type */
rend_query.auth_type = 999;
- control_event_hs_descriptor_failed(&rend_query, HSDIR_EXIST_ID,
+ control_event_hs_descriptor_failed(rend_query.onion_address,
+ rend_query.auth_type, HSDIR_EXIST_ID,
"QUERY_REJECTED");
expected_msg = "650 HS_DESC FAILED "STR_HS_ADDR" UNKNOWN "\
STR_HSDIR_EXIST_LONGNAME" REASON=QUERY_REJECTED\r\n";