hs-v3: Don't crash after SIGHUP in Onionbalance backend mode.

The ob_subcreds array was not copied after SIGHUP, and that left the
post-SIGHUP service with a NULL ob_subcreds pointer (until the next descriptor
gets build where we regenerate ob_subcreds in hs_ob_refresh_keys()).

Fixes bug #33762; not in any released tor version.
This commit is contained in:
George Kadianakis 2020-03-30 23:17:39 +03:00
parent 9061303080
commit 0667a5af8d

View File

@ -890,10 +890,18 @@ move_hs_state(hs_service_t *src_service, hs_service_t *dst_service)
if (dst->replay_cache_rend_cookie != NULL) { if (dst->replay_cache_rend_cookie != NULL) {
replaycache_free(dst->replay_cache_rend_cookie); replaycache_free(dst->replay_cache_rend_cookie);
} }
dst->replay_cache_rend_cookie = src->replay_cache_rend_cookie; dst->replay_cache_rend_cookie = src->replay_cache_rend_cookie;
src->replay_cache_rend_cookie = NULL; /* steal pointer reference */
dst->next_rotation_time = src->next_rotation_time; dst->next_rotation_time = src->next_rotation_time;
src->replay_cache_rend_cookie = NULL; /* steal pointer reference */ if (src_service->ob_subcreds) {
dst_service->ob_subcreds = src_service->ob_subcreds;
dst_service->n_ob_subcreds = src_service->n_ob_subcreds;
src_service->ob_subcreds = NULL; /* steal pointer reference */
}
} }
/** Register services that are in the staging list. Once this function returns, /** Register services that are in the staging list. Once this function returns,