]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_11] normalize rndc on/off commands
authorEvan Hunt <each@isc.org>
Thu, 18 Jan 2018 18:49:19 +0000 (10:49 -0800)
committerEvan Hunt <each@isc.org>
Thu, 18 Jan 2018 18:52:15 +0000 (10:52 -0800)
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]

(cherry picked from commit cf8f4241e7826a6deb605d0b65ba625414805642)

CHANGES
bin/named/server.c
bin/rndc/rndc.c
bin/rndc/rndc.docbook

diff --git a/CHANGES b/CHANGES
index ac3ec56827d9dc99107a8c4e14e887e758c8fd3e..2285bfb69020d45c3d0318f1a1175543b466f485 100644 (file)
--- 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]
+
 4866.  [port]          DST library initialization verifies MD5 (when MD5
                        was not disabled) and SHA-1 hash and HMAC support.
                        [RT #46764]
index cba3be8420a82449a5789e0127f9528c9147485a..2539fd7157a012448a45f5eccb40f94ed2d45e3d 100644 (file)
@@ -9600,14 +9600,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);
@@ -10255,15 +10258,16 @@ 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 if (!strcasecmp(ptr, "check"))
+       } else if (!strcasecmp(ptr, "check") || !strcasecmp(ptr, "status")) {
                set = ISC_FALSE;
-       else
+       } else {
                return (DNS_R_SYNTAX);
+       }
 
        /* Look for the view name. */
        ptr = next_token(lex, text);
index f62071842515d8bc57a4ff215dc6cff621c7e26d..71674346ca1c303889bd96145ccca21267ece599 100644 (file)
@@ -144,7 +144,7 @@ command is one of the following:\n\
   nta -remove domain [view]\n\
                Remove a negative trust anchor, re-enabling validation\n\
                for the given domain.\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\
@@ -197,7 +197,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 | status ] [view]\n\
                Enable / disable DNSSEC validation.\n\
   zonestatus zone [class [view]]\n\
                Display the current status of a zone.\n\
index 6a9a7ac6cd23c36b4df40a8fcd983d4fc3559565..402f4cd7be1723ae233f6ead11708eb31cf8eac3 100644 (file)
       </varlistentry>
 
       <varlistentry>
-       <term><userinput>querylog</userinput> <optional>on|off</optional> </term>
+       <term><userinput>querylog</userinput> <optional> on | off </optional> </term>
        <listitem>
          <para>
            Enable or disable query logging.  (For backward
       </varlistentry>
 
       <varlistentry>
-       <term><userinput>validation ( on | off | check ) <optional><replaceable>view ...</replaceable></optional> </userinput></term>
+       <term><userinput>validation ( on | off | status ) <optional><replaceable>view ...</replaceable></optional> </userinput></term>
        <listitem>
          <para>
            Enable, disable, or check the current status of