From 4144efb39046963989ad002cf88a0c195401100a Mon Sep 17 00:00:00 2001 From: Jeremy Reed Date: Mon, 4 May 2009 17:38:56 +0000 Subject: [PATCH] 2594. [func] Have rndc warn if using its default configuration file when the key file also exists. [RT #19424] --- CHANGES | 3 +++ bin/rndc/rndc.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index e37afbbe1e..f7b1437e27 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2594. [func] Have rndc warn if using its default configuration file + when the key file also exists. [RT #19424] + 2593. [bug] Improve a corner source of SERVFAILs [RT #19632] 2592. [bug] Treat "any" as a type in nsupdate. [RT #19455] diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 1069c7ebd3..532ce901f7 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.124 2009/01/17 23:47:42 tbox Exp $ */ +/* $Id: rndc.c,v 1.125 2009/05/04 17:38:56 jreed Exp $ */ /*! \file */ @@ -79,6 +79,7 @@ static unsigned char databuf[2048]; static isccc_ccmsg_t ccmsg; static isccc_region_t secret; static isc_boolean_t failed = ISC_FALSE; +static isc_boolean_t c_flag = ISC_FALSE; static isc_mem_t *mctx; static int sends, recvs, connects; static char *command; @@ -455,6 +456,10 @@ parse_config(isc_mem_t *mctx, isc_log_t *log, const char *keyname, fatal("neither %s nor %s was found", admin_conffile, admin_keyfile); key_only = ISC_TRUE; + } else if (! c_flag && isc_file_exists(admin_keyfile)) { + fprintf(stderr, "WARNING: key file (%s) exists, but using " + "default configuration file (%s)\n", + admin_keyfile, admin_conffile); } DO("create parser", cfg_parser_create(mctx, log, pctxp)); @@ -709,6 +714,7 @@ main(int argc, char **argv) { case 'c': admin_conffile = isc_commandline_argument; + c_flag = ISC_TRUE; break; case 'k':