--- /dev/null
+ o Major bugfixes (hidden service directory v3):
+ - When a descriptor lookup was done and it was not found in the directory
+ cache, it would crash on a NULL pointer instead of returning the 404
+ code back to the client like it was suppose to. Fixes bug 21471.;
+ bugfixes on tor-0.3.0.1-alpha.
pubkey_str = url + strlen("/tor/hs/3/");
retval = hs_cache_lookup_as_dir(HS_VERSION_THREE,
pubkey_str, &desc_str);
- if (retval < 0) {
+ if (retval <= 0 || desc_str == NULL) {
write_http_status_line(conn, 404, "Not found");
goto done;
}
/* Initialize HSDir cache subsystem */
init_test();
+ /* Test a descriptor not found in the directory cache. */
+ {
+ ed25519_public_key_t blinded_key;
+ memset(&blinded_key.pubkey, 'A', sizeof(blinded_key.pubkey));
+ received_desc_str = helper_fetch_desc_from_hsdir(&blinded_key);
+ tt_int_op(strlen(received_desc_str), OP_EQ, 0);
+ tor_free(received_desc_str);
+ }
+
/* Generate a valid descriptor with normal values. */
{
ed25519_keypair_t signing_kp;
/* Verify we received the exact same descriptor we published earlier */
tt_str_op(received_desc_str, OP_EQ, published_desc_str);
+ tor_free(received_desc_str);
+
+ /* With a valid descriptor in the directory cache, try again an invalid. */
+ {
+ ed25519_public_key_t blinded_key;
+ memset(&blinded_key.pubkey, 'A', sizeof(blinded_key.pubkey));
+ received_desc_str = helper_fetch_desc_from_hsdir(&blinded_key);
+ tt_int_op(strlen(received_desc_str), OP_EQ, 0);
+ }
done:
tor_free(received_desc_str);