]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge remote-tracking branch 'dgoulet/ticket23355_032_01'
authorNick Mathewson <nickm@torproject.org>
Fri, 8 Sep 2017 16:13:48 +0000 (12:13 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 8 Sep 2017 16:13:48 +0000 (12:13 -0400)
1  2 
src/or/connection.c
src/or/connection.h
src/or/hs_client.c
src/or/hs_client.h
src/or/main.c

Simple merge
Simple merge
index e7d316b745d7d95e2abb23a4038517110ebacc36,0015a901683c474f4f633ce8832ca652e53a7247..f85ebc847397809ed6008c1e6888a062e404a611
  #include "connection.h"
  #include "hs_ntor.h"
  #include "circuitbuild.h"
 +#include "networkstatus.h"
  
+ /* Cancel all descriptor fetches currently in progress. */
+ static void
+ cancel_descriptor_fetches(void)
+ {
+   smartlist_t *conns =
+     connection_list_by_type_state(CONN_TYPE_DIR, DIR_PURPOSE_FETCH_HSDESC);
+   SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) {
+     const hs_ident_dir_conn_t *ident = TO_DIR_CONN(conn)->hs_ident;
+     if (BUG(ident == NULL)) {
+       /* A directory connection fetching a service descriptor can't have an
+        * empty hidden service identifier. */
+       continue;
+     }
+     log_debug(LD_REND, "Marking for close a directory connection fetching "
+                        "a hidden service descriptor for service %s.",
+               safe_str_client(ed25519_fmt(&ident->identity_pk)));
+     connection_mark_for_close(conn);
+   } SMARTLIST_FOREACH_END(conn);
+   /* No ownership of the objects in this list. */
+   smartlist_free(conns);
+   log_info(LD_REND, "Hidden service client descriptor fetches cancelled.");
+ }
  /* Get all connections that are waiting on a circuit and flag them back to
   * waiting for a hidden service descriptor for the given service key
   * service_identity_pk. */
@@@ -1267,11 -1275,24 +1291,32 @@@ hs_client_reextend_intro_circuit(origin
    return ret;
  }
  
 +/* Release all the storage held by the client subsystem. */
 +void
 +hs_client_free_all(void)
 +{
 +  /* Purge the hidden service request cache. */
 +  hs_purge_last_hid_serv_requests();
 +}
 +
+ /* Purge all potentially remotely-detectable state held in the hidden
+  * service client code. Called on SIGNAL NEWNYM. */
+ void
+ hs_client_purge_state(void)
+ {
+   /* v2 subsystem. */
+   rend_client_purge_state();
+   /* Cancel all descriptor fetches. Do this first so once done we are sure
+    * that our descriptor cache won't modified. */
+   cancel_descriptor_fetches();
+   /* Purge the introduction point state cache. */
+   hs_cache_client_intro_state_purge();
+   /* Purge the descriptor cache. */
+   hs_cache_purge_as_client();
+   /* Purge the last hidden service request cache. */
+   hs_purge_last_hid_serv_requests();
+   log_info(LD_REND, "Hidden service client state has been purged.");
+ }
index d8b8acf7506e2b6252aa25116122a15e0da92c32,a0f7c6b466591638d9ab36688b3ef713cd4defda..52277045063c370695af115bc94bb164f01d2b59
@@@ -46,14 -46,7 +46,16 @@@ extend_info_t *hs_client_get_random_int
  
  int hs_client_reextend_intro_circuit(origin_circuit_t *circ);
  
+ void hs_client_purge_state(void);
 +void hs_client_free_all(void);
 +
 +#ifdef HS_CLIENT_PRIVATE
 +
 +STATIC routerstatus_t *
 +pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk);
 +
 +#endif
 +
  #endif /* TOR_HS_CLIENT_H */
  
diff --cc src/or/main.c
Simple merge