2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

tlsctx_client_session_cache_new() -> tlsctx_client_session_create()

Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.
This commit is contained in:
Artem Boldariev
2022-12-22 20:04:22 +02:00
parent f102df96b8
commit 7962e7f575
6 changed files with 23 additions and 16 deletions

View File

@@ -2880,9 +2880,9 @@ get_create_tls_context(dig_query_t *query, const bool is_https,
}
#endif /* HAVE_LIBNGHTTP2 */
sess_cache = isc_tlsctx_client_session_cache_new(
mctx, ctx,
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE);
isc_tlsctx_client_session_cache_create(
mctx, ctx, ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE,
&sess_cache);
result = isc_tlsctx_cache_add(
query->lookup->tls_ctx_cache, tlsctxname, transport,

View File

@@ -498,9 +498,10 @@ dns_transport_get_tlsctx(dns_transport_t *transport, const isc_sockaddr_t *peer,
isc_tlsctx_enable_dot_client_alpn(tlsctx);
sess_cache = isc_tlsctx_client_session_cache_new(
isc_tlsctx_client_session_cache_create(
mctx, tlsctx,
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE);
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE,
&sess_cache);
found_store = NULL;
result = isc_tlsctx_cache_add(tlsctx_cache, tlsname,

View File

@@ -320,9 +320,10 @@ typedef struct isc_tlsctx_client_session_cache isc_tlsctx_client_session_cache_t
* comparable to or surpass the size of a typical DNS message.
*/
isc_tlsctx_client_session_cache_t *
isc_tlsctx_client_session_cache_new(isc_mem_t *mctx, isc_tlsctx_t *ctx,
const size_t max_entries);
void
isc_tlsctx_client_session_cache_create(
isc_mem_t *mctx, isc_tlsctx_t *ctx, const size_t max_entries,
isc_tlsctx_client_session_cache_t **cachep);
/*%<
* Create a new TLS client session cache object.
*
@@ -330,6 +331,7 @@ isc_tlsctx_client_session_cache_new(isc_mem_t *mctx, isc_tlsctx_t *ctx,
*\li 'mctx' is a valid memory context object;
*\li 'ctx' is a valid TLS context object;
*\li 'max_entries' is a positive number;
*\li 'cachep' is a valid pointer to a pointer which must be equal to NULL.
*/
void

View File

@@ -1465,13 +1465,15 @@ struct isc_tlsctx_client_session_cache {
isc_mutex_t lock;
};
isc_tlsctx_client_session_cache_t *
isc_tlsctx_client_session_cache_new(isc_mem_t *mctx, isc_tlsctx_t *ctx,
const size_t max_entries) {
void
isc_tlsctx_client_session_cache_create(
isc_mem_t *mctx, isc_tlsctx_t *ctx, const size_t max_entries,
isc_tlsctx_client_session_cache_t **cachep) {
isc_tlsctx_client_session_cache_t *nc;
REQUIRE(ctx != NULL);
REQUIRE(max_entries > 0);
REQUIRE(cachep != NULL && *cachep == NULL);
nc = isc_mem_get(mctx, sizeof(*nc));
@@ -1486,7 +1488,7 @@ isc_tlsctx_client_session_cache_new(isc_mem_t *mctx, isc_tlsctx_t *ctx,
nc->magic = TLSCTX_CLIENT_SESSION_CACHE_MAGIC;
return (nc);
*cachep = nc;
}
void

View File

@@ -319,9 +319,10 @@ setup_test(void **state) {
client_tlsctx = NULL;
isc_tlsctx_createclient(&client_tlsctx);
isc_tlsctx_enable_http2client_alpn(client_tlsctx);
client_sess_cache = isc_tlsctx_client_session_cache_new(
isc_tlsctx_client_session_cache_create(
mctx, client_tlsctx,
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE);
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE,
&client_sess_cache);
isc_quota_init(&listener_quota, 0);
atomic_store(&check_listener_quota, false);

View File

@@ -186,9 +186,10 @@ setup_netmgr_test(void **state) {
isc_tlsctx_enable_dot_client_alpn(tcp_connect_tlsctx);
tcp_tlsctx_client_sess_cache = isc_tlsctx_client_session_cache_new(
isc_tlsctx_client_session_cache_create(
mctx, tcp_connect_tlsctx,
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE);
ISC_TLSCTX_CLIENT_SESSION_CACHE_DEFAULT_SIZE,
&tcp_tlsctx_client_sess_cache);
return (0);
}