mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 15:10:48 +01:00
hs-v3: Set extended error when descriptor is not found
Part of #30382 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
7bba8bf72f
commit
fb1d212021
3 changed files with 26 additions and 0 deletions
|
@ -2761,6 +2761,7 @@ handle_response_fetch_hsdesc_v3(dir_connection_t *conn,
|
||||||
"NOT_FOUND");
|
"NOT_FOUND");
|
||||||
hs_control_desc_event_content(conn->hs_ident, conn->identity_digest,
|
hs_control_desc_event_content(conn->hs_ident, conn->identity_digest,
|
||||||
NULL);
|
NULL);
|
||||||
|
hs_client_desc_not_found(conn->hs_ident);
|
||||||
break;
|
break;
|
||||||
case 400:
|
case 400:
|
||||||
log_warn(LD_REND, "Fetching v3 hidden service descriptor failed: "
|
log_warn(LD_REND, "Fetching v3 hidden service descriptor failed: "
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "core/or/entry_connection_st.h"
|
#include "core/or/entry_connection_st.h"
|
||||||
#include "core/or/extend_info_st.h"
|
#include "core/or/extend_info_st.h"
|
||||||
#include "core/or/origin_circuit_st.h"
|
#include "core/or/origin_circuit_st.h"
|
||||||
|
#include "core/or/socks_request_st.h"
|
||||||
|
|
||||||
/** Client-side authorizations for hidden services; map of service identity
|
/** Client-side authorizations for hidden services; map of service identity
|
||||||
* public key to hs_client_service_authorization_t *. */
|
* public key to hs_client_service_authorization_t *. */
|
||||||
|
@ -1758,6 +1759,29 @@ hs_client_desc_has_arrived(const hs_ident_dir_conn_t *ident)
|
||||||
smartlist_free(entry_conns);
|
smartlist_free(entry_conns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This is called when a descriptor fetch was not found. Every entry
|
||||||
|
* connection that matches the requested onion service, its extended error
|
||||||
|
* code will be set accordingly. */
|
||||||
|
void
|
||||||
|
hs_client_desc_not_found(const hs_ident_dir_conn_t *ident)
|
||||||
|
{
|
||||||
|
smartlist_t *entry_conns;
|
||||||
|
|
||||||
|
tor_assert(ident);
|
||||||
|
|
||||||
|
entry_conns = find_entry_conns(&ident->identity_pk);
|
||||||
|
|
||||||
|
SMARTLIST_FOREACH_BEGIN(entry_conns, entry_connection_t *, entry_conn) {
|
||||||
|
/* Descriptor was not found. We'll flag the socks request with the
|
||||||
|
* extended error code. If it is supported, it will be sent back. */
|
||||||
|
entry_conn->socks_request->socks_extended_error_code =
|
||||||
|
SOCKS5_HS_NOT_FOUND;
|
||||||
|
} SMARTLIST_FOREACH_END(entry_conn);
|
||||||
|
|
||||||
|
/* We don't have ownership of the objects in this list. */
|
||||||
|
smartlist_free(entry_conns);
|
||||||
|
}
|
||||||
|
|
||||||
/** Return a newly allocated extend_info_t for a randomly chosen introduction
|
/** Return a newly allocated extend_info_t for a randomly chosen introduction
|
||||||
* point for the given edge connection identifier ident. Return NULL if we
|
* point for the given edge connection identifier ident. Return NULL if we
|
||||||
* can't pick any usable introduction points. */
|
* can't pick any usable introduction points. */
|
||||||
|
|
|
@ -73,6 +73,7 @@ int hs_client_receive_rendezvous2(origin_circuit_t *circ,
|
||||||
size_t payload_len);
|
size_t payload_len);
|
||||||
|
|
||||||
void hs_client_desc_has_arrived(const hs_ident_dir_conn_t *ident);
|
void hs_client_desc_has_arrived(const hs_ident_dir_conn_t *ident);
|
||||||
|
void hs_client_desc_not_found(const hs_ident_dir_conn_t *ident);
|
||||||
|
|
||||||
extend_info_t *hs_client_get_random_intro_from_edge(
|
extend_info_t *hs_client_get_random_intro_from_edge(
|
||||||
const edge_connection_t *edge_conn);
|
const edge_connection_t *edge_conn);
|
||||||
|
|
Loading…
Add table
Reference in a new issue