Переглянути джерело

hs-v3: Shuffle the list of authorized clients

This commit makes it that the authorized clients in the descriptor are in
random order instead of ordered by how they were read on disk.

Fixes #27545

Signed-off-by: David Goulet <dgoulet@torproject.org>
Suphanat Chunhapanya 7 роки тому
батько
коміт
57c82b74b4
1 змінених файлів з 5 додано та 0 видалено
  1. 5 0
      src/feature/hs/hs_service.c

+ 5 - 0
src/feature/hs/hs_service.c

@@ -18,6 +18,7 @@
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_rand.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "lib/crypt_ops/crypto_util.h"
 #include "lib/crypt_ops/crypto_ope.h"
 #include "lib/crypt_ops/crypto_ope.h"
+#include "lib/crypt_ops/crypto_rand.h"
 #include "feature/dircache/directory.h"
 #include "feature/dircache/directory.h"
 #include "core/mainloop/main.h"
 #include "core/mainloop/main.h"
 #include "feature/nodelist/networkstatus.h"
 #include "feature/nodelist/networkstatus.h"
@@ -1800,6 +1801,10 @@ build_service_desc_superencrypted(const hs_service_t *service,
     smartlist_add(superencrypted->clients, desc_client);
     smartlist_add(superencrypted->clients, desc_client);
   }
   }
 
 
+  /* Shuffle the list to prevent the client know the position in the
+   * config. */
+  smartlist_shuffle(superencrypted->clients);
+
   return 0;
   return 0;
 }
 }