[tor-commits] [tor/master] Use rend_valid_service_id() in the HSFETCH command

nickm at torproject.org nickm at torproject.org
Thu Apr 23 16:25:01 UTC 2015


commit 917c3aac60a68c7bf6f29705e61a313fffb071d1
Author: David Goulet <dgoulet at ev0ke.net>
Date:   Mon Mar 23 13:13:57 2015 -0400

    Use rend_valid_service_id() in the HSFETCH command
    
    Also, fix a small typo in a comment.
    
    Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
 src/or/control.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/or/control.c b/src/or/control.c
index 5cbc6ab..10475bb 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -38,6 +38,7 @@
 #include "policies.h"
 #include "reasons.h"
 #include "rendclient.h"
+#include "rendcommon.h"
 #include "rephist.h"
 #include "router.h"
 #include "routerlist.h"
@@ -3281,9 +3282,7 @@ handle_control_hsfetch(control_connection_t *conn, uint32_t len,
    * rest to find optional argument(s). */
   smartlist_del(args, 0);
   /* Test if it's an HS address without the .onion part. */
-  if (strlen(arg1) == REND_SERVICE_ID_LEN_BASE32 &&
-      base32_decode(digest, sizeof(digest), arg1,
-                    REND_SERVICE_ID_LEN_BASE32) == 0) {
+  if (rend_valid_service_id(arg1)) {
     hsaddress = arg1;
   } else if (strstr(arg1, v2_str) &&
              strlen(arg1 + v2_str_len) == REND_DESC_ID_V2_LEN_BASE32 &&
@@ -3349,7 +3348,7 @@ handle_control_hsfetch(control_connection_t *conn, uint32_t len,
    * to avoid out of order replies. */
   send_control_done(conn);
 
-  /* Trigger the fetch using the built rend query and possibly a lit of HS
+  /* Trigger the fetch using the built rend query and possibly a list of HS
    * directory to use. This function ignores the client cache thus this will
    * always send a fetch command. */
   rend_client_fetch_v2_desc(rend_query, hsdirs);





More information about the tor-commits mailing list