aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendclient.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@ev0ke.net>2015-03-23 13:07:51 -0400
committerDavid Goulet <dgoulet@ev0ke.net>2015-04-21 14:22:54 -0400
commita4585405d6e103b9a48a1401321477ea08fa2ad1 (patch)
tree37731ef1a7d5c5bbb7684d820635b7ec70a93ea0 /src/or/rendclient.c
parent917c3aac60a68c7bf6f29705e61a313fffb071d1 (diff)
downloadtor-a4585405d6e103b9a48a1401321477ea08fa2ad1.tar.gz
tor-a4585405d6e103b9a48a1401321477ea08fa2ad1.zip
Multiple fixes for the HSFETCH command
Ref: https://trac.torproject.org/projects/tor/ticket/14847?replyto=31#comment:31 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r--src/or/rendclient.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 7941ba7372..d64907522e 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -496,11 +496,10 @@ get_last_hid_serv_requests(void)
REND_SERVICE_ID_LEN_BASE32)
/** Look up the last request time to hidden service directory <b>hs_dir</b>
- * for descriptor ID <b>desc_id_base32</b> for the service specified in
- * <b>rend_query</b>. If <b>set</b> is non-zero,
- * assign the current time <b>now</b> and return that. Otherwise, return
- * the most recent request time, or 0 if no such request has been sent
- * before. */
+ * for descriptor ID <b>desc_id_base32</b>. If <b>set</b> is non-zero,
+ * assign the current time <b>now</b> and return that. Otherwise, return the
+ * most recent request time, or 0 if no such request has been sent before.
+ */
static time_t
lookup_last_hid_serv_request(routerstatus_t *hs_dir,
const char *desc_id_base32,
@@ -612,20 +611,17 @@ rend_client_purge_last_hid_serv_requests(void)
*
* Return NULL on error else the hsdir node pointer. */
static routerstatus_t *
-pick_hsdir(const char *desc_id)
+pick_hsdir(const char *desc_id, const char *desc_id_base32)
{
smartlist_t *responsible_dirs = smartlist_new();
smartlist_t *usable_responsible_dirs = smartlist_new();
const or_options_t *options = get_options();
routerstatus_t *hs_dir;
- char desc_id_base32[REND_DESC_ID_V2_LEN_BASE32 + 1];
time_t now = time(NULL);
int excluded_some;
tor_assert(desc_id);
-
- base32_encode(desc_id_base32, sizeof(desc_id_base32),
- desc_id, DIGEST_LEN);
+ tor_assert(desc_id_base32);
/* Determine responsible dirs. Even if we can't get all we want, work with
* the ones we have. If it's empty, we'll notice below. */
@@ -705,7 +701,7 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query,
/* Automatically pick an hs dir if none given. */
if (!rs_hsdir) {
- hs_dir = pick_hsdir(desc_id);
+ hs_dir = pick_hsdir(desc_id, desc_id_base32);
if (!hs_dir) {
/* No suitable hs dir can be found, stop right now. */
return 0;