2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

3201. [func] 'rndc querylog' can now be given an on/off parameter

instead of only being used as a toggle. [RT #18351]
This commit is contained in:
Evan Hunt
2011-11-03 23:05:31 +00:00
parent 962d1c873e
commit f550b4b104
6 changed files with 44 additions and 13 deletions

View File

@@ -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]

View 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;

View 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.)
*/
/*%

View 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,

View 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\

View 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