From: Evan Hunt Date: Thu, 3 Nov 2011 23:05:31 +0000 (+0000) Subject: 3201. [func] 'rndc querylog' can now be given an on/off parameter X-Git-Tag: v9.9.0b2~87 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=f550b4b104d2859539b2ec287600f1dd2215d9fb;p=thirdparty%2Fbind9.git 3201. [func] 'rndc querylog' can now be given an on/off parameter instead of only being used as a toggle. [RT #18351] --- diff --git a/CHANGES b/CHANGES index c82fef2310f..0808b39d81e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3201. [func] 'rndc querylog' can now be given an on/off parameter + instead of only being used as a toggle. [RT #18351] + 3200. [doc] Some rndc functions were undocumented or were missing from 'rndc -h' output. [RT #25555] diff --git a/bin/named/control.c b/bin/named/control.c index 8a67b97ec07..200a359a574 100644 --- a/bin/named/control.c +++ b/bin/named/control.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: control.c,v 1.46 2011/10/28 06:20:04 each Exp $ */ +/* $Id: control.c,v 1.47 2011/11/03 23:05:30 each Exp $ */ /*! \file */ @@ -154,7 +154,7 @@ ns_control_docommand(isccc_sexpr_t *message, isc_buffer_t *text) { } else if (command_compare(command, NS_COMMAND_DUMPSTATS)) { result = ns_server_dumpstats(ns_g_server); } else if (command_compare(command, NS_COMMAND_QUERYLOG)) { - result = ns_server_togglequerylog(ns_g_server); + result = ns_server_togglequerylog(ns_g_server, command); } else if (command_compare(command, NS_COMMAND_DUMPDB)) { ns_server_dumpdb(ns_g_server, command); result = ISC_R_SUCCESS; diff --git a/bin/named/include/named/server.h b/bin/named/include/named/server.h index e05222aaaa6..17eaeefdde8 100644 --- a/bin/named/include/named/server.h +++ b/bin/named/include/named/server.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.h,v 1.115 2011/10/28 06:20:04 each Exp $ */ +/* $Id: server.h,v 1.116 2011/11/03 23:05:30 each Exp $ */ #ifndef NAMED_SERVER_H #define NAMED_SERVER_H 1 @@ -228,9 +228,10 @@ ns_server_retransfercommand(ns_server_t *server, char *args); */ isc_result_t -ns_server_togglequerylog(ns_server_t *server); +ns_server_togglequerylog(ns_server_t *server, char *args); /*%< - * Toggle logging of queries, as in BIND 8. + * Enable/disable logging of queries. (Takes "yes" or "no" argument, + * but can also be used as a toggle for backward comptibility.) */ /*% diff --git a/bin/named/server.c b/bin/named/server.c index f61b924ed2d..c3bbd05cc8d 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.626 2011/10/29 06:22:51 marka Exp $ */ +/* $Id: server.c,v 1.627 2011/11/03 23:05:30 each Exp $ */ /*! \file */ @@ -6134,8 +6134,28 @@ ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text) { } isc_result_t -ns_server_togglequerylog(ns_server_t *server) { - server->log_queries = server->log_queries ? ISC_FALSE : ISC_TRUE; +ns_server_togglequerylog(ns_server_t *server, char *args) { + isc_boolean_t value; + char *ptr; + + /* Skip the command name. */ + ptr = next_token(&args, " \t"); + if (ptr == NULL) + return (ISC_R_UNEXPECTEDEND); + ptr = next_token(&args, " \t"); + if (ptr == NULL) + value = server->log_queries ? ISC_FALSE : ISC_TRUE; + else if (strcasecmp(ptr, "yes") == 0 || strcasecmp(ptr, "on") == 0) + value = ISC_TRUE; + else if (strcasecmp(ptr, "no") == 0 || strcasecmp(ptr, "off") == 0) + value = ISC_FALSE; + else + return (ISC_R_NOTFOUND); + + if (server->log_queries == value) + return (ISC_R_SUCCESS); + + server->log_queries = value; isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, ISC_LOG_INFO, diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 17583252ef3..ba617f66f20 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rndc.c,v 1.137 2011/11/03 22:06:21 each Exp $ */ +/* $Id: rndc.c,v 1.138 2011/11/03 23:05:30 each Exp $ */ /*! \file */ @@ -127,7 +127,8 @@ command is one of the following:\n\ loadkeys zone [class [view]]\n\ Update keys without signing immediately.\n\ stats Write server statistics to the statistics file.\n\ - querylog Toggle query logging.\n\ + querylog newstate\n\ + Enable / disable query logging.\n\ dumpdb [-all|-cache|-zones] [view ...]\n\ Dump cache(s) to the dump file (named_dump.db).\n\ secroots [view ...]\n\ diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index 11871a470b0..bf4b38ef3fd 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + BIND 9 Administrator Reference Manual @@ -1320,10 +1320,16 @@ zone "eng.example.com" { - querylog + querylog + on|off - Toggle query logging. Query logging can also be enabled + Enable or disable query logging. (For backward + compatibility, this command can also be used without + an argument to toggle query logging on and off.) + + + Query logging can also be enabled by explicitly directing the queries category to a channel in the