From d9e690eb71bde3c748208733ba40a34e9d0ba29d Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Thu, 20 Sep 2001 21:51:22 +0000 Subject: [PATCH] 1012. [bug] The -p option to named did not behave as documented. --- CHANGES | 2 ++ bin/named/config.c | 7 +------ bin/named/server.c | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 9dc7c1fd1c..d5501e9851 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ +1012. [bug] The -p option to named did not behave as documented. + 1011. [cleanup] Removed isc_dir_current(). 1010. [bug] The server could attempt to execute a command channel diff --git a/bin/named/config.c b/bin/named/config.c index d1989c9f34..e22b52cea0 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: config.c,v 1.15 2001/09/17 00:33:52 marka Exp $ */ +/* $Id: config.c,v 1.16 2001/09/20 21:51:21 gson Exp $ */ #include @@ -422,11 +422,6 @@ ns_config_getport(cfg_obj_t *config, in_port_t *portp) { isc_result_t result; int i; - if (ns_g_port != 0) { - *portp = ns_g_port; - return (ISC_R_SUCCESS); - } - cfg_map_get(config, "options", &options); i = 0; if (options != NULL) diff --git a/bin/named/server.c b/bin/named/server.c index 346e5cb679..463763df18 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.344 2001/09/20 15:16:24 marka Exp $ */ +/* $Id: server.c,v 1.345 2001/09/20 21:51:22 gson Exp $ */ #include @@ -1734,7 +1734,10 @@ load_configuration(const char *filename, ns_server_t *server, /* * Determine which port to use for listening for incoming connections. */ - CHECKM(ns_config_getport(config, &listen_port), "port"); + if (ns_g_port != 0) + listen_port = ns_g_port; + else + CHECKM(ns_config_getport(config, &listen_port), "port"); /* * Configure the interface manager according to the "listen-on" @@ -2708,9 +2711,13 @@ ns_listenelt_fromconfig(cfg_obj_t *listener, cfg_obj_t *config, portobj = cfg_tuple_get(listener, "port"); if (!cfg_obj_isuint32(portobj)) { - result = ns_config_getport(config, &port); - if (result != ISC_R_SUCCESS) - return (result); + if (ns_g_port != 0) { + port = ns_g_port; + } else { + result = ns_config_getport(config, &port); + if (result != ISC_R_SUCCESS) + return (result); + } } else { if (cfg_obj_asuint32(portobj) >= ISC_UINT16_MAX) { cfg_obj_log(portobj, ns_g_lctx, ISC_LOG_ERROR,