fix: usr: Fix TLS contexts cache object usage bug in the resolver

:iscman:`named` could terminate unexpectedly when reconfiguring or
reloading, and if client-side TLS transport was in use (for example,
when forwarding queries to a DoT server). This has been fixed.

Closes #5653

Merge branch '5653-tlsctx_cache-reference-bug-fix' into 'main'

See merge request isc-projects/bind9!11295
This commit is contained in:
Arаm Sаrgsyаn 2025-11-27 17:41:17 +00:00
commit d441e14cbf

View file

@ -9737,6 +9737,8 @@ dns_resolver__destroy(dns_resolver_t *res) {
isc_hashmap_destroy(&res->counters);
isc_rwlock_destroy(&res->counters_lock);
isc_tlsctx_cache_detach(&res->tlsctx_cache);
if (res->dispatches4 != NULL) {
dns_dispatchset_destroy(&res->dispatches4);
}
@ -9812,7 +9814,6 @@ dns_resolver_create(dns_view_t *view, unsigned int options,
*res = (dns_resolver_t){
.rdclass = view->rdclass,
.options = options,
.tlsctx_cache = tlsctx_cache,
.spillatmin = 10,
.spillat = 10,
.spillatmax = 100,
@ -9859,6 +9860,8 @@ dns_resolver_create(dns_view_t *view, unsigned int options,
res->nloops);
}
isc_tlsctx_cache_attach(tlsctx_cache, &res->tlsctx_cache);
isc_mutex_init(&res->lock);
isc_mutex_init(&res->primelock);