]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_8] [36737] allow zero-length URI and CAA fields
authorEvan Hunt <each@isc.org>
Thu, 7 Aug 2014 00:48:56 +0000 (17:48 -0700)
committerEvan Hunt <each@isc.org>
Thu, 7 Aug 2014 00:48:56 +0000 (17:48 -0700)
3914. [bug] Allow the URI target and CAA value fields to
be zero length. [RT #36737]

(cherry picked from commit cfe32752a66fe1f050d5ed7ddce75f6d58fe1637)
(cherry picked from commit a766d4c1d27c0e81c75493a1f7d5aa351bcf6cc0)

CHANGES
bin/tests/system/acl/clean.sh
bin/tests/system/acl/tests.sh
bin/tests/system/genzone.sh
bin/tests/system/xfer/dig1.good
bin/tests/system/xfer/dig2.good
lib/dns/rdata.c
lib/dns/rdata/generic/caa_257.c
lib/dns/rdata/generic/uri_256.c

diff --git a/CHANGES b/CHANGES
index b2a301cd8827ec9356b9227e3aa39ef924824a60..c7110e5fb569a4628f9c40d2864cea18fb8a70f9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
        --- 9.8.8b2 released ---
 
+3914.  [bug]           Allow the URI target and CAA value fields to
+                       be zero length. [RT #36737]
+
 3913.  [bug]           Address race issue in dispatch. [RT #36731]
 
 3910.  [bug]           Fix races to free event during shutdown. [RT#36720]
index a791698a12a31bc403500498b0ea5314f9167c33..356c8bc0c2a9ca2fd65455e39ab3947d64b16354 100644 (file)
@@ -20,6 +20,6 @@
 # Clean up after zone transfer tests.
 #
 
-rm -f dig.out
+rm -f dig.out.*
 rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl ns2/named.conf
 rm -f */named.memstats
index 7207c5a1d3acc4a44211564fd5a3134b424f4786..c10e0e78568befddc2348cebad650f3799892afa 100644 (file)
@@ -28,14 +28,15 @@ echo "I:testing basic ACL processing"
 # key "one" should fail
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+
 
 # any other key should be fine
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 cp -f ns2/named2.conf ns2/named.conf
 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /'
@@ -44,19 +45,19 @@ sleep 5
 # prefix 10/8 should fail
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 # any other address should work, as long as it sends key "one"
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 127.0.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 echo "I:testing nested ACL processing"
 # all combinations of 10.53.0.{1|2} with key {one|two}, should succeed
@@ -67,43 +68,43 @@ sleep 5
 # should succeed
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 # should succeed
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 # should succeed
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 # should succeed
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 # but only one or the other should fail
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 127.0.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.2 axfr -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $tt failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.2 axfr -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $tt failed" ; status=1; }
 
 # and other values? right out
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 127.0.0.1 axfr -y three:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 # now we only allow 10.53.0.1 *and* key one, or 10.53.0.2 *and* key two
 cp -f ns2/named4.conf ns2/named.conf
@@ -113,32 +114,32 @@ sleep 5
 # should succeed
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.2 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 # should succeed
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 && { echo "I:test $t failed" ; status=1; }
 
 # should fail
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.2 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 # should fail
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.1 axfr -y two:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 # should fail
 t=`expr $t + 1`
 $DIG $DIGOPTS tsigzone. \
-       @10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 -p 5300 > dig.out
-grep "^;" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.3 axfr -y one:1234abcd8765 -p 5300 > dig.out.${t}
+grep "^;" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 echo "I:testing allow-query-on ACL processing"
 cp -f ns2/named5.conf ns2/named.conf
@@ -146,8 +147,8 @@ $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reload 2>&1 | sed 's/^/I:ns2 /
 sleep 5
 t=`expr $t + 1`
 $DIG +tcp soa example. \
-       @10.53.0.2 -b 10.53.0.3 -p 5300 > dig.out
-grep "status: NOERROR" dig.out > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
+       @10.53.0.2 -b 10.53.0.3 -p 5300 > dig.out.${t}
+grep "status: NOERROR" dig.out.${t} > /dev/null 2>&1 || { echo "I:test $t failed" ; status=1; }
 
 echo "I:exit status: $status"
 exit $status
index ee0ebdef1bfcd5dac294e5d9a8316d421969730c..9bd4e30eed2e52f3008d3e39ee757e9ccc28a8f3 100644 (file)
@@ -302,10 +302,12 @@ eui64                     EUI64   01-23-45-67-89-ab-cd-ef
 ; type 256
 uri01                  URI     10 20 "https://www.isc.org/"
 uri02                  URI     30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
+uri03                  URI     30 40 ""
 
 ; type 257
 caa01                   CAA     0 issue "ca.example.net; policy=ev"
 caa02                   CAA     128 tbs "Unknown"
+caa03                   CAA     128 tbs ""
 
 ; keydata (internal type used for managed-keys)
 keydata                        TYPE65533       \# 0
index 73092cda726f5990244c1020c6044a7aa1a8399b..15842ab4d6d1bdfbd039b5670941c988b561c24e 100644 (file)
@@ -11,6 +11,7 @@ afsdb01.example.      3600    IN      AFSDB   0 hostname.example.
 afsdb02.example.       3600    IN      AFSDB   65535 .
 caa01.example.         3600    IN      CAA     0 issue "ca.example.net\; policy=ev"
 caa02.example.         3600    IN      CAA     128 tbs "Unknown"
+caa03.example.         3600    IN      CAA     128 tbs ""
 cdnskey01.example.     3600    IN      CDNSKEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aRyzWZriO6i2od GWWQVucZqKVsENW91IOW4vqudngPZsY3GvQ/xVA8/7pyFj6b7Esga60z yGW6LFe9r8n6paHrlG5ojqf0BaqHT+8=
 cds01.example.         3600    IN      CDS     30795 1 1 310D27F4D82C1FC2400704EA9939FE6E1CEAA3B9
 cert01.example.                3600    IN      CERT    65534 65535 PRIVATEOID MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6V AuHAoNUz4YoU1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY=
@@ -91,6 +92,7 @@ txt11.example.                3600    IN      TXT     "\"foo\""
 txt12.example.         3600    IN      TXT     "\"foo\""
 uri01.example.         3600    IN      URI     10 20 "https://www.isc.org/"
 uri02.example.         3600    IN      URI     30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
+uri03.example.         3600    IN      URI     30 40 ""
 wks01.example.         3600    IN      WKS     10.0.0.1 6 0 1 2 21 23
 wks02.example.         3600    IN      WKS     10.0.0.1 17 0 1 2 53
 wks03.example.         3600    IN      WKS     10.0.0.2 6 65535
index f5eed453d6598d0ea500d0daf6547ba5fe63b7cd..2586c9acdcdaa2a9b91d9563c100d490452078bf 100644 (file)
@@ -11,6 +11,7 @@ afsdb01.example.      3600    IN      AFSDB   0 hostname.example.
 afsdb02.example.       3600    IN      AFSDB   65535 .
 caa01.example.         3600    IN      CAA     0 issue "ca.example.net\; policy=ev"
 caa02.example.         3600    IN      CAA     128 tbs "Unknown"
+caa03.example.         3600    IN      CAA     128 tbs ""
 cdnskey01.example.     3600    IN      CDNSKEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aRyzWZriO6i2od GWWQVucZqKVsENW91IOW4vqudngPZsY3GvQ/xVA8/7pyFj6b7Esga60z yGW6LFe9r8n6paHrlG5ojqf0BaqHT+8=
 cds01.example.         3600    IN      CDS     30795 1 1 310D27F4D82C1FC2400704EA9939FE6E1CEAA3B9
 cert01.example.                3600    IN      CERT    65534 65535 PRIVATEOID MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgiWCn/GxHhai6V AuHAoNUz4YoU1tVfSCSqQYn6//11U6Nld80jEeC8aTrO+KKmCaY=
@@ -91,6 +92,7 @@ txt11.example.                3600    IN      TXT     "\"foo\""
 txt12.example.         3600    IN      TXT     "\"foo\""
 uri01.example.         3600    IN      URI     10 20 "https://www.isc.org/"
 uri02.example.         3600    IN      URI     30 40 "https://www.isc.org/HolyCowThisSureIsAVeryLongURIRecordIDontEvenKnowWhatSomeoneWouldEverWantWithSuchAThingButTheSpecificationRequiresThatWesupportItSoHereWeGoTestingItLaLaLaLaLaLaLaSeriouslyThoughWhyWouldYouEvenConsiderUsingAURIThisLongItSeemsLikeASillyIdeaButEnhWhatAreYouGonnaDo/"
+uri03.example.         3600    IN      URI     30 40 ""
 wks01.example.         3600    IN      WKS     10.0.0.1 6 0 1 2 21 23
 wks02.example.         3600    IN      WKS     10.0.0.1 17 0 1 2 53
 wks03.example.         3600    IN      WKS     10.0.0.2 6 65535
index 19d5dcae81c316e0ffb014a1643518cb8e3d2d36..5f2b6713ab32203408bb442205082c5dfcb12206 100644 (file)
@@ -128,9 +128,6 @@ multitxt_totext(isc_region_t *source, isc_buffer_t *target);
 static isc_result_t
 multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target);
 
-static isc_result_t
-multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target);
-
 static isc_boolean_t
 name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target);
 
@@ -1398,34 +1395,6 @@ multitxt_fromtext(isc_textregion_t *source, isc_buffer_t *target) {
        return (ISC_R_SUCCESS);
 }
 
-static isc_result_t
-multitxt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
-       unsigned int n;
-       isc_region_t sregion;
-       isc_region_t tregion;
-
-       isc_buffer_activeregion(source, &sregion);
-       if (sregion.length == 0)
-               return(ISC_R_UNEXPECTEDEND);
-       n = 256U;
-       do {
-               if (n != 256U)
-                       return (DNS_R_SYNTAX);
-
-               n = sregion.length;
-
-               isc_buffer_availableregion(target, &tregion);
-               if (n > tregion.length)
-                       return (ISC_R_NOSPACE);
-
-               memmove(tregion.base, sregion.base, n);
-               isc_buffer_forward(source, n);
-               isc_buffer_add(target, n);
-               isc_buffer_activeregion(source, &sregion);
-       } while (sregion.length != 0);
-       return (ISC_R_SUCCESS);
-}
-
 static isc_boolean_t
 name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target) {
        int l1, l2;
index 8ca43de28b2d7e68c4e00db35df48679cb059dd3..993e3267e6236da1357a91b7d6722281eac6ebc0 100644 (file)
@@ -152,20 +152,15 @@ fromwire_caa(ARGS_FROMWIRE) {
        if (sr.length < len || len == 0)
                RETERR(DNS_R_FORMERR);
 
-       /* Tag */
+       /* Check the Tag's value */
        for (i = 0; i < len; i++)
                if (!alphanumeric[sr.base[i]])
                        RETERR(DNS_R_FORMERR);
-       RETERR(mem_tobuffer(target, sr.base, len));
-       isc_region_consume(&sr, len);
-       isc_buffer_forward(source, len);
-
        /*
-        * Value
+        * Tag + Value
         */
-       RETERR(multitxt_fromwire(source, target));
-
-       return (ISC_R_SUCCESS);
+       isc_buffer_forward(source, sr.length);
+       return (mem_tobuffer(target, sr.base, sr.length));
 }
 
 static inline isc_result_t
index f8cb5ec4881a13928d95bf7103ed09dc448f3731..72df8e1b0e6cde824a5f4f226f7745ed7c30ce83 100644 (file)
@@ -115,15 +115,12 @@ fromwire_uri(ARGS_FROMWIRE) {
        isc_buffer_activeregion(source, &region);
        if (region.length < 4)
                return (ISC_R_UNEXPECTEDEND);
-       RETERR(mem_tobuffer(target, region.base, 4));
-       isc_buffer_forward(source, 4);
 
        /*
-        * Target URI
+        * Priority, weight and target URI
         */
-       RETERR(multitxt_fromwire(source, target));
-
-       return (ISC_R_SUCCESS);
+       isc_buffer_forward(source, region.length);
+       return (mem_tobuffer(target, region.base, region.length));
 }
 
 static inline isc_result_t
@@ -178,8 +175,6 @@ compare_uri(ARGS_COMPARE) {
 static inline isc_result_t
 fromstruct_uri(ARGS_FROMSTRUCT) {
        dns_rdata_uri_t *uri = source;
-       isc_region_t region;
-       isc_uint8_t len;
 
        REQUIRE(type == 256);
        REQUIRE(source != NULL);
@@ -203,18 +198,6 @@ fromstruct_uri(ARGS_FROMSTRUCT) {
        /*
         * Target URI
         */
-       len = 255U;
-       region.base = uri->target;
-       region.length = uri->tgt_len;
-       while (region.length > 0) {
-               REQUIRE(len == 255U);
-               len = uint8_fromregion(&region);
-               isc_region_consume(&region, 1);
-               if (region.length < len)
-                       return (ISC_R_UNEXPECTEDEND);
-               isc_region_consume(&region, len);
-       }
-
        return (mem_tobuffer(target, uri->target, uri->tgt_len));
 }