mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-01 08:03:31 +01:00
prop224: Don't move intro points but rather descriptors
Apart from the fact that a newly allocated service doesn't have descriptors thus the move condition can never be true, the service needs the descriptor signing key to cross-certify the authentication key of each intro point so we need to move the descriptors between services and not only the intro points. Fixes #23056 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
f9cd870f50
commit
a9fb97e91a
@ -709,34 +709,20 @@ close_service_circuits(hs_service_t *service)
|
|||||||
close_service_rp_circuits(service);
|
close_service_rp_circuits(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move introduction points from the src descriptor to the dst descriptor. The
|
/* Move descriptor(s) from the src service to the dst service. */
|
||||||
* destination service intropoints are wiped out if any before moving. */
|
|
||||||
static void
|
static void
|
||||||
move_descriptor_intro_points(hs_service_descriptor_t *src,
|
move_descriptors(hs_service_t *src, hs_service_t *dst)
|
||||||
hs_service_descriptor_t *dst)
|
|
||||||
{
|
{
|
||||||
tor_assert(src);
|
tor_assert(src);
|
||||||
tor_assert(dst);
|
tor_assert(dst);
|
||||||
|
|
||||||
digest256map_free(dst->intro_points.map, service_intro_point_free_);
|
if (src->desc_current) {
|
||||||
dst->intro_points.map = src->intro_points.map;
|
dst->desc_current = src->desc_current;
|
||||||
/* Nullify the source. */
|
src->desc_current = NULL;
|
||||||
src->intro_points.map = NULL;
|
|
||||||
}
|
}
|
||||||
|
if (src->desc_next) {
|
||||||
/* Move introduction points from the src service to the dst service. The
|
dst->desc_next = src->desc_next;
|
||||||
* destination service intropoints are wiped out if any before moving. */
|
src->desc_next = NULL;
|
||||||
static void
|
|
||||||
move_intro_points(hs_service_t *src, hs_service_t *dst)
|
|
||||||
{
|
|
||||||
tor_assert(src);
|
|
||||||
tor_assert(dst);
|
|
||||||
|
|
||||||
if (src->desc_current && dst->desc_current) {
|
|
||||||
move_descriptor_intro_points(src->desc_current, dst->desc_current);
|
|
||||||
}
|
|
||||||
if (src->desc_next && dst->desc_next) {
|
|
||||||
move_descriptor_intro_points(src->desc_next, dst->desc_next);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -812,13 +798,14 @@ register_all_services(void)
|
|||||||
* transfer the intro points to it. */
|
* transfer the intro points to it. */
|
||||||
s = find_service(hs_service_map, &snew->keys.identity_pk);
|
s = find_service(hs_service_map, &snew->keys.identity_pk);
|
||||||
if (s) {
|
if (s) {
|
||||||
/* Pass ownership of intro points from s (the current service) to snew
|
/* Pass ownership of the descriptors from s (the current service) to
|
||||||
* (the newly configured one). */
|
* snew (the newly configured one). */
|
||||||
move_intro_points(s, snew);
|
move_descriptors(s, snew);
|
||||||
/* Remove the service from the global map because after this, we need to
|
/* Remove the service from the global map because after this, we need to
|
||||||
* go over the remaining service in that map that aren't surviving the
|
* go over the remaining service in that map that aren't surviving the
|
||||||
* reload to close their circuits. */
|
* reload to close their circuits. */
|
||||||
remove_service(hs_service_map, s);
|
remove_service(hs_service_map, s);
|
||||||
|
hs_service_free(s);
|
||||||
}
|
}
|
||||||
/* Great, this service is now ready to be added to our new map. */
|
/* Great, this service is now ready to be added to our new map. */
|
||||||
if (BUG(register_service(new_service_map, snew) < 0)) {
|
if (BUG(register_service(new_service_map, snew) < 0)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user