]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3275. [bug] Corrected rndc -h output; the 'rndc sync -clean'
authorEvan Hunt <each@isc.org>
Tue, 7 Feb 2012 00:58:40 +0000 (00:58 +0000)
committerEvan Hunt <each@isc.org>
Tue, 7 Feb 2012 00:58:40 +0000 (00:58 +0000)
option had been misspelled as '-clear'.  (To avoid
future confusion, both options now work.) [RT #27173]

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

diff --git a/CHANGES b/CHANGES
index 323e943f10bfb2912485edff40e8b098d9e02644..8d329e6c28cbaac75d5462bd4b282023225d06ae 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 3276.  [bug]           win32: ns_os_openfile failed to return NULL on
                        safe_open failure. [RT #27696]
 
+3275.  [bug]           Corrected rndc -h output; the 'rndc sync -clean'
+                       option had been misspelled as '-clear'.  (To avoid
+                       future confusion, both options now work.) [RT #27173]
+
 3271.  [port]          darwin: mksymtbl is not always stable, loop several
                        times before giving up.  mksymtbl was using non
                        portable perl to covert 64 bit hex strings. [RT #27653]
index d88888c0514997f0c514f09148247dadcc884676..aa2f12a9cf0a9fa41b9693fc1ad5d9f249f6becd 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.638.4.2 2012/02/06 21:33:07 each Exp $ */
+/* $Id: server.c,v 1.638.4.3 2012/02/07 00:58:40 each Exp $ */
 
 /*! \file */
 
@@ -5898,11 +5898,10 @@ next_token(char **stringp, const char *delim) {
  * set '*zonep' to NULL.
  */
 static isc_result_t
-zone_from_args(ns_server_t *server, char *args, dns_zone_t **zonep,
-              const char **zonename, isc_boolean_t skip)
+zone_from_args(ns_server_t *server, char *args, const char *zonetxt,
+              dns_zone_t **zonep, const char **zonename, isc_boolean_t skip)
 {
        char *input, *ptr;
-       const char *zonetxt;
        char *classtxt;
        const char *viewtxt = NULL;
        dns_fixedname_t name;
@@ -5923,7 +5922,8 @@ zone_from_args(ns_server_t *server, char *args, dns_zone_t **zonep,
        }
 
        /* Look for the zone name. */
-       zonetxt = next_token(&input, " \t");
+       if (zonetxt == NULL)
+               zonetxt = next_token(&input, " \t");
        if (zonetxt == NULL)
                return (ISC_R_SUCCESS);
        if (zonename)
@@ -5988,7 +5988,7 @@ ns_server_retransfercommand(ns_server_t *server, char *args) {
        dns_zone_t *zone = NULL;
        dns_zonetype_t type;
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, NULL, &zone, NULL, ISC_TRUE);
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL)
@@ -6012,7 +6012,7 @@ ns_server_reloadcommand(ns_server_t *server, char *args, isc_buffer_t *text) {
        dns_zonetype_t type;
        const char *msg = NULL;
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, NULL, &zone, NULL, ISC_TRUE);
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL) {
@@ -6072,7 +6072,7 @@ ns_server_notifycommand(ns_server_t *server, char *args, isc_buffer_t *text) {
        dns_zone_t *zone = NULL;
        const unsigned char msg[] = "zone notify queued";
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, NULL, &zone, NULL, ISC_TRUE);
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL)
@@ -6097,7 +6097,7 @@ ns_server_refreshcommand(ns_server_t *server, char *args, isc_buffer_t *text) {
        const unsigned char msg2[] = "not a slave or stub zone";
        dns_zonetype_t type;
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, NULL, &zone, NULL, ISC_TRUE);
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL)
@@ -7228,7 +7228,7 @@ ns_server_rekey(ns_server_t *server, char *args) {
        if (strncasecmp(args, NS_COMMAND_SIGN, strlen(NS_COMMAND_SIGN)) == 0)
            fullsign = ISC_TRUE;
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, NULL, &zone, NULL, ISC_TRUE);
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL)
@@ -7289,21 +7289,19 @@ ns_server_sync(ns_server_t *server, char *args, isc_buffer_t *text) {
        dns_zone_t *zone = NULL;
        char classstr[DNS_RDATACLASS_FORMATSIZE];
        char zonename[DNS_NAME_FORMATSIZE];
-       const char *vname, *sep, *msg = NULL;
+       const char *vname, *sep, *msg = NULL, *arg;
        isc_boolean_t cleanup = ISC_FALSE;
-       char arg[8];
-       int n;
 
-       /* Did the user specify -clean? */
-       n = sscanf(args, "%*s %7s", arg);
-       if (n > 0 && strcmp(arg, "-clean") == 0) {
-               cleanup = ISC_TRUE;
+       (void) next_token(&args, " \t");
 
-               /* shift so that zone_from_args() won't be confused */
-               (void) next_token(&args, " \t");
+       arg = next_token(&args, " \t");
+       if (arg != NULL &&
+           (strcmp(arg, "-clean") == 0 || strcmp(arg, "-clear") == 0)) {
+               cleanup = ISC_TRUE;
+               arg = next_token(&args, " \t");
        }
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, arg, &zone, NULL, ISC_FALSE);
        if (result != ISC_R_SUCCESS)
                return (result);
 
@@ -7379,7 +7377,7 @@ ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args,
        isc_boolean_t frozen;
        const char *msg = NULL;
 
-       result = zone_from_args(server, args, &zone, NULL, ISC_TRUE);
+       result = zone_from_args(server, args, NULL, &zone, NULL, ISC_TRUE);
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL) {
@@ -7713,7 +7711,7 @@ ns_server_del_zone(ns_server_t *server, char *args) {
        FILE                  *ifp = NULL, *ofp = NULL;
 
        /* Parse parameters */
-       CHECK(zone_from_args(server, args, &zone, &zonename, ISC_TRUE));
+       CHECK(zone_from_args(server, args, NULL, &zone, &zonename, ISC_TRUE));
        if (result != ISC_R_SUCCESS)
                return (result);
        if (zone == NULL) {
@@ -7915,7 +7913,8 @@ ns_server_signing(ns_server_t *server, char *args, isc_buffer_t *text) {
 
        if (strcasecmp(ptr, "-list") == 0)
                list = ISC_TRUE;
-       else if (strcasecmp(ptr, "-clear") == 0) {
+       else if ((strcasecmp(ptr, "-clear") == 0)  ||
+                (strcasecmp(ptr, "-clean") == 0)) {
                clear = ISC_TRUE;
                ptr = next_token(&args, " \t");
                if (ptr == NULL)
@@ -7958,7 +7957,7 @@ ns_server_signing(ns_server_t *server, char *args, isc_buffer_t *text) {
        } else
                CHECK(DNS_R_SYNTAX);
 
-       CHECK(zone_from_args(server, args, &zone, NULL, ISC_FALSE));
+       CHECK(zone_from_args(server, args, NULL, &zone, NULL, ISC_FALSE));
        if (zone == NULL)
                CHECK(ISC_R_UNEXPECTEDEND);
 
index 20e5db119b38e8f5e9ad591b212893307da96281..1c23254a2f09a23ec61ef0f6c20acff6608f0475 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rndc.c,v 1.139 2011/11/29 00:49:26 marka Exp $ */
+/* $Id: rndc.c,v 1.139.52.1 2012/02/07 00:58:40 each Exp $ */
 
 /*! \file */
 
@@ -114,9 +114,9 @@ command is one of the following:\n\
   thaw         Enable updates to all dynamic zones and reload them.\n\
   thaw zone [class [view]]\n\
                Enable updates to a frozen dynamic zone and reload it.\n\
-  sync [-clear]        Dump changes to all dynamic zones to disk, and optionally\n\
+  sync [-clean]        Dump changes to all dynamic zones to disk, and optionally\n\
                remove their journal files.\n\
-  sync [-clear] zone [class [view]]\n\
+  sync [-clean] zone [class [view]]\n\
                Dump a single zone's changes to disk, and optionally\n\
                remove its journal file.\n\
   notify zone [class [view]]\n\