]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1528. [cleanup] Simplify some dns_name_ functions based on the
authorTatuya JINMEI 神明達哉 <jinmei@isc.org>
Sat, 25 Oct 2003 00:31:12 +0000 (00:31 +0000)
committerTatuya JINMEI 神明達哉 <jinmei@isc.org>
Sat, 25 Oct 2003 00:31:12 +0000 (00:31 +0000)
deprecation of bitstring labels.

13 files changed:
CHANGES
bin/named/query.c
bin/tests/name_test.c
bin/tests/names/t_names.c
bin/tests/rbt/t_rbt.c
lib/dns/adb.c
lib/dns/dnssec.c
lib/dns/include/dns/name.h
lib/dns/lookup.c
lib/dns/name.c
lib/dns/rbt.c
lib/dns/resolver.c
lib/dns/validator.c

diff --git a/CHANGES b/CHANGES
index 7eef922d3969cb827a82b45477ecbc0a67f7be71..2999ef6465f3bd104ddf768d2fb740ab96831486 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,5 @@
-1528.  [placeholder]
+1528.  [cleanup]       Simplify some dns_name_ functions based on the
+                       deprecation of bitstring labels.
 
 1527.  [cleanup]       Reduce the number of gettimeofday() calls without
                        losing necessary timer granularity.
index 7388be2fb39b8698b40e8336966a3377357e1711..0a520f5deb89142824e0754da28b9510ee60bb93 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.247 2003/09/30 05:56:01 marka Exp $ */
+/* $Id: query.c,v 1.248 2003/10/25 00:31:06 jinmei Exp $ */
 
 #include <config.h>
 
