From: Mark Andrews Date: Wed, 21 Nov 2012 23:14:41 +0000 (+1100) Subject: 3423. [bug] "rndc signing -nsec3param" didn't accept the full X-Git-Tag: v9.10.0a1~712 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8c9d5521e760ead39f75adc3c87dc1dd0f9c101d;p=thirdparty%2Fbind9.git 3423. [bug] "rndc signing -nsec3param" didn't accept the full range of possible values. Address portability issues. [RT #31938] Squashed commit of the following: commit cdc417909d514903363796085ab3114ef24b7e30 Author: Mark Andrews 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 --- diff --git a/CHANGES b/CHANGES index e4521d7af99..17c1520ea75 100644 --- 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] diff --git a/bin/named/server.c b/bin/named/server.c index 4c94688a764..e42884fa9fe 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -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) {