]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2666. [func] Added an 'options' argument to dns_name_fromstring()
authorTatuya JINMEI 神明達哉 <jinmei@isc.org>
Tue, 1 Sep 2009 17:36:51 +0000 (17:36 +0000)
committerTatuya JINMEI 神明達哉 <jinmei@isc.org>
Tue, 1 Sep 2009 17:36:51 +0000 (17:36 +0000)
(API change from 9.7.0a2). [RT #20196]

CHANGES
bin/named/server.c
lib/dns/include/dns/name.h
lib/dns/name.c

diff --git a/CHANGES b/CHANGES
index 0bfb605f6f4da618a246abb87a08e7335ca7bb2b..ba70d925d3aad261dd7fcaf34b5218cdc02e6c0d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2666.  [func]          Added an 'options' argument to dns_name_fromstring()
+                       (API change from 9.7.0a2). [RT #20196]
+
 2665.  [func]          Clarify syntax for managed-keys {} statement, add
                        ARM documentation about RFC 5011 support. [RT #19874]
 
index dbde146eaab925bb7c247e566cc65a6c8880c494..5e94ccd26254969051a56f30cfaa6558e9f50a01 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: server.c,v 1.544 2009/09/01 07:14:25 each Exp $ */
+/* $Id: server.c,v 1.545 2009/09/01 17:36:51 jinmei Exp $ */
 
 /*! \file */
 
@@ -2901,7 +2901,7 @@ add_keydata_zone(dns_view_t *view, isc_mem_t *mctx) {
        CHECK(dns_zone_create(&zone, mctx));
 
        dns_name_init(&zname, NULL);
-       CHECK(dns_name_fromstring(&zname, KEYZONE, mctx));
+       CHECK(dns_name_fromstring(&zname, KEYZONE, 0, mctx));
        CHECK(dns_zone_setorigin(zone, &zname));
        dns_name_free(&zname, mctx);
 
index bd81d037adc950f660f72291a29007a64ae8acab..8608ef38699d3147d7a5e25b264c58ed951e8283 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: name.h,v 1.131 2009/09/01 00:22:26 jinmei Exp $ */
+/* $Id: name.h,v 1.132 2009/09/01 17:36:51 jinmei Exp $ */
 
 #ifndef DNS_NAME_H
 #define DNS_NAME_H 1
@@ -1157,50 +1157,17 @@ dns_name_tostring(dns_name_t *source, char **target, isc_mem_t *mctx);
  */
 
 isc_result_t
-dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx);
+dns_name_fromstring(dns_name_t *target, const char *src, unsigned int options,
+                   isc_mem_t *mctx);
 /*%<
  * Convert a string to a name and place it in target, allocating memory
- * as necessary.
- *
- * Returns:
- *
- *\li  #ISC_R_SUCCESS
- *
- *\li  Any error that dns_name_fromtext() can return.
- *
- *\li  Any error that dns_name_dup() can return.
- */
-
-isc_result_t
-dns_name_tostring(dns_name_t *source, char **target, isc_mem_t *mctx);
-/*%<
- * Convert 'name' to string format, allocating sufficient memory to
- * hold it (free with isc_mem_free()).
- *
- * Differs from dns_name_format in that it allocates its own memory.
- *
- * Requires:
- *
- *\li  'name' is a valid name.
- *\li  'target' is not NULL.
- *\li  '*target' is NULL.
- *
- * Returns:
- *
- *\li  ISC_R_SUCCESS
- *
- *\li  Any error that dns_name_totext() can return.
- */
-
-isc_result_t
-dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx);
-/*%<
- * Convert a string to a name and place it in target, allocating memory
- * as necessary.
+ * as necessary.  'options' has the same semantics as that of
+ * dns_name_fromtext().
  *
  * Requires:
  *
  * \li 'target' is a valid name that is not read-only.
+ * \li 'src' is not NULL.
  *
  * Returns:
  *
@@ -1300,13 +1267,6 @@ dns_name_destroy(void);
  * non-NULL argument prior to calling dns_name_destroy();
  */
 
-isc_result_t
-dns_name_fromstr(dns_name_t *name, const char *source, const char *origin,
-                unsigned int options, isc_buffer_t *target);
-/*%<
- * TBD
- */
-
 ISC_LANG_ENDDECLS
 
 /*
index 1102ea166a05a49bd9204b6bf62e1259f7e78c5a..fc7d5be34ac949b399051ac4e6a771ab3356f8c7 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: name.c,v 1.168 2009/09/01 00:22:26 jinmei Exp $ */
+/* $Id: name.c,v 1.169 2009/09/01 17:36:51 jinmei Exp $ */
 
 /*! \file */
 
@@ -1019,32 +1019,6 @@ dns_name_toregion(dns_name_t *name, isc_region_t *r) {
        DNS_NAME_TOREGION(name, r);
 }
 
-isc_result_t
-dns_name_fromstr(dns_name_t *name, const char *source, const char *origin,
-                unsigned int options, isc_buffer_t *target)
-{
-       dns_name_t *o;
-       dns_fixedname_t fixed;
-       isc_buffer_t b;
-       isc_result_t result;
-
-       REQUIRE(source != NULL);
-       if (origin != NULL) {
-               isc_buffer_init(&b, origin, strlen(origin));
-               isc_buffer_add(&b, strlen(origin));
-               dns_fixedname_init(&fixed);
-               o = dns_fixedname_name(&fixed);
-               result = dns_name_fromtext(o, &b, dns_rootname, options, NULL);
-               if (result != ISC_R_SUCCESS)
-                       return(result);
-       } else
-               o = dns_rootname;
-       
-       isc_buffer_init(&b, source, strlen(source));
-       isc_buffer_add(&b, strlen(source));
-       return (dns_name_fromtext(name, &b, o, options, target));
-}
-
 isc_result_t
 dns_name_fromtext(dns_name_t *name, isc_buffer_t *source,
                  dns_name_t *origin, unsigned int options,
@@ -2399,18 +2373,22 @@ dns_name_tostring(dns_name_t *name, char **target, isc_mem_t *mctx) {
  * allocating memory as needed
  */
 isc_result_t
-dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx) {
+dns_name_fromstring(dns_name_t *target, const char *src, unsigned int options,
+                   isc_mem_t *mctx)
+{
        isc_result_t result;
        isc_buffer_t buf;
        dns_fixedname_t fn;
        dns_name_t *name;
 
+       REQUIRE(src != NULL);
+
        isc_buffer_init(&buf, src, strlen(src));
        isc_buffer_add(&buf, strlen(src));
        dns_fixedname_init(&fn);
        name = dns_fixedname_name(&fn);
 
-       result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
+       result = dns_name_fromtext(name, &buf, dns_rootname, options, NULL);
        if (result != ISC_R_SUCCESS)
                return (result);