]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
361. [func] When the RBT find or chain functions set the name and
authorDavid Lawrence <source@isc.org>
Mon, 31 Jul 2000 23:27:25 +0000 (23:27 +0000)
committerDavid Lawrence <source@isc.org>
Mon, 31 Jul 2000 23:27:25 +0000 (23:27 +0000)
origin for a node that stores the root label
the name is now set to an empty name, instead of ".",
to simplify later use of the name and origin by
dns_name_concatenate(), dns_name_totext() or
dns_name_format().

 360. [func] dns_name_totext() and dns_name_format() now allow
an empty name to be passed, which is formatted as "@".

CHANGES
bin/tests/rbt_test.c
lib/dns/include/dns/rbt.h
lib/dns/rbt.c

diff --git a/CHANGES b/CHANGES
index c7ecb444ac7b2ad1b96b801fd623008afb518e50..3b5243eabc71b93d68a8306b299fded051d94820 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,13 @@
+ 361.  [func]          When the RBT find or chain functions set the name and
+                       origin for a node that stores the root label
+                       the name is now set to an empty name, instead of ".",
+                       to simplify later use of the name and origin by
+                       dns_name_concatenate(), dns_name_totext() or
+                       dns_name_format().
+
+ 360.  [func]          dns_name_totext() and dns_name_format() now allow
+                       an empty name to be passed, which is formatted as "@".
+
  359.  [bug]           dnssec-signzone occasionally signed glue records.
 
  358.  [cleanup]       Rename the intermediate files used by the dnssec
index 80aafeb310d80bdc3ec9c80adad7d33853b11381..f326d654f47d7fd66f4760ac255a7fbeead0a43f 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbt_test.c,v 1.37 2000/07/31 22:33:59 tale Exp $ */
+/* $Id: rbt_test.c,v 1.38 2000/07/31 23:27:22 tale Exp $ */
 
 #include <config.h>
 
@@ -26,6 +26,7 @@
 #include <isc/commandline.h>
 #include <isc/mem.h>
 #include <isc/string.h>
+#include <isc/util.h>
 
 #include <dns/rbt.h>
 #include <dns/fixedname.h>
@@ -88,7 +89,7 @@ static void
 delete_name(void *data, void *arg) {
        dns_name_t *name;
 
-       (void)arg;
+       UNUSED(arg);
        name = data;
        isc_mem_put(mctx, data, sizeof(dns_name_t) + DNSNAMELEN);
 }
@@ -168,14 +169,7 @@ detail(dns_rbt_t *rbt, dns_name_t *name) {
        if (result == ISC_R_SUCCESS) {
                printf("\n  name from dns_rbtnodechain_current: ");
 
-               /*
-                * If foundname is absolute, it includes the origin (which
-                * is intrinsically known here to be just ".").
-                */
-
-               result = dns_name_concatenate(foundname,
-                                             dns_name_isabsolute(foundname) ?
-                                                 NULL : origin,
+               result = dns_name_concatenate(foundname, origin,
                                              fullname, NULL);
                if (result == ISC_R_SUCCESS)
                        print_name(fullname);
index 56b3ac6d41cfc0aa2863a3efecbbb1a143203d5d..a2f46042e2a0eb54181a6290fbfdc3e449564683 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbt.h,v 1.44 2000/07/27 09:48:10 tale Exp $ */
+/* $Id: rbt.h,v 1.45 2000/07/31 23:27:25 tale Exp $ */
 
 #ifndef DNS_RBT_H
 #define DNS_RBT_H 1
@@ -117,21 +117,17 @@ typedef isc_result_t (*dns_rbtfindcallback_t)(dns_rbtnode_t *node,
  * accomplished with a dns_fixedname_t.  It is _not_ necessary to reinitialize
  * either 'name' or 'origin' between calls to the chain functions.
  *
- * NOTE WELL: the above rule means that when a chain points to the root of the
- * tree of trees and that root stores only the root label, ".", it means that
- * BOTH 'name' *and* 'origin' will be ".".  As a common operation on
- * 'name' and 'origin' is to dns_name_concatenate them after they have been
- * set, special care must be taken to not concatenate 'name' if it is
- * dns_name_isabsolute(), which is only true in this special circumstance.
- * The logic behind having both 'name' and 'origin' be "." had to do with
- * zone file dumping.  It is likely that dumping of "." will be handled
- * differently in the future and that the chain API will be changed such that
- * in the case of ".", only 'origin' will be "." and name will be set to
- * have zero labels.
+ * NOTE WELL: even though the name data at the root of the tree of trees will
+ * be absolute (typically just "."), it will will be made into a relative name
+ * with an origin of "." -- an empty name when the node is ".".  This is
+ * because a common on operation on 'name' and 'origin' is to use
+ * dns_name_concatenate() on them to generate the complete name.  An empty name
+ * can be detected when dns_name_countlabels == 0, and is printed by
+ * dns_name_totext()/dns_name_format() as "@", consistent with RFC1035's
+ * definition of "@" as the current origin.
  *
  * dns_rbtnodechain_current is similar to the _first, _last, _prev and _next
- * functions but additionally can provide the node to which the chain points.
- */
+ * functions but additionally can provide the node to which the chain points.  */
 
 /*
  * For use in allocating space for the chain of ancestor nodes.
index 0f04f6a0ce043b5f35e4eeaa6e91e0296b8e94da..270e5d8979a06a684c559373e9f05b5a2c52d38c 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbt.c,v 1.88 2000/07/31 22:34:01 tale Exp $ */
+/* $Id: rbt.c,v 1.89 2000/07/31 23:27:24 tale Exp $ */
 
 /* Principal Authors: DCL */
 
@@ -1948,7 +1948,8 @@ dns_rbtnodechain_init(dns_rbtnodechain_t *chain, isc_mem_t *mctx) {
 
 isc_result_t
 dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name,
-                        dns_name_t *origin, dns_rbtnode_t **node) {
+                        dns_name_t *origin, dns_rbtnode_t **node)
+{
        isc_result_t result = ISC_R_SUCCESS;
 
        REQUIRE(VALID_CHAIN(chain));
@@ -1964,18 +1965,17 @@ dns_rbtnodechain_current(dns_rbtnodechain_t *chain, dns_name_t *name,
 
                if (chain->level_count == 0) {
                        /*
-                        * Eliminate the root name, except when name is ".".
+                        * Names in the top level tree are all absolute.
+                        * Always make 'name' relative.
                         */
-                       if (dns_name_countlabels(name) > 1) {
-                               INSIST(dns_name_isabsolute(name));
+                       INSIST(dns_name_isabsolute(name));
 
-                               /*
-                                * XXX EVIL.  But what _should_ I do?
-                                */
-                               name->labels--;
-                               name->length--;
-                               name->attributes &= ~DNS_NAMEATTR_ABSOLUTE;
-                       }
+                       /*
+                        * This is cheaper than dns_name_getlabelsequence().
+                        */
+                       name->labels--;
+                       name->length--;
+                       name->attributes &= ~DNS_NAMEATTR_ABSOLUTE;
                }
        }