diff --git a/CHANGES b/CHANGES
index d6e37cd7f9..d7c5d82573 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+4867. [cleanup] Normalize rndc on/off commands (validation and
+ querylog) so they accept the same synonyms
+ for on/off (yes/no, true/false, enable/disable).
+ Thanks to Tony Finch. [RT #47022]
+
4863. [bug] Fix various other bugs reported by Valgrind's
memcheck tool. [RT #46978]
diff --git a/bin/named/server.c b/bin/named/server.c
index fbd277f5f8..563463c5b9 100644
--- a/bin/named/server.c
+++ b/bin/named/server.c
@@ -7219,14 +7219,17 @@ ns_server_togglequerylog(ns_server_t *server, isc_lex_t *lex) {
return (ISC_R_UNEXPECTEDEND);
ptr = next_token(lex, NULL);
- if (ptr == NULL)
- value = server->log_queries ? ISC_FALSE : ISC_TRUE;
- else if (strcasecmp(ptr, "yes") == 0 || strcasecmp(ptr, "on") == 0)
+ if (ptr == NULL) {
+ value = !prev;
+ } else if (!strcasecmp(ptr, "on") || !strcasecmp(ptr, "yes") ||
+ !strcasecmp(ptr, "enable") || !strcasecmp(ptr, "true")) {
value = ISC_TRUE;
- else if (strcasecmp(ptr, "no") == 0 || strcasecmp(ptr, "off") == 0)
+ } else if (!strcasecmp(ptr, "off") || !strcasecmp(ptr, "no") ||
+ !strcasecmp(ptr, "disable") || !strcasecmp(ptr, "false")) {
value = ISC_FALSE;
- else
- return (ISC_R_NOTFOUND);
+ } else {
+ return (DNS_R_SYNTAX);
+ }
if (server->log_queries == value)
return (ISC_R_SUCCESS);
@@ -7814,13 +7817,14 @@ ns_server_validation(ns_server_t *server, isc_lex_t *lex) {
return (ISC_R_UNEXPECTEDEND);
if (!strcasecmp(ptr, "on") || !strcasecmp(ptr, "yes") ||
- !strcasecmp(ptr, "enable") || !strcasecmp(ptr, "true"))
+ !strcasecmp(ptr, "enable") || !strcasecmp(ptr, "true")) {
enable = ISC_TRUE;
- else if (!strcasecmp(ptr, "off") || !strcasecmp(ptr, "no") ||
- !strcasecmp(ptr, "disable") || !strcasecmp(ptr, "false"))
+ } else if (!strcasecmp(ptr, "off") || !strcasecmp(ptr, "no") ||
+ !strcasecmp(ptr, "disable") || !strcasecmp(ptr, "false")) {
enable = ISC_FALSE;
- else
+ } else {
return (DNS_R_SYNTAX);
+ }
/* Look for the view name. */
ptr = next_token(lex, NULL);
diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c
index a86dd3b875..27a951bf39 100644
--- a/bin/rndc/rndc.c
+++ b/bin/rndc/rndc.c
@@ -123,7 +123,7 @@ command is one of the following:\n\
notify zone [class [view]]\n\
Resend NOTIFY messages for the zone.\n\
notrace Set debugging level to 0.\n\
- querylog newstate\n\
+ querylog [ on | off ]\n\
Enable / disable query logging.\n\
reconfig Reload configuration file and new zones only.\n\
recursing Dump the queries that are currently recursing (named.recursing)\n\
@@ -171,7 +171,7 @@ command is one of the following:\n\
Delete a TKEY-negotiated TSIG key.\n\
tsig-list List all currently active TSIG keys, including both statically\n\
configured and TKEY-negotiated keys.\n\
- validation newstate [view]\n\
+ validation [ yes | no ] [view]\n\
Enable / disable DNSSEC validation.\n\
\n\
Version: %s\n",
diff --git a/bin/rndc/rndc.docbook b/bin/rndc/rndc.docbook
index 5d08625b7f..97fa8df58e 100644
--- a/bin/rndc/rndc.docbook
+++ b/bin/rndc/rndc.docbook
@@ -397,7 +397,7 @@
- querylog on|off
+ querylog on | off
Enable or disable query logging. (For backward
@@ -714,7 +714,7 @@
- validation ( on | off | check ) view ...
+ validation ( on | off ) view ...
Enable, disable, or check the current status of