aboutsummaryrefslogtreecommitdiff
path: root/src/feature/hs
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2020-03-30 23:17:39 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2020-03-30 23:35:19 +0300
commit0667a5af8df8f372f6482254ca24c66268ed02f8 (patch)
tree68284d7ba4a121e07620ec8ca3a4f5be233be360 /src/feature/hs
parent9061303080e6b707ae6c9d77a05e27bf86ec948f (diff)
downloadtor-0667a5af8df8f372f6482254ca24c66268ed02f8.tar.gz
tor-0667a5af8df8f372f6482254ca24c66268ed02f8.zip
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.
Diffstat (limited to 'src/feature/hs')
-rw-r--r--src/feature/hs/hs_service.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index 3a2beb766f..367f8ca2b3 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -890,10 +890,18 @@ move_hs_state(hs_service_t *src_service, hs_service_t *dst_service)
if (dst->replay_cache_rend_cookie != NULL) {
replaycache_free(dst->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;
- 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,