@@ -1829,7 +1829,7 @@ query_addwildcardproof(ns_client_t *client, dns_db_t *db,
        dns_name_t *tname;
        dns_dbnode_t *node;
        unsigned int options;
-       unsigned int odepth, ndepth, i;
+       unsigned int olabels, nlabels, i;
        isc_boolean_t done;
        isc_result_t result;
 
@@ -1870,11 +1870,11 @@ query_addwildcardproof(ns_client_t *client, dns_db_t *db,
                        query_releasename(client, &fname);
        }
 
-       odepth = dns_name_depth(dns_db_origin(db));
-       ndepth = dns_name_depth(name);
+       olabels = dns_name_countlabels(dns_db_origin(db));
+       nlabels = dns_name_countlabels(name);
        done = ISC_FALSE;
 
-       for (i = ndepth - 1; i >= odepth && !done; i--) {
+       for (i = nlabels - 1; i >= olabels && !done; i--) {
                /*
                 * We'll need some resources...
                 */
@@ -1889,9 +1889,7 @@ query_addwildcardproof(ns_client_t *client, dns_db_t *db,
 
                dns_fixedname_init(&tfixed);
                tname = dns_fixedname_name(&tfixed);
-               result = dns_name_splitatdepth(name, i, NULL, tname);
-               if (result != ISC_R_SUCCESS)
-                       continue;
+               dns_name_split(name, i, NULL, tname);
                result = dns_name_concatenate(dns_wildcardname, tname, tname,
                                              NULL);
                if (result != ISC_R_SUCCESS)
@@ -1983,8 +1981,7 @@ query_addnxrrsetnsec(ns_client_t *client, dns_db_t *db, dns_name_t **namep,
        fname = query_newname(client, dbuf, &b);
        if (fname == NULL)
                return;
-       RUNTIME_CHECK(dns_name_splitatdepth(name, sig.labels + 1, NULL,
-                                           fname) == ISC_R_SUCCESS);
+       dns_name_split(name, sig.labels + 1, NULL, fname);
        /* This will succeed, since we've stripped labels. */
        RUNTIME_CHECK(dns_name_concatenate(dns_wildcardname, fname, fname,
                                           NULL) == ISC_R_SUCCESS);
@@ -2265,7 +2262,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
        dns_rdata_t rdata = DNS_RDATA_INIT;
        dns_rdatasetiter_t *rdsiter;
        isc_boolean_t want_restart, authoritative, is_zone, need_wildcardproof;
-       unsigned int n, nlabels, nbits;
+       unsigned int n, nlabels;
        dns_namereln_t namereln;
        int order;
        isc_buffer_t *dbuf;
@@ -2901,7 +2898,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
                 * we're going to have to split qname later on.
                 */
                namereln = dns_name_fullcompare(client->query.qname, fname,
-                                               &order, &nlabels, &nbits);
+                                               &order, &nlabels);
                INSIST(namereln == dns_namereln_subdomain);
                /*
                 * Keep a copy of the rdataset.  We have to do this because
@@ -2958,12 +2955,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype)
                 */
                dns_fixedname_init(&fixed);
                prefix = dns_fixedname_name(&fixed);
-               result = dns_name_split(client->query.qname, nlabels, nbits,
-                                       prefix, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       dns_message_puttempname(client->message, &tname);
-                       goto cleanup;
-               }
+               dns_name_split(client->query.qname, nlabels, prefix, NULL);
                INSIST(fname == NULL);
                dbuf = query_getnamebuf(client);
                if (dbuf == NULL) {
index 3c8966a6a5b60d24d6984591badbf4d2528e3cc4..eef93454ccdc00326c950dcbc32965a5498e9beb 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: name_test.c,v 1.34 2001/11/27 01:55:19 gson Exp $ */
+/* $Id: name_test.c,v 1.35 2003/10/25 00:31:07 jinmei Exp $ */
 
 #include <config.h>
 
@@ -83,7 +83,7 @@ main(int argc, char *argv[]) {
        isc_boolean_t test_downcase = ISC_FALSE;
        isc_boolean_t inplace = ISC_FALSE;
        isc_boolean_t want_split = ISC_FALSE;
-       unsigned int depth, split_depth = 0;
+       unsigned int labels, split_label = 0;
        dns_fixedname_t fprefix, fsuffix;
        dns_name_t *prefix, *suffix;
        int ch;
@@ -107,7 +107,7 @@ main(int argc, char *argv[]) {
                        break;
                case 's':
                        want_split = ISC_TRUE;
-                       split_depth = atoi(isc_commandline_argument);
+                       split_label = atoi(isc_commandline_argument);
                        break;
                case 'w':
                        check_wildcard = ISC_TRUE;
@@ -292,11 +292,11 @@ main(int argc, char *argv[]) {
 
                if (comp != NULL && dns_name_countlabels(name) > 0) {
                        int order;
-                       unsigned int nlabels, nbits;
+                       unsigned int nlabels;
                        dns_namereln_t namereln;
 
                        namereln = dns_name_fullcompare(name, comp, &order,
-                                                       &nlabels, &nbits);
+                                                       &nlabels);
                        if (!quiet) {
                                if (order < 0)
                                        printf("<");
@@ -327,24 +327,18 @@ main(int argc, char *argv[]) {
                               dns_name_equal(name, comp) ? "TRUE" : "FALSE");
                }
 
-               depth = dns_name_depth(name);
-               if (want_split && split_depth < depth) {
+               labels = dns_name_countlabels(name);
+               if (want_split && split_label < labels) {
                        dns_fixedname_init(&fprefix);
                        prefix = dns_fixedname_name(&fprefix);
                        dns_fixedname_init(&fsuffix);
                        suffix = dns_fixedname_name(&fsuffix);
-                       printf("splitting at depth %u: ", split_depth);
-                       result = dns_name_splitatdepth(name, split_depth,
-                                                      prefix, suffix);
-                       if (result == ISC_R_SUCCESS) {
-                               printf("\n    prefix = ");
-                               print_name(prefix);
-                               printf("    suffix = ");
-                               print_name(suffix);
-                       } else {
-                               printf("failed: %s\n",
-                                      isc_result_totext(result));
-                       }
+                       printf("splitting at label %u: ", split_label);
+                       dns_name_split(name, split_label, prefix, suffix);
+                       printf("\n    prefix = ");
+                       print_name(prefix);
+                       printf("    suffix = ");
+                       print_name(suffix);
                }
 
                if (concatenate) {
index 9f223a0ec4b6c1a597c95d5788ed3bbb6de48d46..6d83950e2aafcc2d9bc80377714a05fc4a841d0b 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: t_names.c,v 1.34 2002/08/27 04:53:39 marka Exp $ */
+/* $Id: t_names.c,v 1.35 2003/10/25 00:31:08 jinmei Exp $ */
 
 #include <config.h>
 
@@ -710,7 +710,7 @@ t_dns_name_hash(void) {
 }
 
 static const char *a10 =
-               "dns_name_fullcompare(name1, name2, orderp, nlabelsp, nbitsp) "
+               "dns_name_fullcompare(name1, name2, orderp, nlabelsp) "
                "returns the DNSSEC ordering relationship between name1 and "
                "name2, sets orderp to -1 if name1 < name2, to 0 if "
                "name1 == name2, or to 1 if name1 > name2, sets nlabelsp "
@@ -744,13 +744,12 @@ dns_namereln_to_text(dns_namereln_t reln) {
 static int
 test_dns_name_fullcompare(char *name1, char *name2,
                          dns_namereln_t exp_dns_reln,
-                         int exp_order, int exp_nlabels, int exp_nbits)
+                         int exp_order, int exp_nlabels)
 {
        int             result;
        int             nfails;
        int             order;
        unsigned int    nlabels;
-       unsigned int    nbits;
        dns_name_t      dns_name1;
        dns_name_t      dns_name2;
        isc_result_t    dns_result;
@@ -768,7 +767,7 @@ test_dns_name_fullcompare(char *name1, char *name2,
                dns_result = dname_from_tname(name2, &dns_name2);
                if (dns_result == ISC_R_SUCCESS) {
                        dns_reln = dns_name_fullcompare(&dns_name1, &dns_name2,
-                                       &order, &nlabels, &nbits);
+                                       &order, &nlabels);
 
                        if (dns_reln != exp_dns_reln) {
                                ++nfails;
@@ -794,12 +793,6 @@ test_dns_name_fullcompare(char *name1, char *name2,
                                t_info("expecting %d labels, got %d\n",
                                       exp_nlabels, nlabels);
                        }
-                       if ((exp_nbits >= 0) &&
-                           (nbits != (unsigned int)exp_nbits)) {
-                               ++nfails;
-                               t_info("expecting %d bits, got %d\n",
-                                      exp_nbits, nbits);
-                       }
                        if (nfails == 0)
                                result = T_PASS;
                        else
@@ -845,7 +838,7 @@ t_dns_name_fullcompare(void) {
                        if (cnt == 6) {
                                /*
                                 * name1, name2, exp_reln, exp_order,
-                                * exp_nlabels, exp_nbits
+                                * exp_nlabels
                                 */
                                if (!strcmp(Tokens[2], "none"))
                                        reln = dns_namereln_none;
@@ -867,8 +860,7 @@ t_dns_name_fullcompare(void) {
                                                Tokens[1],
                                                reln,
                                                atoi(Tokens[3]),
-                                               atoi(Tokens[4]),
-                                               atoi(Tokens[5]));
+                                               atoi(Tokens[4]));
                        } else {
                                t_info("bad format at line %d\n", line);
                        }
@@ -1509,7 +1501,6 @@ test_dns_name_fromregion(char *test_name) {
        int             result;
        int             order;
        unsigned int    nlabels;
-       unsigned int    nbits;
        isc_result_t    dns_result;
        dns_name_t      dns_name1;
        dns_name_t      dns_name2;
@@ -1528,7 +1519,7 @@ test_dns_name_fromregion(char *test_name) {
                dns_name_init(&dns_name2, NULL);
                dns_name_fromregion(&dns_name2, &region);
                dns_namereln = dns_name_fullcompare(&dns_name1, &dns_name2,
-                                                   &order, &nlabels, &nbits);
+                                                   &order, &nlabels);
                if (dns_namereln == dns_namereln_equal)
                        result = T_PASS;
                else
@@ -1647,7 +1638,6 @@ test_dns_name_fromtext(char *test_name1, char *test_name2, char *test_origin,
        int             result;
        int             order;
        unsigned int    nlabels;
-       unsigned int    nbits;
        unsigned char   junk1[BUFLEN];
        unsigned char   junk2[BUFLEN];
        unsigned char   junk3[BUFLEN];
@@ -1711,7 +1701,7 @@ test_dns_name_fromtext(char *test_name1, char *test_name2, char *test_origin,
        }
 
        dns_namereln = dns_name_fullcompare(&dns_name1, &dns_name2, &order,
-                                           &nlabels, &nbits);
+                                           &nlabels);
 
        if (dns_namereln == dns_namereln_equal)
                result = T_PASS;
@@ -1787,7 +1777,6 @@ test_dns_name_totext(char *test_name, isc_boolean_t omit_final) {
        int             len;
        int             order;
        unsigned int    nlabels;
-       unsigned int    nbits;
        unsigned char   junk1[BUFLEN];
        unsigned char   junk2[BUFLEN];
        unsigned char   junk3[BUFLEN];
@@ -1847,7 +1836,7 @@ test_dns_name_totext(char *test_name, isc_boolean_t omit_final) {
        }
 
        dns_namereln = dns_name_fullcompare(&dns_name1, &dns_name2,
-                                           &order, &nlabels, &nbits);
+                                           &order, &nlabels);
        if (dns_namereln == dns_namereln_equal)
                result = T_PASS;
        else {
@@ -1960,7 +1949,6 @@ test_dns_name_fromwire(char *datafile_name, int testname_offset, int downcase,
        int                     result;
        int                     order;
        unsigned int            nlabels;
-       unsigned int            nbits;
        int                     len;
        unsigned char           buf1[BIGBUFLEN];
        char                    buf2[BUFLEN];
@@ -1994,8 +1982,7 @@ test_dns_name_fromwire(char *datafile_name, int testname_offset, int downcase,
                if (dns_result == ISC_R_SUCCESS) {
                        dns_namereln = dns_name_fullcompare(&dns_name1,
                                                            &dns_name2,
-                                                           &order, &nlabels,
-                                                           &nbits);
+                                                           &order, &nlabels);
                        if (dns_namereln != dns_namereln_equal) {
                                t_info("dns_name_fullcompare  returned %s\n",
                                       dns_namereln_to_text(dns_namereln));
index f6494491a724a1e00f64cf05abe726382123c169..a20fe1edc9576b07edf26cb31fe05c7164c5c680 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: t_rbt.c,v 1.23 2001/01/09 21:42:11 bwelling Exp $ */
+/* $Id: t_rbt.c,v 1.24 2003/10/25 00:31:08 jinmei Exp $ */
 
 #include <config.h>
 
@@ -581,7 +581,6 @@ t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) {
        int             cnt;
        int             order;
        unsigned int    nlabels;
-       unsigned int    nbits;
        int             nprobs;
        isc_result_t    dns_result;
 
@@ -668,7 +667,7 @@ t9_walkchain(dns_rbtnodechain_t *chain, dns_rbt_t *rbt) {
                        (void)dns_name_fullcompare(
                                                dns_fixedname_name(&fullname1),
                                                dns_fixedname_name(&fullname2),
-                                               &order, &nlabels, &nbits);
+                                               &order, &nlabels);
 
                        if (order >= 0) {
                            t_info("unexpected order %s %s %s\n",
index 78bb552a93a1ea2fea88a3d8485fbffc50852637..e05affd0b43150b76bf15fd1e97e5e25d44b98cb 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: adb.c,v 1.210 2003/10/17 03:46:43 marka Exp $ */
+/* $Id: adb.c,v 1.211 2003/10/25 00:31:08 jinmei Exp $ */
 
 /*
  * Implementation notes
@@ -958,7 +958,7 @@ set_target(dns_adb_t *adb, dns_name_t *name, dns_name_t *fname,
 {
        isc_result_t result;
        dns_namereln_t namereln;
-       unsigned int nlabels, nbits;
+       unsigned int nlabels;
        int order;
        dns_rdata_t rdata = DNS_RDATA_INIT;
        dns_fixedname_t fixed1, fixed2;
@@ -987,8 +987,7 @@ set_target(dns_adb_t *adb, dns_name_t *name, dns_name_t *fname,
                dns_rdata_dname_t dname;
 
                INSIST(rdataset->type == dns_rdatatype_dname);
-               namereln = dns_name_fullcompare(name, fname, &order,
-                                               &nlabels, &nbits);
+               namereln = dns_name_fullcompare(name, fname, &order, &nlabels);
                INSIST(namereln == dns_namereln_subdomain);
                /*
                 * Get the target name of the DNAME.
@@ -1007,13 +1006,7 @@ set_target(dns_adb_t *adb, dns_name_t *name, dns_name_t *fname,
                prefix = dns_fixedname_name(&fixed1);
                dns_fixedname_init(&fixed2);
                new_target = dns_fixedname_name(&fixed2);
-               result = dns_name_split(name, nlabels, nbits, prefix, NULL);
-               if (result != ISC_R_SUCCESS) {
-                       dns_rdata_freestruct(&dname);
-                       return (result);
-               }
-               result = dns_name_concatenate(prefix, &dname.dname, new_target,
-                                             NULL);
+               dns_name_split(name, nlabels, prefix, NULL);
                dns_rdata_freestruct(&dname);
                if (result != ISC_R_SUCCESS)
                        return (result);
index 9045a205762011a9e9e1a31b1759feec7f386082..b18bf8a490e8c265b786abc2bac998e589009d85 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id: dnssec.c,v 1.77 2003/09/30 05:56:10 marka Exp $
+ * $Id: dnssec.c,v 1.78 2003/10/25 00:31:09 jinmei Exp $
  */
 
 
@@ -182,7 +182,7 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
        dns_fixedname_t fnewname;
 
        REQUIRE(name != NULL);
-       REQUIRE(dns_name_depth(name) <= 255);
+       REQUIRE(dns_name_countlabels(name) <= 255);
        REQUIRE(set != NULL);
        REQUIRE(key != NULL);
        REQUIRE(inception != NULL);
@@ -212,7 +212,7 @@ dns_dnssec_sign(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
 
        sig.covered = set->type;
        sig.algorithm = dst_key_alg(key);
-       sig.labels = dns_name_depth(name) - 1;
+       sig.labels = dns_name_countlabels(name) - 1;
        if (dns_name_iswildcard(name))
                sig.labels--;
        sig.originalttl = set->ttl;
@@ -403,11 +403,10 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
         * If the name is an expanded wildcard, use the wildcard name.
         */
        dns_fixedname_init(&fnewname);
-       labels = dns_name_depth(name) - 1;
+       labels = dns_name_countlabels(name) - 1;
        if (labels - sig.labels > 0) {
-               RUNTIME_CHECK(dns_name_splitatdepth(name, sig.labels + 1, NULL,
-                                           dns_fixedname_name(&fnewname))
-                             == ISC_R_SUCCESS);
+               dns_name_split(name, sig.labels + 1, NULL,
+                              dns_fixedname_name(&fnewname));
                RUNTIME_CHECK(dns_name_downcase(dns_fixedname_name(&fnewname),
                                                dns_fixedname_name(&fnewname),
                                                NULL)
index c875f72f0d38eec1eb24e8ef8a7b2aba815a9bc0..3e8d52c5a9183ea80374182d0ba1b1b9dd916813 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: name.h,v 1.103 2003/07/25 02:22:25 marka Exp $ */
+/* $Id: name.h,v 1.104 2003/10/25 00:31:12 jinmei Exp $ */
 
 #ifndef DNS_NAME_H
 #define DNS_NAME_H 1
@@ -291,21 +291,6 @@ dns_name_iswildcard(const dns_name_t *name);
  *     FALSE           The least significant label of 'name' is not '*'.
  */
 
-isc_boolean_t
-dns_name_requiresedns(const dns_name_t *name);
-/*
- * Does 'name' require EDNS for transmission?
- *
- * Requires:
- *     'name' is a valid name
- *
- *     dns_name_countlabels(name) > 0
- *
- * Returns:
- *     TRUE            The name requires EDNS to be transmitted.
- *     FALSE           The name does not require EDNS to be transmitted.
- */
-
 unsigned int
 dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive);
 /*
@@ -359,8 +344,7 @@ dns_name_hashbylabel(dns_name_t *name, isc_boolean_t case_sensitive);
 
 dns_namereln_t
 dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
-                    int *orderp,
-                    unsigned int *nlabelsp, unsigned int *nbitsp);
+                    int *orderp, unsigned int *nlabelsp);
 /*
  * Determine the relative ordering under the DNSSEC order relation of
  * 'name1' and 'name2', and also determine the hierarchical
@@ -380,7 +364,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
  *
  *     dns_name_countlabels(name2) > 0
  *
- *     orderp, nlabelsp, and nbitsp are valid pointers.
+ *     orderp and nlabelsp are valid pointers.
  *
  *     Either name1 is absolute and name2 is absolute, or neither is.
  *
@@ -391,9 +375,6 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
  *
  *     *nlabelsp is the number of common significant labels.
  *
- *     Since we dropped the support of bitstring labels, *nbitsp is always
- *     set to 0.
- *
  * Returns:
  *     dns_namereln_none               There's no hierarchical relationship
  *                                     between name1 and name2.
@@ -537,25 +518,6 @@ dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname);
  *     FALSE           'name' does not match the wildcard specified in 'wname'
  */
 
-unsigned int
-dns_name_depth(const dns_name_t *name);
-/*
- * The depth of 'name'.
- *
- * Notes:
- *     The "depth" of a name represents how far down the DNS tree of trees
- *     the name is.  For each wire-encoding label in name, the depth is
- *     increased by 1 for an ordinary label.
- *
- *     Depth is used when creating or validating DNSSEC signatures.
- *
- * Requires:
- *     'name' is a valid name
- *
- * Returns:
- *     The depth of 'name'.
- */
-
 /***
  *** Labels
  ***/
@@ -960,18 +922,16 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix,
  *     DNS_R_NAMETOOLONG
  */
 
-isc_result_t
-dns_name_split(dns_name_t *name,
-              unsigned int suffixlabels, unsigned int nbits,
+void
+dns_name_split(dns_name_t *name, unsigned int suffixlabels,
               dns_name_t *prefix, dns_name_t *suffix);
 /*
  *
- * Split 'name' into two pieces on a label or bitlabel boundary.
+ * Split 'name' into two pieces on a label boundary.
  *
  * Notes:
  *      'name' is split such that 'suffix' holds the most significant
- *      'suffixlabels' labels.  All other labels and bits are stored
- *     in 'prefix'. 
+ *      'suffixlabels' labels.  All other labels are stored in 'prefix'. 
  *
  *     Copying name data is avoided as much as possible, so 'prefix'
  *     and 'suffix' will end up pointing at the data for 'name'.
@@ -988,8 +948,6 @@ dns_name_split(dns_name_t *name,
  *
  *     'suffixlabels' cannot exceed the number of labels in 'name'.
  *
- *     'nbits' must be 0, since we dropped the support of bitstring labels.
- *
  *     'prefix' is a valid name or NULL, and cannot be read-only.
  *
  *     'suffix' is a valid name or NULL, and cannot be read-only.
@@ -1016,39 +974,6 @@ dns_name_split(dns_name_t *name,
  *     ISC_R_SUCCESS   No worries.  (This function should always success).
  */
 
-isc_result_t
-dns_name_splitatdepth(dns_name_t *name, unsigned int depth,
-                     dns_name_t *prefix, dns_name_t *suffix);
-/*
- * Split 'name' into two pieces at a certain depth.
- *
- * Requires:
- *     'name' is a valid non-empty name.
- *
- *     depth > 0
- *
- *     depth <= dns_name_depth(name)
- *
- *     The preconditions of dns_name_split() apply to 'prefix' and 'suffix'.
- *
- * Ensures:
- *
- *     On success:
- *             If 'prefix' is not NULL it will contain the least significant
- *             labels.
- *
- *             If 'suffix' is not NULL it will contain the most significant
- *             labels.  dns_name_countlabels(suffix) will be equal to
- *             suffixlabels.
- *
- *     On failure:
- *             Either 'prefix' or 'suffix' is invalidated (depending
- *             on which one the problem was encountered with).
- *
- * Returns:
- *     The possible result codes are the same as those of dns_name_split().
- */
-
 isc_result_t
 dns_name_dup(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target);
 /*
@@ -1264,6 +1189,13 @@ do { \
        (r)->length = (n)->length; \
 } while (0);
 
+#define DNS_NAME_SPLIT(n, l, p, s) \
+do { \
+       if ((p) != NULL) \
+               dns_name_getlabelsequence((n), 0, (n)->labels - (l), (p)); \
+       if ((s) != NULL) \
+               dns_name_getlabelsequence((n), (n)->labels - (l), (l), (s)); \
+} while (0);
 
 #ifdef DNS_NAME_USEINLINE
 
@@ -1273,6 +1205,7 @@ do { \
 #define dns_name_countlabels(n)                DNS_NAME_COUNTLABELS(n)
 #define dns_name_isabsolute(n)         DNS_NAME_ISABSOLUTE(n)
 #define dns_name_toregion(n, r)                DNS_NAME_TOREGION(n, r)
+#define dns_name_split(n, l, p, s)     DNS_NAME_SPLIT(n, l, p, s)
 
 #endif /* DNS_NAME_USEINLINE */
 
index a93f81a31e4dc4736b22a7798592363738a05cd1..dbe984a994665e9172f27338d90524299afb05ad 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lookup.c,v 1.11 2003/09/30 05:56:10 marka Exp $ */
+/* $Id: lookup.c,v 1.12 2003/10/25 00:31:09 jinmei Exp $ */
 
 #include <config.h>
 
@@ -188,7 +188,7 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
        dns_name_t *name, *fname, *prefix;
        dns_fixedname_t foundname, fixed;
        dns_rdata_t rdata = DNS_RDATA_INIT;
-       unsigned int nlabels, nbits;
+       unsigned int nlabels;
        int order;
        dns_namereln_t namereln;
        dns_rdata_cname_t cname;
@@ -276,7 +276,7 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
                        break;
                case DNS_R_DNAME:
                        namereln = dns_name_fullcompare(name, fname, &order,
-                                                       &nlabels, &nbits);
+                                                       &nlabels);
                        INSIST(namereln == dns_namereln_subdomain);
                        /*
                         * Get the target name of the DNAME.
@@ -294,12 +294,7 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
                         */
                        dns_fixedname_init(&fixed);
                        prefix = dns_fixedname_name(&fixed);
-                       result = dns_name_split(name, nlabels, nbits, prefix,
-                                               NULL);
-                       if (result != ISC_R_SUCCESS) {
-                               dns_rdata_freestruct(&dname);
-                               break;
-                       }
+                       dns_name_split(name, nlabels, prefix, NULL);
                        result = dns_name_concatenate(prefix, &dname.dname,
                                                      name, NULL);
                        dns_rdata_freestruct(&dname);
index 25d6cc91216955afe280ea7cb9af30be1fd1f4b3..be890f18914fdc61046d7716b883c68ce8cb5770 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: name.c,v 1.141 2003/10/17 03:46:43 marka Exp $ */
+/* $Id: name.c,v 1.142 2003/10/25 00:31:10 jinmei Exp $ */
 
 #include <config.h>
 
@@ -278,21 +278,6 @@ dns_name_iswildcard(const dns_name_t *name) {
        return (ISC_FALSE);
 }
 
-isc_boolean_t
-dns_name_requiresedns(const dns_name_t *name) {
-       /*
-        * Does 'name' require EDNS for transmission?
-        * Since we dropped the support of bitstring labels, this function
-        * currently returns a constant value; ISC_FALSE.
-        */
-
-       REQUIRE(VALID_NAME(name));
-       REQUIRE(name->labels > 0);
-       UNUSED(name);
-
-       return (ISC_FALSE);
-}
-
 static inline unsigned int
 name_hash(dns_name_t *name, isc_boolean_t case_sensitive) {
        unsigned int length;
@@ -390,8 +375,7 @@ dns_name_hashbylabel(dns_name_t *name, isc_boolean_t case_sensitive) {
 
 dns_namereln_t
 dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
-                    int *orderp,
-                    unsigned int *nlabelsp, unsigned int *nbitsp)
+                    int *orderp, unsigned int *nlabelsp)
 {
        unsigned int l1, l2, l, count1, count2, count, nlabels;
        int cdiff, ldiff, chdiff;
@@ -415,7 +399,6 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
        REQUIRE(VALID_NAME(name2));
        REQUIRE(orderp != NULL);
        REQUIRE(nlabelsp != NULL);
-       REQUIRE(nbitsp != NULL);
        /*
         * Either name1 is absolute and name2 is absolute, or neither is.
         */
@@ -483,7 +466,6 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
 
  done:
        *nlabelsp = nlabels;
-       *nbitsp = 0;
 
        if (nlabels > 0 && namereln == dns_namereln_none)
                namereln = dns_namereln_commonancestor;
@@ -494,7 +476,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2,
 int
 dns_name_compare(const dns_name_t *name1, const dns_name_t *name2) {
        int order;
-       unsigned int nlabels, nbits;
+       unsigned int nlabels;
 
        /*
         * Determine the relative ordering under the DNSSEC order relation of
@@ -506,7 +488,7 @@ dns_name_compare(const dns_name_t *name1, const dns_name_t *name2) {
         * same domain.
         */
 
-       (void)dns_name_fullcompare(name1, name2, &order, &nlabels, &nbits);
+       (void)dns_name_fullcompare(name1, name2, &order, &nlabels);
 
        return (order);
 }
@@ -624,7 +606,7 @@ dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2) {
 isc_boolean_t
 dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) {
        int order;
-       unsigned int nlabels, nbits;
+       unsigned int nlabels;
        dns_namereln_t namereln;
 
        /*
@@ -636,8 +618,7 @@ dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) {
         * same domain.
         */
 
-       namereln = dns_name_fullcompare(name1, name2, &order, &nlabels,
-                                       &nbits);
+       namereln = dns_name_fullcompare(name1, name2, &order, &nlabels);
        if (namereln == dns_namereln_subdomain ||
            namereln == dns_namereln_equal)
                return (ISC_TRUE);
@@ -648,7 +629,7 @@ dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) {
 isc_boolean_t
 dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname) {
        int order;
-       unsigned int nlabels, nbits, labels;
+       unsigned int nlabels, labels;
        dns_name_t tname;
 
        REQUIRE(VALID_NAME(name));
@@ -660,46 +641,12 @@ dns_name_matcheswildcard(const dns_name_t *name, const dns_name_t *wname) {
 
        DNS_NAME_INIT(&tname, NULL);
        dns_name_getlabelsequence(wname, 1, labels - 1, &tname);
-       if (dns_name_fullcompare(name, &tname, &order, &nlabels, &nbits) ==
+       if (dns_name_fullcompare(name, &tname, &order, &nlabels) ==
            dns_namereln_subdomain)
                return (ISC_TRUE);
        return (ISC_FALSE);
 }
 
-unsigned int
-dns_name_depth(const dns_name_t *name) {
-       unsigned int depth, count, nrem;
-       unsigned char *ndata;
-
-       /*
-        * The depth of 'name'.
-        */
-
-       REQUIRE(VALID_NAME(name));
-
-       if (name->labels == 0)
-               return (0);
-
-       depth = 0;
-       ndata = name->ndata;
-       nrem = name->length;
-       while (nrem > 0) {
-               count = *ndata++;
-               INSIST(count <= 63); /* no bitstring support */
-
-               nrem--;
-               depth++;
-               if (count == 0)
-                       break;
-
-               INSIST(nrem >= count);
-               nrem -= count;
-               ndata += count;
-       }
-
-       return (depth);
-}
-
 unsigned int
 dns_name_countlabels(const dns_name_t *name) {
        /*
@@ -1863,17 +1810,13 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name,
        return (ISC_R_SUCCESS);
 }
 
-isc_result_t
-dns_name_split(dns_name_t *name,
-              unsigned int suffixlabels, unsigned int nbits,
+void
+dns_name_split(dns_name_t *name, unsigned int suffixlabels,
               dns_name_t *prefix, dns_name_t *suffix)
 
 {
-       dns_offsets_t name_odata;
-       unsigned char *offsets;
        unsigned int splitlabel;
 
-       REQUIRE(nbits == 0);    /* no bitstring support */
        REQUIRE(VALID_NAME(name));
        REQUIRE(suffixlabels > 0);
        REQUIRE(suffixlabels < name->labels);
@@ -1887,8 +1830,6 @@ dns_name_split(dns_name_t *name,
                 suffix->buffer != NULL &&
                 BINDABLE(suffix)));
 
-       SETUP_OFFSETS(name, offsets, name_odata);
-
        splitlabel = name->labels - suffixlabels;
 
        if (prefix != NULL)
@@ -1898,51 +1839,7 @@ dns_name_split(dns_name_t *name,
                dns_name_getlabelsequence(name, splitlabel,
                                          suffixlabels, suffix);
 
-       return (ISC_R_SUCCESS);
-}
-
-isc_result_t
-dns_name_splitatdepth(dns_name_t *name, unsigned int depth,
-                     dns_name_t *prefix, dns_name_t *suffix)
-{
-       unsigned int suffixlabels, label, count;
-       unsigned char *offsets, *ndata;
-       dns_offsets_t odata;
-
-       /*
-        * Split 'name' into two pieces at a certain depth.
-        */
-
-       REQUIRE(VALID_NAME(name));
-       REQUIRE(name->labels > 0);
-       REQUIRE(depth > 0);
-
-       SETUP_OFFSETS(name, offsets, odata);
-
-       suffixlabels = 0;
-       label = name->labels;
-       do {
-               label--;
-               ndata = &name->ndata[offsets[label]];
-               count = *ndata++;
-               INSIST(count <= 63); /* no bitstring support */
-               suffixlabels++;
-               depth--;
-       } while (depth != 0 && label != 0);
-
-       /*
-        * If depth is not zero, then the caller violated the requirement
-        * that depth <= dns_name_depth(name).
-        */
-       if (depth != 0) {
-               REQUIRE(depth <= dns_name_depth(name));
-               /*
-                * We should never get here!
-                */
-               INSIST(0);
-       }
-
-       return (dns_name_split(name, suffixlabels, 0, prefix, suffix));
+       return;
 }
 
 isc_result_t
index b18dca038f63972abbfd669e6d74685d883f1afb..c0fdde3674c663a90f1918ea9ba896c0d265ea9a 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbt.c,v 1.124 2003/05/08 04:03:25 marka Exp $ */
+/* $Id: rbt.c,v 1.125 2003/10/25 00:31:10 jinmei Exp $ */
 
 /* Principal Authors: DCL */
 
@@ -352,7 +352,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
        dns_namereln_t compared;
        isc_result_t result = ISC_R_SUCCESS;
        dns_rbtnodechain_t chain;
-       unsigned int common_labels, common_bits;
+       unsigned int common_labels;
        int order;
 
        REQUIRE(VALID_RBT(rbt));
@@ -398,13 +398,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
 
                NODENAME(current, &current_name);
                compared = dns_name_fullcompare(add_name, &current_name,
-                                               &order,
-                                               &common_labels, &common_bits);
-               /*
-                * since we dropped the support of bitstring labels,
-                * common_bits should always be set to 0.
-                */
-               INSIST(common_bits == 0);
+                                               &order, &common_labels);
 
                if (compared == dns_namereln_equal) {
                        *nodep = current;
@@ -445,13 +439,8 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
                                 * not-in-common part to be searched for
                                 * in the next level.
                                 */
-                               result = dns_name_split(add_name,
-                                                       common_labels,
-                                                       common_bits,
-                                                       add_name, NULL);
-
-                               if (result != ISC_R_SUCCESS)
-                                       break;
+                               dns_name_split(add_name, common_labels,
+                                              add_name, NULL);
 
                                /*
                                 * Follow the down pointer (possibly NULL).
@@ -505,14 +494,10 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
                                 * two names and a suffix that is the common
                                 * parts of them.
                                 */
-                               result = dns_name_split(&current_name,
-                                                       common_labels,
-                                                       common_bits,
-                                                       prefix, suffix);
-
-                               if (result == ISC_R_SUCCESS)
-                                       result = create_node(rbt->mctx, suffix,
-                                                            &new_current);
+                               dns_name_split(&current_name, common_labels,
+                                              prefix, suffix);
+                               result = create_node(rbt->mctx, suffix,
+                                                    &new_current);
 
                                if (result != ISC_R_SUCCESS)
                                        break;
@@ -602,12 +587,8 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) {
                                         * result != ISC_R_SUCCESS, which
                                         * is tested after the loop ends).
                                         */
-                                       result = dns_name_split(add_name,
-                                                               common_labels,
-                                                               common_bits,
-                                                               add_name,
-                                                               NULL);
-
+                                       dns_name_split(add_name, common_labels,
+                                                      add_name, NULL);
 
                                        break;
                                }
@@ -687,7 +668,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
        dns_fixedname_t fixedcallbackname, fixedsearchname;
        dns_namereln_t compared;
        isc_result_t result, saved_result;
-       unsigned int common_labels, common_bits;
+       unsigned int common_labels;
        int order;
 
        REQUIRE(VALID_RBT(rbt));
@@ -725,9 +706,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
        /*
         * search_name is the name segment being sought in each tree level.
         * By using a fixedname, the search_name will definitely have offsets
-        * and a buffer for use by any splitting that happens in the middle
-        * of a bitstring label.  (XXXJT: this can be skipped since we dropped
-        * bitstring labels).
+        * for use by any splitting.
         * By using dns_name_clone, no name data should be copied thanks to
         * the lack of bitstring labels.
         */
@@ -744,8 +723,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
        while (current != NULL) {
                NODENAME(current, &current_name);
                compared = dns_name_fullcompare(search_name, &current_name,
-                                               &order,
-                                               &common_labels, &common_bits);
+                                               &order, &common_labels);
                last_compared = current;
 
                if (compared == dns_namereln_equal)
@@ -825,7 +803,6 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
                                        break;
                                } else {
                                        common_labels = tlabels;
-                                       common_bits = 0;
                                        compared = dns_namereln_subdomain;
                                        goto subdomain;
                                }
@@ -866,15 +843,8 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
                                 * Whack off the current node's common parts
                                 * for the name to search in the next level.
                                 */
-                               result = dns_name_split(search_name,
-                                                       common_labels,
-                                                       common_bits,
-                                                       search_name, NULL);
-                               if (result != ISC_R_SUCCESS) {
-                                       dns_rbtnodechain_reset(chain);
-                                       return (result);
-                               }
-
+                               dns_name_split(search_name, common_labels,
+                                              search_name, NULL);
                                /*
                                 * This might be the closest enclosing name.
                                 */
@@ -1086,8 +1056,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname,
                                                                search_name,
                                                                &current_name,
                                                                &order,
-                                                               &common_labels,
-                                                               &common_bits);
+                                                               &common_labels);
 
                                        last_compared = current;
 
index d14f5f93c0cea604fab6e70fb2c70c8f5049c34d..e57a88c927a1a7ea957dc3c8adb4c34afc2da453 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.270 2003/10/17 03:46:44 marka Exp $ */
+/* $Id: resolver.c,v 1.271 2003/10/25 00:31:11 jinmei Exp $ */
 
 #include <config.h>
 
@@ -2773,11 +2773,11 @@ is_lame(fetchctx_t *fctx) {
                     rdataset = ISC_LIST_NEXT(rdataset, link)) {
                        dns_namereln_t namereln;
                        int order;
-                       unsigned int labels, bits;
+                       unsigned int labels;
                        if (rdataset->type != dns_rdatatype_ns)
                                continue;
                        namereln = dns_name_fullcompare(name, &fctx->domain,
-                                                       &order, &labels, &bits);
+                                                       &order, &labels);
                        if (namereln == dns_namereln_equal &&
                            (message->flags & DNS_MESSAGEFLAG_AA) != 0)
                                return (ISC_FALSE);
@@ -3841,7 +3841,7 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
 {
        isc_result_t result;
        dns_rdata_t rdata = DNS_RDATA_INIT;
-       unsigned int nlabels, nbits;
+       unsigned int nlabels;
        int order;
        dns_namereln_t namereln;
        dns_rdata_dname_t dname;
@@ -3862,19 +3862,13 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
        /*
         * Get the prefix of qname.
         */
-       namereln = dns_name_fullcompare(qname, oname, &order, &nlabels,
-                                       &nbits);
+       namereln = dns_name_fullcompare(qname, oname, &order, &nlabels);
        if (namereln != dns_namereln_subdomain) {
                dns_rdata_freestruct(&dname);
                return (DNS_R_FORMERR);
        }
        dns_fixedname_init(&prefix);
-       result = dns_name_split(qname, nlabels, nbits,
-                               dns_fixedname_name(&prefix), NULL);
-       if (result != ISC_R_SUCCESS) {
-               dns_rdata_freestruct(&dname);
-               return (result);
-       }
+       dns_name_split(qname, nlabels, dns_fixedname_name(&prefix), NULL); 
        dns_fixedname_init(fixeddname);
        result = dns_name_concatenate(dns_fixedname_name(&prefix),
                                      &dname.dname,
index fd8d08df2b62393583874d016bba383460bd20b6..ff84de74e7b5b6d584fa2ecabd43c138348e38a6 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: validator.c,v 1.113 2003/09/30 05:56:14 marka Exp $ */
+/* $Id: validator.c,v 1.114 2003/10/25 00:31:11 jinmei Exp $ */
 
 #include <config.h>
 
@@ -441,7 +441,7 @@ nsecprovesnonexistence(dns_validator_t *val, dns_name_t *nsecname,
        isc_boolean_t isnxdomain;
        isc_result_t result;
        dns_namereln_t relation;
-       unsigned int olabels, nlabels, labels, bits;
+       unsigned int olabels, nlabels, labels;
 
        INSIST(DNS_MESSAGE_VALID(val->event->message));
 
@@ -460,7 +460,7 @@ nsecprovesnonexistence(dns_validator_t *val, dns_name_t *nsecname,
 
        validator_log(val, ISC_LOG_DEBUG(3), "looking for relevant nsec");
        relation = dns_name_fullcompare(val->event->name, nsecname,
-                                       &order, &olabels, &bits);
+                                       &order, &olabels);
        if (order == 0) {
                /*
                 * The names are the same.  Look for the type present bit.
@@ -496,8 +496,7 @@ nsecprovesnonexistence(dns_validator_t *val, dns_name_t *nsecname,
                        RUNTIME_CHECK(result == ISC_R_SUCCESS);
                        relation = dns_name_fullcompare(&nsec.next,
                                                        val->event->name,
-                                                       &order, &nlabels,
-                                                       &bits);
+                                                       &order, &nlabels);
                        if (order > 0 && relation == dns_namereln_subdomain) {
                                dns_rdata_freestruct(&nsec);
                                validator_log(val, ISC_LOG_DEBUG(3),
@@ -548,7 +547,7 @@ nsecprovesnonexistence(dns_validator_t *val, dns_name_t *nsecname,
                        return (ISC_FALSE);
                dns_rdata_reset(&rdata);
                relation = dns_name_fullcompare(&nsec.next, val->event->name,
-                                               &order, &nlabels, &bits);
+                                               &order, &nlabels);
                if (order <= 0) {
                        /*
                         * The NSEC next name is less than the nonexistent
@@ -820,7 +819,7 @@ get_dst_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo,
 static isc_result_t
 get_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo) {
        isc_result_t result;
-       unsigned int nbits, nlabels;
+       unsigned int nlabels;
        int order;
        dns_namereln_t namereln;
 
@@ -831,7 +830,7 @@ get_key(dns_validator_t *val, dns_rdata_rrsig_t *siginfo) {
         * or closer to the the DNS root.
         */
        namereln = dns_name_fullcompare(val->event->name, &siginfo->signer,
-                                       &order, &nlabels, &nbits);
+                                       &order, &nlabels);
        if (namereln != dns_namereln_subdomain &&
            namereln != dns_namereln_equal)
                return (DNS_R_CONTINUE);
@@ -1548,29 +1547,27 @@ proveunsecure(dns_validator_t *val, isc_boolean_t resume) {
        else if (result != ISC_R_SUCCESS)
                return (result);
 
-       if (!resume)
-               val->labels = dns_name_depth(dns_fixedname_name(&secroot)) + 1;
-       else {
+       if (!resume) {
+               val->labels =
+                       dns_name_countlabels(dns_fixedname_name(&secroot)) + 1;
+       } else {
                validator_log(val, ISC_LOG_DEBUG(3), "resuming proveunsecure");
                val->labels++;
        }
 
        for (;
-            val->labels <= dns_name_depth(val->event->name);
+            val->labels <= dns_name_countlabels(val->event->name);
             val->labels++)
        {
                char namebuf[DNS_NAME_FORMATSIZE];
 
-               if (val->labels == dns_name_depth(val->event->name)) {
+               if (val->labels == dns_name_countlabels(val->event->name)) {
                        tname = val->event->name;
                } else {
                        dns_fixedname_init(&val->fname);
                        tname = dns_fixedname_name(&val->fname);
-                       result = dns_name_splitatdepth(val->event->name,
-                                                      val->labels,
-                                                      NULL, tname);
-                       if (result != ISC_R_SUCCESS)
-                               return (result);
+                       dns_name_split(val->event->name, val->labels,
+                                      NULL, tname);
                }
 
                dns_name_format(tname, namebuf, sizeof(namebuf));