From 573b8b48d888e3f203ddd3fc78eafa986b9af44b Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Fri, 17 Dec 1999 00:19:29 +0000 Subject: [PATCH] Eliminated the global variable ns_g_confctx. The config data is now kept around only for the duration of the server (re)configuration process and then immediately freed. --- bin/named/include/named/globals.h | 1 - bin/named/server.c | 19 ++++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index 52ff41d07d..684eb5eee8 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -75,7 +75,6 @@ EXTERN unsigned int ns_g_debuglevel INIT(0); /* * Current config information */ -EXTERN dns_c_ctx_t * ns_g_confctx INIT(NULL); EXTERN const char * ns_g_conffile INIT("/etc/named.conf"); /* diff --git a/bin/named/server.c b/bin/named/server.c index 71b49bf956..6579fe8e99 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -522,9 +522,6 @@ load_configuration(const char *filename, ns_server_t *server) { oviewlist = ns_g_viewlist; ns_g_viewlist = lctx.viewlist; - oconfigctx = ns_g_confctx; - ns_g_confctx = configctx; - RWUNLOCK(&ns_g_viewlock, isc_rwlocktype_write); /* @@ -539,13 +536,10 @@ load_configuration(const char *filename, ns_server_t *server) { dns_view_detach(&view); } - if (oconfigctx != NULL) - dns_c_ctx_delete(&oconfigctx); - /* * Load the TSIG information from the configuration */ - result = dns_tsig_init(ns_g_lctx, ns_g_confctx, ns_g_mctx); + result = dns_tsig_init(ns_g_lctx, configctx, ns_g_mctx); if (result != ISC_R_SUCCESS) ns_server_fatal(NS_LOGMODULE_SERVER, ISC_FALSE, "dns_tsig_init() failed: %s", @@ -554,7 +548,7 @@ load_configuration(const char *filename, ns_server_t *server) { /* * Load the TKEY information from the configuration */ - result = dns_tkey_init(ns_g_lctx, ns_g_confctx, ns_g_mctx); + result = dns_tkey_init(ns_g_lctx, configctx, ns_g_mctx); if (result != ISC_R_SUCCESS) { ns_server_fatal(NS_LOGMODULE_SERVER, ISC_FALSE, "dns_tkey_init() failed: %s", @@ -562,6 +556,10 @@ load_configuration(const char *filename, ns_server_t *server) { } dns_aclconfctx_destroy(&aclconfctx); + + dns_c_ctx_delete(&configctx); + + } static void @@ -599,11 +597,6 @@ shutdown_server(isc_task_t *task, isc_event_t *event) { dns_view_detach(&view); } - /* - * XXXRTH Is this the right place to do this? - */ - dns_c_ctx_delete(&ns_g_confctx); - dns_tkey_destroy(); dns_tsig_destroy();