]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Print unsigned values for serial, etc. in rndc zonestatus output (#39854)
authorMukund Sivaraman <muks@isc.org>
Tue, 23 Jun 2015 08:27:33 +0000 (13:57 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 23 Jun 2015 08:27:33 +0000 (13:57 +0530)
CHANGES
bin/named/server.c
bin/tests/system/zonechecks/bigserial.db [new file with mode: 0644]
bin/tests/system/zonechecks/ns1/named.conf
bin/tests/system/zonechecks/setup.sh
bin/tests/system/zonechecks/tests.sh

diff --git a/CHANGES b/CHANGES
index b0c5d0c1df0c95a4536f4d7b18b9fecbef34b0db..6f6fb2e61aa83c29ff8abdd068d8ed40e7484c48 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4140.  [bug]           A formatting bug caused rndc showzone to print
+                       negative numbers for large serial values. This has
+                       now been fixed. [RT #39854]
+
 4140.  [cleanup]       Remove redundant nzf_remove() call during delzone.
                        [RT #39844]
 
index 9db6caa48dfe8a1e4b83cc535de28d4572abbb9a..ca850f361322de18d7bed6e7e864cd9e115869ae 100644 (file)
@@ -10247,15 +10247,15 @@ ns_server_zonestatus(ns_server_t *server, char *args, isc_buffer_t **text) {
 
        /* Serial number */
        serial = dns_zone_getserial(hasraw ? raw : zone);
-       snprintf(serbuf, sizeof(serbuf), "%d", serial);
+       snprintf(serbuf, sizeof(serbuf), "%u", serial);
        if (hasraw) {
                signed_serial = dns_zone_getserial(zone);
-               snprintf(sserbuf, sizeof(sserbuf), "%d", signed_serial);
+               snprintf(sserbuf, sizeof(sserbuf), "%u", signed_serial);
        }
 
        /* Database node count */
        nodes = dns_db_nodecount(hasraw ? rawdb : db);
-       snprintf(nodebuf, sizeof(nodebuf), "%d", nodes);
+       snprintf(nodebuf, sizeof(nodebuf), "%u", nodes);
 
        /* Security */
        secure = dns_db_issecure(db);
diff --git a/bin/tests/system/zonechecks/bigserial.db b/bin/tests/system/zonechecks/bigserial.db
new file mode 100644 (file)
index 0000000..bdff8ec
--- /dev/null
@@ -0,0 +1,17 @@
+; Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
+;
+; Permission to use, copy, modify, and/or distribute this software for any
+; purpose with or without fee is hereby granted, provided that the above
+; copyright notice and this permission notice appear in all copies.
+;
+; THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+; REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+; AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+; INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+; LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+; OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+; PERFORMANCE OF THIS SOFTWARE.
+
+@      3600    IN SOA  ns hostmaster 3003113544 3600 1200 604800 3600
+@      3600    IN NS   ns
+ns     3600    IN A    10.53.0.1
index 4d1983cd3508fb068bc015c0be8b688acc2d5052..592b28cc42f0b07f9ac7d0404997fa1da51cc5c9 100644 (file)
@@ -61,6 +61,11 @@ view primary {
                auto-dnssec maintain;
        };
 
+       zone "bigserial.example" {
+               type master;
+               file "bigserial.db";
+       };
+
        zone "reload.example" {
                type master;
                file "reload.db";
index 0a6c0f6ac2c4755f69e3b71952c166c08aaf48fa..7f524f59fef01c173d7c425df12cd7f447374824 100644 (file)
@@ -23,6 +23,7 @@ test -r $RANDFILE || $GENRANDOM 400 $RANDFILE
 
 $SHELL ../genzone.sh 1 > ns1/master.db
 $SHELL ../genzone.sh 1 > ns1/duplicate.db
+cp bigserial.db ns1/
 cd ns1
 touch master.db.signed
 echo '$INCLUDE "master.db.signed"' >> master.db
index a1676e0dea88f80d81e87e4350ab94f6ed7636e2..f68c036c5cd360a554eefa1b323e50c78acdcd13 100644 (file)
@@ -171,7 +171,7 @@ done
 checkfor() {
        grep "$1" $2 > /dev/null || {
                ret=1;
-               echo "I: missing '$1' from '$2'"
+               echo "I: missing string '$1' from '$2'"
        }
 }
 checkfor "name: master.example" rndc.out.master
@@ -246,5 +246,12 @@ checkfor "no matching zone 'nosuchzone.example' in any view" rndc.out.duplicate
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
+echo "I: checking 'rdnc zonestatus' with big serial value"
+ret=0
+$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 zonestatus bigserial.example > rndc.out.bigserial 2>&1
+checkfor "serial: 3003113544" rndc.out.bigserial
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
 echo "I:exit status: $status"
 exit $status