]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4190. [protocol] Accept Active Diretory gc._msdcs.<forest> name as
authorMark Andrews <marka@isc.org>
Sat, 22 Aug 2015 05:27:33 +0000 (15:27 +1000)
committerMark Andrews <marka@isc.org>
Sat, 22 Aug 2015 05:28:09 +0000 (15:28 +1000)
                        valid with check-names.  <forest> still needs to be
                        LDH. [RT #40399]

(cherry picked from commit dc3912f3caac1104fef441fd18571b7a975708ea)

CHANGES
bin/tests/system/checkzone/tests.sh
bin/tests/system/checkzone/zones/good-gc-msdcs.db [new file with mode: 0644]
lib/dns/include/dns/name.h
lib/dns/name.c
lib/dns/rdata.c
lib/dns/rdata/in_1/a_1.c
lib/dns/rdata/in_1/aaaa_28.c

diff --git a/CHANGES b/CHANGES
index ff31f422f709129d1d1c7256736872a0677a7d6c..f1c1bb3b7c2b62f1c7a5f5cdfdfeb1bf4fef33b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4190.  [protocol]      Accept Active Diretory gc._msdcs.<forest> name as
+                       valid with check-names.  <forest> still needs to be
+                       LDH. [RT #40399]
+
 4189.  [cleanup]       Don't exit on overly long tokens in named.conf.
                        [RT #40418]
 
index 9f9b0b5d46137125c9fb1d6b1c77212bd2fd6017..c2d88f9443b9641e84f17ce89d11112afe21a091 100644 (file)
@@ -22,7 +22,14 @@ for db in zones/good*.db
 do
        echo "I:checking $db ($n)"
        ret=0
-       $CHECKZONE -i local example $db > test.out.$n 2>&1 || ret=1
+       case $db in
+       zones/good-gc-msdcs.db)
+               $CHECKZONE -k fail -i local example $db > test.out.$n 2>&1 || ret=1
+               ;;
+       *)
+               $CHECKZONE -i local example $db > test.out.$n 2>&1 || ret=1
+               ;;
+       esac
        n=`expr $n + 1`
        if [ $ret != 0 ]; then echo "I:failed"; fi
        status=`expr $status + $ret`
diff --git a/bin/tests/system/checkzone/zones/good-gc-msdcs.db b/bin/tests/system/checkzone/zones/good-gc-msdcs.db
new file mode 100644 (file)
index 0000000..941112a
--- /dev/null
@@ -0,0 +1,19 @@
+; Copyright (C) 2015  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.
+
+$TTL 600
+@              SOA     ns hostmaster 2011012708 3600 1200 604800 1200
+               NS      ns
+ns             A       192.0.2.1
+gc._msdcs      A       192.0.2.2
index 51fcc526d6c512d25e148e67d90146d18f639a2a..74cdc46030ff92fbb11bb809b998e03609e873bc 100644 (file)
@@ -994,10 +994,6 @@ dns_name_split(dns_name_t *name, unsigned int suffixlabels,
  *
  *\li  'suffix' is a valid name or NULL, and cannot be read-only.
  *
- *\li  If non-NULL, 'prefix' and 'suffix' must have dedicated buffers.
- *
- *\li  'prefix' and 'suffix' cannot point to the same buffer.
- *
  * Ensures:
  *
  *\li  On success:
index 2f945165d743bf23faff60febfc395784ba9b4b3..87aeb6d11e8b7c167fa6c304af39d5b6cb735e56 100644 (file)
@@ -2154,11 +2154,9 @@ dns_name_split(dns_name_t *name, unsigned int suffixlabels,
        REQUIRE(prefix != NULL || suffix != NULL);
        REQUIRE(prefix == NULL ||
                (VALID_NAME(prefix) &&
-                prefix->buffer != NULL &&
                 BINDABLE(prefix)));
        REQUIRE(suffix == NULL ||
                (VALID_NAME(suffix) &&
-                suffix->buffer != NULL &&
                 BINDABLE(suffix)));
 
        splitlabel = name->labels - suffixlabels;
index 52453bd3b119dce9c61bb5ee6a8a8b22442b0b87..6dd568f292895d9d89a4a050ed2fa709c5552839 100644 (file)
@@ -224,6 +224,21 @@ unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
 /*% IPv6 Address Size */
 #define NS_LOCATORSZ   8
 
+/*
+ * Active Diretory gc._msdcs.<forest> prefix.
+ */
+static unsigned char gc_msdcs_data[]  = "\002gc\006_msdcs";
+static unsigned char gc_msdcs_offset [] = { 0, 3 };
+
+static const dns_name_t gc_msdcs = {
+       DNS_NAME_MAGIC,
+       gc_msdcs_data, 10, 2,
+       DNS_NAMEATTR_READONLY,
+       gc_msdcs_offset, NULL,
+       {(void *)-1, (void *)-1},
+       {NULL, NULL}
+};
+
 /*%
  *     convert presentation level address to network order binary form.
  * \return
index 5912d0a6a06569d69ea1e172a64016575ba8a995..3a5f4cb3c5a102cf2a2435c27f4cb996c0053821 100644 (file)
@@ -210,6 +210,7 @@ digest_in_a(ARGS_DIGEST) {
 
 static inline isc_boolean_t
 checkowner_in_a(ARGS_CHECKOWNER) {
+       dns_name_t prefix, suffix;
 
        REQUIRE(type == dns_rdatatype_a);
        REQUIRE(rdclass == dns_rdataclass_in);
@@ -217,6 +218,19 @@ checkowner_in_a(ARGS_CHECKOWNER) {
        UNUSED(type);
        UNUSED(rdclass);
 
+       /*
+        * Handle Active Diretory gc._msdcs.<forest> name.
+        */
+       if (dns_name_countlabels(name) > 2U) {
+               dns_name_init(&prefix, NULL);
+               dns_name_init(&suffix, NULL);
+               dns_name_split(name, dns_name_countlabels(name) - 2,
+                              &prefix, &suffix);
+               if (dns_name_equal(&gc_msdcs, &prefix) &&
+                   dns_name_ishostname(&suffix, ISC_FALSE))
+                       return (ISC_TRUE);
+       }
+
        return (dns_name_ishostname(name, wildcard));
 }
 
index 9e098944c993cc52d2bec61259f020ac2e0c8939..f0a40ebbd7472b03de91ce66b2a1305a5a544eb8 100644 (file)
@@ -207,6 +207,7 @@ digest_in_aaaa(ARGS_DIGEST) {
 
 static inline isc_boolean_t
 checkowner_in_aaaa(ARGS_CHECKOWNER) {
+       dns_name_t prefix, suffix;
 
        REQUIRE(type == dns_rdatatype_aaaa);
        REQUIRE(rdclass == dns_rdataclass_in);
@@ -214,6 +215,19 @@ checkowner_in_aaaa(ARGS_CHECKOWNER) {
        UNUSED(type);
        UNUSED(rdclass);
 
+       /*
+        * Handle Active Diretory gc._msdcs.<forest> name.
+        */
+       if (dns_name_countlabels(name) > 2U) {
+               dns_name_init(&prefix, NULL);
+               dns_name_init(&suffix, NULL);
+               dns_name_split(name, dns_name_countlabels(name) - 2,
+                              &prefix, &suffix);
+               if (dns_name_equal(&gc_msdcs, &prefix) &&
+                   dns_name_ishostname(&suffix, ISC_FALSE))
+                       return (ISC_TRUE);
+       }
+
        return (dns_name_ishostname(name, wildcard));
 }