summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-15 09:01:22 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-15 09:01:22 -0400
commita213a32b7cc2ca0701953953a812662c2f0533d3 (patch)
treef3e8d5790328dae476c2cce7e0c23ef40cccb148 /src/or
parent7facfc728ea911128e6e7c7d2187ab8e89f4f65e (diff)
parent21564c93cea87ac01087b5139a37e68a27871ab1 (diff)
downloadtor-a213a32b7cc2ca0701953953a812662c2f0533d3.tar.gz
tor-a213a32b7cc2ca0701953953a812662c2f0533d3.zip
Merge remote-tracking branch 'dgoulet/ticket23310_032_02'
Diffstat (limited to 'src/or')
-rw-r--r--src/or/hs_client.c11
-rw-r--r--src/or/hs_client.h8
2 files changed, 16 insertions, 3 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index be5ece068c..77fbf548ed 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -521,7 +521,7 @@ client_rendezvous_circ_has_opened(origin_circuit_t *circ)
* to a newly allocated extend_info_t object fully initialized. Return NULL if
* we can't convert it for which chances are that we are missing or malformed
* link specifiers. */
-static extend_info_t *
+STATIC extend_info_t *
desc_intro_point_to_extend_info(const hs_desc_intro_point_t *ip)
{
extend_info_t *ei;
@@ -594,7 +594,7 @@ intro_point_is_usable(const ed25519_public_key_t *service_pk,
/* Using a descriptor desc, return a newly allocated extend_info_t object of a
* randomly picked introduction point from its list. Return NULL if none are
* usable. */
-static extend_info_t *
+STATIC extend_info_t *
client_get_random_intro(const ed25519_public_key_t *service_pk)
{
extend_info_t *ei = NULL, *ei_excluded = NULL;
@@ -646,6 +646,12 @@ client_get_random_intro(const ed25519_public_key_t *service_pk)
/* If this pick is in the ExcludeNodes list, we keep its reference so if
* we ever end up not being able to pick anything else and StrictNodes is
* unset, we'll use it. */
+ if (ei_excluded) {
+ /* If something was already here free it. After the loop is gone we
+ * will examine the last excluded intro point, and that's fine since
+ * that's random anyway */
+ extend_info_free(ei_excluded);
+ }
ei_excluded = ei;
continue;
}
@@ -662,6 +668,7 @@ client_get_random_intro(const ed25519_public_key_t *service_pk)
if (options->StrictNodes) {
log_warn(LD_REND, "Every introduction points are in the ExcludeNodes set "
"and StrictNodes is set. We can't connect.");
+ extend_info_free(ei);
ei = NULL;
}
diff --git a/src/or/hs_client.h b/src/or/hs_client.h
index 3ea2b8cdf9..d50d346217 100644
--- a/src/or/hs_client.h
+++ b/src/or/hs_client.h
@@ -71,7 +71,13 @@ void hs_client_free_all(void);
STATIC routerstatus_t *
pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk);
-#endif
+STATIC extend_info_t *
+client_get_random_intro(const ed25519_public_key_t *service_pk);
+
+STATIC extend_info_t *
+desc_intro_point_to_extend_info(const hs_desc_intro_point_t *ip);
+
+#endif /* HS_CLIENT_PRIVATE */
#endif /* TOR_HS_CLIENT_H */