From 4587a7c3df4a8921b2df5c0d65fcb76f29c7e032 Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Wed, 1 Nov 2000 20:59:22 +0000 Subject: [PATCH] lwresd should only try to load /etc/resolv.conf if the -c option was not specified. --- bin/named/include/named/globals.h | 3 ++- bin/named/main.c | 12 ++++++++---- bin/named/server.c | 6 ++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index d39a8a55cc..1d957f2469 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: globals.h,v 1.46 2000/10/13 22:35:46 bwelling Exp $ */ +/* $Id: globals.h,v 1.47 2000/11/01 20:59:22 bwelling Exp $ */ #ifndef NAMED_GLOBALS_H #define NAMED_GLOBALS_H 1 @@ -76,6 +76,7 @@ EXTERN const char * lwresd_g_conffile INIT(NS_SYSCONFDIR "/lwresd.conf"); EXTERN const char * lwresd_g_resolvconffile INIT("/etc" "/resolv.conf"); +EXTERN isc_boolean_t ns_g_conffileset INIT(ISC_FALSE); EXTERN isc_boolean_t lwresd_g_useresolvconf INIT(ISC_FALSE); /* diff --git a/bin/named/main.c b/bin/named/main.c index a31f754126..c7e08ecfe2 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.c,v 1.89 2000/10/13 22:35:43 bwelling Exp $ */ +/* $Id: main.c,v 1.90 2000/11/01 20:59:19 bwelling Exp $ */ #include @@ -172,8 +172,8 @@ library_unexpected_error(const char *file, int line, const char *format, static void lwresd_usage(void) { fprintf(stderr, - "usage: lwresd [-C conffile] [-d debuglevel] " - "[-f|-g] [-n number_of_cpus]\n" + "usage: lwresd [-c conffile | -C resolvconffile] " + "[-d debuglevel] [-f|-g] [-n number_of_cpus]\n" " [-p port] [-P listen-port] [-s] " "[-t chrootdir]\n" " [-u username] [-i pidfile]\n"); @@ -276,10 +276,14 @@ parse_command_line(int argc, char *argv[]) { case 'c': ns_g_conffile = isc_commandline_argument; lwresd_g_conffile = isc_commandline_argument; + if (lwresd_g_useresolvconf) + ns_main_earlyfatal("cannot specify -c and -C"); + ns_g_conffileset = ISC_TRUE; break; - /* XXXBEW Should -C be removed? */ case 'C': lwresd_g_resolvconffile = isc_commandline_argument; + if (ns_g_conffileset) + ns_main_earlyfatal("cannot specify -c and -C"); lwresd_g_useresolvconf = ISC_TRUE; break; case 'd': diff --git a/bin/named/server.c b/bin/named/server.c index 67cfb2dfa6..e14477db79 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.233 2000/10/31 03:21:44 marka Exp $ */ +/* $Id: server.c,v 1.234 2000/11/01 20:59:20 bwelling Exp $ */ #include @@ -1313,7 +1313,9 @@ load_configuration(const char *filename, ns_server_t *server, result = dns_c_parse_namedconf(filename, ns_g_mctx, &cctx, &callbacks); } - if (result == ISC_R_FILENOTFOUND && ns_g_lwresdonly) { + if (result == ISC_R_FILENOTFOUND && + ns_g_lwresdonly && !ns_g_conffileset) + { isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_INFO, "loading configuration from '%s'",