]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3423. [bug] "rndc signing -nsec3param" didn't accept the full
authorMark Andrews <marka@isc.org>
Wed, 21 Nov 2012 23:14:41 +0000 (10:14 +1100)
committerMark Andrews <marka@isc.org>
Wed, 21 Nov 2012 23:14:41 +0000 (10:14 +1100)
                        range of possible values.  Address portability issues.
                        [RT #31938]

Squashed commit of the following:

commit cdc417909d514903363796085ab3114ef24b7e30
Author: Mark Andrews <marka@isc.org>
Date:   Thu Nov 22 10:06:01 2012 +1100

    address hpux sscanf issues, iterations is a 16 bit field, use %hu rather than %hhd as the values are unsigned

CHANGES
bin/named/server.c

diff --git a/CHANGES b/CHANGES
index e4521d7af994dcc3160341527e03c49dd54449a7..17c1520ea75a2c844671cd03dab0362f5bba10ad 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3423.  [bug]           "rndc signing -nsec3param" didn't accept the full
+                       range of possible values.  Address portability issues.
+                       [RT #31938]
+
 3422.  [bug]           Added a clear error message for when the SOA does not 
                        match the referral. [RT #31281]
 
index 4c94688a76467bd8499a5f9cd50ffb4a04c283e0..e42884fa9fe9dc83a02569fc0a13147b692c4c20 100644 (file)
@@ -8118,7 +8118,7 @@ ns_server_signing(ns_server_t *server, char *args, isc_buffer_t *text) {
        isc_boolean_t list = ISC_FALSE, clear = ISC_FALSE;
        isc_boolean_t chain = ISC_FALSE;
        char keystr[DNS_SECALG_FORMATSIZE + 7];
-       isc_uint8_t hash = 0, flags = 0, iter = 0, saltlen = 0;
+       unsigned short hash = 0, flags = 0, iter = 0, saltlen = 0;
        unsigned char salt[255];
        const char *ptr;
        size_t n;
@@ -8165,11 +8165,13 @@ ns_server_signing(ns_server_t *server, char *args, isc_buffer_t *text) {
                                     hashstr, flagstr, iterstr);
                        if (n == sizeof(nbuf))
                                return (ISC_R_NOSPACE);
-                       n = sscanf(nbuf, "%hhd %hhd %hhd",
-                                  &hash, &flags, &iter);
+                       n = sscanf(nbuf, "%hu %hu %hu", &hash, &flags, &iter);
                        if (n != 3U)
                                return (ISC_R_BADNUMBER);
 
+                       if (hash > 0xffU || flags > 0xffU)
+                               return (ISC_R_RANGE);
+
                        ptr = next_token(&args, " \t");
                        if (ptr == NULL)
                                return (ISC_R_UNEXPECTEDEND);
@@ -8194,7 +8196,7 @@ ns_server_signing(ns_server_t *server, char *args, isc_buffer_t *text) {
                isc_buffer_putuint8(text, 0);
        } else if (chain) {
                CHECK(dns_zone_setnsec3param(zone, hash, flags, iter,
-                                               saltlen, salt, ISC_TRUE));
+                                            saltlen, salt, ISC_TRUE));
                isc_buffer_putstr(text, "request queued");
                isc_buffer_putuint8(text, 0);
        } else if (list) {