]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3201. [func] 'rndc querylog' can now be given an on/off parameter
authorEvan Hunt <each@isc.org>
Thu, 3 Nov 2011 23:05:31 +0000 (23:05 +0000)
committerEvan Hunt <each@isc.org>
Thu, 3 Nov 2011 23:05:31 +0000 (23:05 +0000)
instead of only being used as a toggle. [RT #18351]

CHANGES
bin/named/control.c
bin/named/include/named/server.h
bin/named/server.c
bin/rndc/rndc.c
doc/arm/Bv9ARM-book.xml

diff --git a/CHANGES b/CHANGES
index c82fef2310fa4f3ffcbf3060893973adbd6d7174..0808b39d81e2a6fb0c7a03f4cec0f0e1cb50c47d 100644 (file)
--- 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]
 
index 8a67b97ec07bc3edb6535a1e9945668350d4ea8f..200a359a5743540e027efedefb69a6b8503976d3 100644 (file)
@@ -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;
index e05222aaaa6e75b4c3d2d2c372c312d57fb019f7..17eaeefdde8b25e27e9514871b652fb1b03cf3fc 100644 (file)
@@ -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.)
  */
 
 /*%
index f61b924ed2d2a00e90a444155363d3eb322958e3..c3bbd05cc8d285707f6a98c3292a75e602835988 100644 (file)
@@ -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,
index 17583252ef32ceb0a99e40e312f989fad9aea215..ba617f66f2056258c4ee462d5b1e83dcbf2d6e44 100644 (file)
@@ -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\
index 11871a470b0228fb8de20e3ad2715736954067d4..bf4b38ef3fd6833d527d9293cedca8c6e98b49a6 100644 (file)
@@ -18,7 +18,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- File: $Id: Bv9ARM-book.xml,v 1.512 2011/11/03 22:06:21 each Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.513 2011/11/03 23:05:31 each Exp $ -->
 <book xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>BIND 9 Administrator Reference Manual</title>
 
@@ -1320,10 +1320,16 @@ zone "eng.example.com" {
                   </varlistentry>
 
                   <varlistentry>
-                    <term><userinput>querylog</userinput></term>
+                          <term><userinput>querylog</userinput>
+                                  <optional>on|off</optional>
                     <listitem>
                       <para>
-                        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.)
+                      </para>
+                      <para>
+                        Query logging can also be enabled
                         by explicitly directing the <command>queries</command>
                         <command>category</command> to a
                        <command>channel</command> in the