Commit 9e694201 authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

eliminated global variable ns_g_tkeyctx

parent 03dd96d1
......@@ -66,11 +66,6 @@ EXTERN unsigned int ns_g_debuglevel INIT(0);
*/
EXTERN const char * ns_g_conffile INIT("/etc/named.conf");
/*
* Current TKEY context
*/
EXTERN dns_tkey_ctx_t * ns_g_tkeyctx INIT(NULL);
/*
* Misc.
*/
......
......@@ -54,6 +54,7 @@ struct ns_server {
isc_rwlock_t viewlock;
ns_interfacemgr_t * interfacemgr;
dns_db_t * roothints;
dns_tkey_ctx_t * tkeyctx;
isc_mutex_t reload_event_lock;
isc_event_t * reload_event;
......
......@@ -2745,7 +2745,7 @@ ns_query_start(ns_client_t *client) {
return;
case dns_rdatatype_tkey:
result = dns_tkey_processquery(client->message,
ns_g_tkeyctx,
ns_g_server->tkeyctx,
client->view->dynamickeys);
if (result == ISC_R_SUCCESS)
ns_client_send(client);
......
......@@ -562,12 +562,16 @@ load_configuration(const char *filename, ns_server_t *server) {
RWUNLOCK(&server->viewlock, isc_rwlocktype_write);
/*
* Load the TKEY information from the configuration
* Load the TKEY information from the configuration.
*/
if (ns_g_tkeyctx != NULL)
dns_tkeyctx_destroy(&ns_g_tkeyctx);
CHECKM(dns_tkeyctx_fromconfig(configctx, ns_g_mctx, &ns_g_tkeyctx),
"setting up TKEY");
{
dns_tkey_ctx_t *t = NULL;
CHECKM(dns_tkeyctx_fromconfig(configctx, ns_g_mctx, &t),
"configuring TKEY");
if (server->tkeyctx != NULL)
dns_tkeyctx_destroy(&server->tkeyctx);
server->tkeyctx = t;
}
/*
* Rescan the interface list to pick up changes in the
* listen-on option.
......@@ -668,7 +672,6 @@ shutdown_server(isc_task_t *task, isc_event_t *event) {
RWUNLOCK(&server->viewlock, isc_rwlocktype_write);
dns_tkeyctx_destroy(&ns_g_tkeyctx);
ns_clientmgr_destroy(&server->clientmgr);
ns_interfacemgr_shutdown(server->interfacemgr);
......@@ -730,7 +733,11 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
CHECKFATAL(server->reload_event == NULL ?
ISC_R_NOMEMORY : ISC_R_SUCCESS,
"allocating reload event");
server->tkeyctx = NULL;
CHECKFATAL(dns_tkeyctx_create(ns_g_mctx, &server->tkeyctx),
"creating TKEY context");
/*
* Setup the server task, which is responsible for coordinating
* startup and shutdown of the server.
......@@ -755,6 +762,9 @@ ns_server_destroy(ns_server_t **serverp) {
ns_server_t *server = *serverp;
REQUIRE(NS_SERVER_VALID(server));
if (server->tkeyctx != NULL)
dns_tkeyctx_destroy(&server->tkeyctx);
isc_event_free(&server->reload_event);
INSIST(ISC_LIST_EMPTY(server->viewlist));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment