2660. [func] Add a new set of DNS libraries for non-BIND9

applications.  See README.libdns. [RT #19369]
This commit is contained in:
Tatuya JINMEI 神明達哉 2009-09-01 00:22:28 +00:00
parent ad671240d6
commit 307d208450
193 changed files with 18162 additions and 1332 deletions

View file

@ -1,3 +1,6 @@
2660. [func] Add a new set of DNS libraries for non-BIND9
applications. See README.libdns. [RT #19369]
2659. [doc] Clarify dnssec-keygen doc: key name must match zone
name for DNSSEC keys. [RT #19938]

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.56 2009/06/25 17:06:42 each Exp $
# $Id: Makefile.in,v 1.57 2009/09/01 00:22:24 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -21,13 +21,13 @@ top_srcdir = @top_srcdir@
@BIND9_VERSION@
SUBDIRS = make lib bin doc
SUBDIRS = make lib bin doc @LIBEXPORT@
TARGETS =
MANPAGES = isc-config.sh.1
HTMLPAGES = isc-config.sh.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
@BIND9_MAKE_RULES@

2
README
View file

@ -66,11 +66,11 @@ BIND 9.7.0
- Smart signing: simplified tools for zone signing and key
maintenance
- The "statistics-channels" option is now available on Windows
- DNSSEC-aware libdns API
Planned but not complete in this alpha:
- Fully automatic signing of zones by "named"
- DNSSEC-aware libdns API
- Improved PKCS#11 support, including Keyper support
BIND 9.6.0

275
README.libdns Normal file
View file

@ -0,0 +1,275 @@
BIND-9 DNS Library Support
This version of BIND9 "exports" its internal libraries so that they
can be used by third-party applications more easily (we call them
"export" libraries in this document). In addition to all major
DNS-related APIs BIND9 is currently using, the export libraries
provide the following features:
- The newly created "DNS client" module. This is a higher level API
that provides an interface to name resolution, single DNS
transaction with a particular server, and dynamic update. Regarding
name resolution, it supports advanced features such as DNSSEC
validation and caching. This module supports both synchronous and
asynchronous mode.
- The new "IRS" (Information Retrieval System) library. It provides
an interface to parse the traditional resolv.conf file and more
advanced, DNS-specific configuration file for the rest of this
package (see the description for the dns.conf file below).
- As part of the IRS library, newly implemented standard address-name
mapping functions, getaddrinfo() and getnameinfo(), are provided.
They use the DNSSEC-aware validating resolver backend, and could use
other advanced features of the BIND9 libraries such as caching. The
getaddrinfo() function resolves both A and AAAA RRs concurrently
(when the address family is unspecified).
- An experimental framework to support other event libraries than
BIND9's internal event task system.
* Prerequisite
GNU make is required to build the export libraries (other part of
BIND9 can still be built with other types of make). In the reminder
of this document, "make" means GNU make. Note that in some platforms
you may need to invoke a different command name than "make"
(e.g. "gmake") to indicate it's GNU make.
* Compilation
1. ./configure --enable-exportlib [other flags]
2. make
This will create (in addition to usual BIND9 programs) and a separate
set of libraries under the lib/export directory. For example,
lib/export/dns/libdns.a is the archive file of the export version of
the BIND9 DNS library.
Sample application programs using the libraries will also be built
under the lib/export/samples directory (see below).
* Installation
1. cd lib/export
2. make install (root privilege is normally required)
(make install at the top directory will do the same)
This will install library object files under the directory specified
by the --with-export-libdir configure option (default:
EPREFIX/lib/bind9), and header files under the directory specified by
the --with-export-installdir configure option (default:
PREFIX/include/bind9).
To see how to build your own application after the installation, see
lib/export/samples/Makefile-postinstall.in
* Known Defects/Restrictions
- Currently, win32 is not supported for the export library. (Normal
BIND9 application can be built as before).
- The "fixed" RRset order is not (currently) supported in the export
library. If you want to use "fixed" RRset order for, e.g. named
while still building the export library even without the fixed
order support, build them separately:
% ./configure --enable-fixed-rrset [other flags, but not --enable-exportlib]
% make (this doesn't have to be make)
% ./configure --enable-exportlib [other flags, but not --enable-fixed-rrset]
% cd lib/export
% make
- The client module and the IRS library currently do not support
DNSSEC validation using DLV (the underlying modules can handle it,
but there is no tunable interface to enable the feature).
- RFC5011 is not supported in the validating stub resolver of the
export library. In fact, it is not clear whether it should: trust
anchors would be a system-wide configuration which would be managed
by an administrator, while the stub resolver will be used by
ordinary applications run by a normal user.
- Not all common /etc/resolv.conf options are supported in the IRS library.
The only available options in this version are "debug" and "ndots".
* The dns.conf File
The IRS library supports an "advanced" configuration file related to
the DNS library for configuration parameters that would be beyond the
capability of the resolv.conf file. Specifically, it is intended to
provide DNSSEC related configuration parameters.
By default the path to this configuration file is /etc/dns.conf.
This module is very experimental and the configuration syntax or
library interfaces may change in future versions. Currently, only the
'trusted-keys' statement is supported, whose syntax is the same as the
same name of statement for named.conf.
* Sample Applications
Some sample application programs using this API are provided for
reference. The following is a brief description of these
applications.
- sample: a simple stub resolver utility.
It sends a query of a given name (of a given optional RR type)
to a specified recursive server, and prints the result as a list of
RRs. It can also act as a validating stub resolver if a trust
anchor is given via a set of command line options.
Usage: sample [options] server_address hostname
Options and Arguments:
-t RRtype
specify the RR type of the query. The default is the A RR.
[-a algorithm] [-e] -k keyname -K keystring
specify a command-line DNS key to validate the answer. For
example, to specify the following DNSKEY of example.com:
example.com. 3600 IN DNSKEY 257 3 5 xxx
specify the options as follows:
-e -k example.com -K "xxx"
-e means that this key is a zone's "key signing key" (as known
as "secure Entry point").
when -a is omitted rsasha1 will be used by default.
-s domain:alt_server_address
specify a separate recursive server address for the specific
"domain". Example: -s example.com:2001:db8::1234
server_address
an IP(v4/v6) address of the recursive server to which queries
are sent.
hostname
the domain name for the query
- sample-async: a simple stub resolver, working asynchronously.
Similar to "sample", but accepts a list of (query) domain names as a
separate file and resolves the names asynchronously.
Usage: sample-async [-s server_address] [-t RR_type] input_file
Options and Arguments:
-s server_address
an IPv4 address of the recursive server to which queries are
sent. (IPv6 addresses are not supported in this implementation)
-t RR_type
specify the RR type of the queries. The default is the A RR.
input_file
a list of domain names to be resolved. each line consists of a
single domain name. Example:
www.example.com
mx.examle.net
ns.xxx.example
- sample-request: a simple DNS transaction client.
It sends a query to a specified server, and prints the response with
minimal processing. It doesn't act as a "stub resolver": it stops
the processing once it gets any response from the server, whether
it's a referral or an alias (CNAME or DNAME) that would require
further queries to get the ultimate answer. In other words, this
utility acts as a very simplified dig.
Usage: sample-request [-t RRtype] server_address hostname
Options and Arguments:
-t RRtype
specify the RR type of the queries. The default is the A RR.
server_address
an IP(v4/v6) address of the recursive server to which the query is
sent.
hostname
the domain name for the query
- sample-gai: getaddrinfo() and getnameinfo() test code.
This is a test program to check getaddrinfo() and getnameinfo()
behavior. It takes a host name as an argument, calls getaddrinfo()
with the given host name, and calls getnameinfo() with the resulting
IP addresses returned by getaddrinfo(). If the dns.conf file exists
and defines a trust anchor, the underlying resolver will act as a
validating resolver, and getaddrinfo()/getnameinfo() will fail with
an EAI_INSECUREDATA error when DNSSEC validation fails.
Usage: sample-gai hostname
- sample-update: a simple dynamic update client program
It accepts a single update command as a command-line argument, sends
an update request message to the authoritative server, and shows the
response from the server. In other words, this is a simplified
nsupdate.
Usage: sample-update [options] (add|delete) "update data"
Options and Arguments:
-a auth_server
An IP address of the authoritative server that has authority
for the zone containing the update name. This should normally
be the primary authoritative server that accepts dynamic
updates. It can also be a secondary server that is configured
to forward update requests to the primary server.
-k keyfile
A TSIG key file to secure the update transaction. The keyfile
format is the same as that for the nsupdate utility.
-p prerequisite
A prerequisite for the update (only one prerequisite can be
specified). The prerequisite format is the same as that is
accepted by the nsupdate utility.
-r recursive_server
An IP address of a recursive server that this utility will
use. A recursive server may be necessary to identify the
authoritative server address to which the update request is
sent.
-z zonename
The domain name of the zone that contains
(add|delete)
Specify the type of update operation. Either "add" or "delete"
must be specified.
"update data"
Specify the data to be updated. A typical example of the data
would look like "name TTL RRtype RDATA".
Note: in practice, either -a or -r must be specified. Others can
be optional; the underlying library routine tries to identify the
appropriate server and the zone name for the update.
Examples: assuming the primary authoritative server of the
dynamic.example.com zone has an IPv6 address 2001:db8::1234,
+ sample-update -a sample-update -k Kxxx.+nnn+mmmm.key add "foo.dynamic.example.com 30 IN A 192.168.2.1"
adds an A RR for foo.dynamic.example.com using the given key.
+ sample-update -a sample-update -k Kxxx.+nnn+mmmm.key delete "foo.dynamic.example.com 30 IN A"
removes all A RRs for foo.dynamic.example.com using the given key.
+ sample-update -a sample-update -k Kxxx.+nnn+mmmm.key delete "foo.dynamic.example.com"
removes all RRs for foo.dynamic.example.com using the given key.
- nsprobe: domain/name server checker in terms of RFC4074.
It checks a set of domains to see the name servers of the domains
behave correctly in terms of RFC4074. This is included in the set
of sample programs to show how the export library can be used in a
DNS-related application.
Usage: nsprobe [-d] [-v [-v...]] [-c cache_address] [input_file]
Options
-d
run in the "debug" mode. with this option nsprobe will dump
every RRs it receives.
-v
increase verbosity of other normal log messages. This can be
specified multiple times
-c cache_address
specify an IP address of a recursive (caching) name server.
nsprobe uses this server to get the NS RRset of each domain and
the A and/or AAAA RRsets for the name servers. The default
value is 127.0.0.1.
input_file
a file name containing a list of domain (zone) names to be
probed. when omitted the standard input will be used. Each
line of the input file specifies a single domain name such as
"example.com". In general this domain name must be the apex
name of some DNS zone (unlike normal "host names" such as
"www.example.com"). nsprobe first identifies the NS RRsets for
the given domain name, and sends A and AAAA queries to these
servers for some "widely used" names under the zone;
specifically, adding "www" and "ftp" to the zone name.
* Library References
As of this writing, there is no formal "manual" of the libraries,
except this document, header files (some of them provide pretty
detailed explanations), and sample application programs.
; $Id: README.libdns,v 1.2 2009/09/01 00:22:24 jinmei Exp $

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.32 2007/06/19 23:46:59 tbox Exp $
# $Id: Makefile.in,v 1.33 2009/09/01 00:22:24 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -26,7 +26,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES} \
${ISC_INCLUDES}
CDEFINES = -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
CDEFINES = -DBIND9 -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: check-tool.c,v 1.38 2009/01/20 02:01:11 marka Exp $ */
/* $Id: check-tool.c,v 1.39 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file */
@ -597,8 +597,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_buffer_add(&buffer, strlen(zonename));
dns_fixedname_init(&fixorigin);
origin = dns_fixedname_name(&fixorigin);
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
CHECK(dns_zone_setorigin(zone, origin));
CHECK(dns_zone_setdbtype(zone, 1, (const char * const *) dbtype));
CHECK(dns_zone_setfile2(zone, filename, fileformat));

View file

@ -12,7 +12,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.4 2009/07/14 22:54:56 each Exp $
# $Id: Makefile.in,v 1.5 2009/09/01 00:22:24 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -25,7 +25,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I${srcdir}/include ${ISC_INCLUDES} ${ISCCC_INCLUDES} \
${ISCCFG_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.41 2007/06/19 23:46:59 tbox Exp $
# $Id: Makefile.in,v 1.42 2009/09/01 00:22:24 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -26,7 +26,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I${srcdir}/include ${DNS_INCLUDES} ${BIND9_INCLUDES} \
${ISC_INCLUDES} ${LWRES_INCLUDES}
CDEFINES = -DVERSION=\"${VERSION}\"
CDEFINES = -DBIND9 -DVERSION=\"${VERSION}\"
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.323 2009/07/19 04:18:03 each Exp $ */
/* $Id: dighost.c,v 1.324 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file
* \note
@ -921,9 +921,7 @@ setup_text_key(void) {
secretsize = isc_buffer_usedlength(&secretbuf);
result = dns_name_fromtext(&keyname, namebuf,
dns_rootname, ISC_FALSE,
namebuf);
result = dns_name_fromtext(&keyname, namebuf, dns_rootname, 0, namebuf);
if (result != ISC_R_SUCCESS)
goto failure;
@ -1890,7 +1888,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_buffer_init(&b, lookup->origin->origin, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(lookup->oname, &b, dns_rootname,
ISC_FALSE, &lookup->onamebuf);
0, &lookup->onamebuf);
if (result != ISC_R_SUCCESS) {
dns_message_puttempname(lookup->sendmsg,
&lookup->name);
@ -1907,7 +1905,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_buffer_init(&b, lookup->textname, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(lookup->name, &b,
lookup->oname, ISC_FALSE,
lookup->oname, 0,
&lookup->namebuf);
}
if (result != ISC_R_SUCCESS) {
@ -1931,16 +1929,14 @@ setup_lookup(dig_lookup_t *lookup) {
isc_buffer_init(&b, idn_textname, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(lookup->name, &b,
dns_rootname,
ISC_FALSE,
dns_rootname, 0,
&lookup->namebuf);
#else
len = strlen(lookup->textname);
isc_buffer_init(&b, lookup->textname, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(lookup->name, &b,
dns_rootname,
ISC_FALSE,
dns_rootname, 0,
&lookup->namebuf);
#endif
}
@ -4085,7 +4081,7 @@ nameFromString(const char *str, dns_name_t *p_ret) {
dns_fixedname_init(&fixedname);
result = dns_name_fromtext(dns_fixedname_name(&fixedname), &buffer,
dns_rootname, ISC_TRUE, NULL);
dns_rootname, DNS_NAME_DOWNCASE, NULL);
check_result(result, "nameFromString");
if (dns_name_dynamic(p_ret))

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.38 2009/07/19 04:18:04 each Exp $
# $Id: Makefile.in,v 1.39 2009/09/01 00:22:24 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -25,7 +25,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES = -DVERSION=\"${VERSION}\"
CDEFINES = -DBIND9 -DVERSION=\"${VERSION}\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-dsfromkey.c,v 1.12 2009/08/13 04:13:58 marka Exp $ */
/* $Id: dnssec-dsfromkey.c,v 1.13 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file */
@ -72,7 +72,7 @@ initname(char *setname) {
isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname));
result = dns_name_fromtext(name, &buf, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
return (result);
}

View file

@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-keyfromlabel.c,v 1.9 2009/07/19 04:18:04 each Exp $ */
/* $Id: dnssec-keyfromlabel.c,v 1.10 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file */
@ -273,7 +273,7 @@ main(int argc, char **argv) {
isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
ret = dns_name_fromtext(name, &buf, dns_rootname, ISC_FALSE, NULL);
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
if (ret != ISC_R_SUCCESS)
fatal("invalid key name %s: %s", argv[isc_commandline_index],
isc_result_totext(ret));

View file

@ -29,7 +29,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-keygen.c,v 1.89 2009/07/19 23:47:55 tbox Exp $ */
/* $Id: dnssec-keygen.c,v 1.90 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file */
@ -567,7 +567,7 @@ main(int argc, char **argv) {
isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
ret = dns_name_fromtext(name, &buf, dns_rootname, ISC_FALSE, NULL);
ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
if (ret != ISC_R_SUCCESS)
fatal("invalid key name %s: %s", argv[isc_commandline_index],
isc_result_totext(ret));

View file

@ -29,7 +29,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.227 2009/08/14 01:07:00 each Exp $ */
/* $Id: dnssec-signzone.c,v 1.228 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file */
@ -2486,7 +2486,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
fatal("failed converting name '%s' to dns format: %s",
origin, isc_result_totext(result));
@ -3274,8 +3274,8 @@ main(int argc, char *argv[]) {
dns_fixedname_init(&dlv_fixed);
dlv = dns_fixedname_name(&dlv_fixed);
result = dns_name_fromtext(dlv, &b, dns_rootname,
ISC_FALSE, NULL);
result = dns_name_fromtext(dlv, &b, dns_rootname, 0,
NULL);
check_result(result, "dns_name_fromtext(dlv)");
break;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.104 2009/03/05 23:47:35 tbox Exp $
# $Id: Makefile.in,v 1.105 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -45,7 +45,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES}
CDEFINES = @USE_DLZ@
CDEFINES = -DBIND9 @USE_DLZ@
CWARNINGS =

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.c,v 1.99 2009/07/14 22:54:56 each Exp $ */
/* $Id: config.c,v 1.100 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -651,7 +651,7 @@ ns_config_getipandkeylist(const cfg_obj_t *config, const cfg_obj_t *list,
isc_buffer_add(&b, strlen(keystr));
dns_fixedname_init(&fname);
result = dns_name_fromtext(dns_fixedname_name(&fname), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
goto cleanup;
result = dns_name_dup(dns_fixedname_name(&fname), mctx,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwdgabn.c,v 1.22 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: lwdgabn.c,v 1.23 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -619,7 +619,7 @@ ns_lwdclient_processgabn(ns_lwdclient_t *client, lwres_buffer_t *b) {
dns_fixedname_init(&client->target_name);
dns_fixedname_init(&client->query_name);
result = dns_name_fromtext(dns_fixedname_name(&client->query_name),
&namebuf, NULL, ISC_FALSE, NULL);
&namebuf, NULL, 0, NULL);
if (result != ISC_R_SUCCESS)
goto out;
ns_lwsearchctx_init(&client->searchctx,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwdgrbn.c,v 1.20 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: lwdgrbn.c,v 1.21 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -472,7 +472,7 @@ ns_lwdclient_processgrbn(ns_lwdclient_t *client, lwres_buffer_t *b) {
dns_fixedname_init(&client->query_name);
result = dns_name_fromtext(dns_fixedname_name(&client->query_name),
&namebuf, NULL, ISC_FALSE, NULL);
&namebuf, NULL, 0, NULL);
if (result != ISC_R_SUCCESS)
goto out;
ns_lwsearchctx_init(&client->searchctx,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwresd.c,v 1.58 2008/07/23 23:27:54 marka Exp $ */
/* $Id: lwresd.c,v 1.59 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file
* \brief
@ -372,8 +372,7 @@ ns_lwdmanager_create(isc_mem_t *mctx, const cfg_obj_t *lwres,
strlen(searchstr));
isc_buffer_add(&namebuf, strlen(searchstr));
result = dns_name_fromtext(name, &namebuf,
dns_rootname, ISC_FALSE,
NULL);
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
isc_log_write(ns_g_lctx,
NS_LOGCATEGORY_GENERAL,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.542 2009/08/25 23:47:51 tbox Exp $ */
/* $Id: server.c,v 1.543 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -422,8 +422,7 @@ configure_view_nametable(const cfg_obj_t *vconfig, const cfg_obj_t *config,
str = cfg_obj_asstring(nameobj);
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
CHECK(dns_name_fromtext(name, &b, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
/*
* We don't need the node data, but need to set dummy data to
* avoid a partial match with an empty node. For example, if
@ -526,9 +525,7 @@ dstkey_fromconfig(const cfg_obj_t *vconfig, const cfg_obj_t *key,
dns_fixedname_init(&fkeyname);
isc_buffer_init(&namebuf, keynamestr, strlen(keynamestr));
isc_buffer_add(&namebuf, strlen(keynamestr));
CHECK(dns_name_fromtext(keyname, &namebuf,
dns_rootname, ISC_FALSE,
NULL));
CHECK(dns_name_fromtext(keyname, &namebuf, dns_rootname, 0, NULL));
CHECK(dst_key_fromdns(keyname, viewclass, &rrdatabuf,
mctx, &dstkey));
@ -712,8 +709,7 @@ mustbesecure(const cfg_obj_t *mbs, dns_resolver_t *resolver)
str = cfg_obj_asstring(cfg_tuple_get(obj, "name"));
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
CHECK(dns_name_fromtext(name, &b, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
value = cfg_obj_asboolean(cfg_tuple_get(obj, "value"));
CHECK(dns_resolver_setmustbesecure(resolver, name, value));
}
@ -873,7 +869,7 @@ configure_order(dns_order_t *order, const cfg_obj_t *ent) {
isc_buffer_add(&b, strlen(str));
dns_fixedname_init(&fixed);
result = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);
@ -1057,7 +1053,7 @@ disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
str = cfg_obj_asstring(cfg_tuple_get(disabled, "name"));
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
CHECK(dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
algorithms = cfg_tuple_get(disabled, "algorithms");
for (element = cfg_list_first(algorithms);
@ -1110,7 +1106,7 @@ on_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(name, &b, dns_rootname,
ISC_TRUE, NULL);
0, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (dns_name_equal(name, zonename))
return (ISC_TRUE);
@ -2111,7 +2107,7 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
CHECK(dns_name_fromtext(name, &b, dns_rootname,
ISC_TRUE, NULL));
0, NULL));
#endif
str = cfg_obj_asstring(cfg_tuple_get(obj,
"trust-anchor"));
@ -2119,7 +2115,7 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
isc_buffer_add(&b, strlen(str));
dlv = dns_fixedname_name(&view->dlv_fixed);
CHECK(dns_name_fromtext(dlv, &b, dns_rootname,
ISC_TRUE, NULL));
DNS_NAME_DOWNCASE, NULL));
view->dlv = dns_fixedname_name(&view->dlv_fixed);
}
} else
@ -2171,7 +2167,7 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
CHECK(dns_name_fromtext(name, &b, dns_rootname,
ISC_FALSE, NULL));
0, NULL));
CHECK(dns_view_excludedelegationonly(view,
name));
}
@ -2224,8 +2220,8 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
str = cfg_obj_asstring(obj);
isc_buffer_init(&buffer, str, strlen(str));
isc_buffer_add(&buffer, strlen(str));
CHECK(dns_name_fromtext(name, &buffer, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
NULL));
isc_buffer_init(&buffer, server, sizeof(server) - 1);
CHECK(dns_name_totext(name, ISC_FALSE, &buffer));
server[isc_buffer_usedlength(&buffer)] = 0;
@ -2239,8 +2235,8 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
str = cfg_obj_asstring(obj);
isc_buffer_init(&buffer, str, strlen(str));
isc_buffer_add(&buffer, strlen(str));
CHECK(dns_name_fromtext(name, &buffer, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
NULL));
isc_buffer_init(&buffer, contact, sizeof(contact) - 1);
CHECK(dns_name_totext(name, ISC_FALSE, &buffer));
contact[isc_buffer_usedlength(&buffer)] = 0;
@ -2266,8 +2262,8 @@ configure_view(dns_view_t *view, const cfg_obj_t *config,
/*
* Look for zone on drop list.
*/
CHECK(dns_name_fromtext(name, &buffer, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
NULL));
if (disablelist != NULL &&
on_disable_list(disablelist, name))
continue;
@ -2457,8 +2453,8 @@ configure_alternates(const cfg_obj_t *config, dns_view_t *view,
isc_buffer_add(&buffer, strlen(str));
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
CHECK(dns_name_fromtext(name, &buffer, dns_rootname,
ISC_FALSE, NULL));
CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
NULL));
portobj = cfg_tuple_get(alternate, "port");
if (cfg_obj_isuint32(portobj)) {
@ -2671,7 +2667,7 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
isc_buffer_add(&buffer, strlen(zname));
dns_fixedname_init(&fixorigin);
CHECK(dns_name_fromtext(dns_fixedname_name(&fixorigin),
&buffer, dns_rootname, ISC_FALSE, NULL));
&buffer, dns_rootname, 0, NULL));
origin = dns_fixedname_name(&fixorigin);
CHECK(ns_config_getclass(cfg_tuple_get(zconfig, "class"),
@ -3471,8 +3467,7 @@ configure_session_key(const cfg_obj_t **maps, ns_server_t *server,
isc_buffer_init(&buffer, keynamestr, strlen(keynamestr));
isc_buffer_add(&buffer, strlen(keynamestr));
keyname = dns_fixedname_name(&fname);
result = dns_name_fromtext(keyname, &buffer, dns_rootname, ISC_FALSE,
NULL);
result = dns_name_fromtext(keyname, &buffer, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);
@ -5053,7 +5048,7 @@ zone_from_args(ns_server_t *server, char *args, dns_zone_t **zonep) {
isc_buffer_add(&buf, strlen(zonetxt));
dns_fixedname_init(&name);
result = dns_name_fromtext(dns_fixedname_name(&name),
&buf, dns_rootname, ISC_FALSE, NULL);
&buf, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
goto fail1;
@ -5894,7 +5889,7 @@ ns_server_flushname(ns_server_t *server, char *args) {
isc_buffer_add(&b, strlen(target));
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tkeyconf.c,v 1.29 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: tkeyconf.c,v 1.30 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -77,8 +77,7 @@ ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_add(&b, strlen(s));
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname,
ISC_FALSE, NULL));
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
type = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_KEY;
RETERR(dst_key_fromfile(name, (dns_keytag_t) n, DNS_KEYALG_DH,
type, NULL, mctx, &tctx->dhkey));
@ -92,8 +91,7 @@ ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_add(&b, strlen(s));
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE,
NULL));
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t));
if (tctx->domain == NULL) {
result = ISC_R_NOMEMORY;
@ -112,10 +110,8 @@ ns_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_add(&b, strlen(s));
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE,
NULL));
RETERR(dst_gssapi_acquirecred(name, ISC_FALSE,
&tctx->gsscred));
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
RETERR(dst_gssapi_acquirecred(name, ISC_FALSE, &tctx->gsscred));
}
*tctxp = tctx;

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tsigconf.c,v 1.32 2009/06/11 23:47:55 tbox Exp $ */
/* $Id: tsigconf.c,v 1.33 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -82,7 +82,7 @@ add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
isc_buffer_add(&keynamesrc, strlen(keyid));
isc_buffer_init(&keynamebuf, keynamedata, sizeof(keynamedata));
ret = dns_name_fromtext(&keyname, &keynamesrc, dns_rootname,
ISC_TRUE, &keynamebuf);
DNS_NAME_DOWNCASE, &keynamebuf);
if (ret != ISC_R_SUCCESS)
goto failure;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.10 2007/06/19 23:46:59 tbox Exp $
# $Id: Makefile.in,v 1.11 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -24,7 +24,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I${srcdir}/include -I${srcdir}/../include \
${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
OBJS = os.@O@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.153 2009/07/14 23:47:53 tbox Exp $ */
/* $Id: zoneconf.c,v 1.154 2009/09/01 00:22:25 jinmei Exp $ */
/*% */
@ -260,7 +260,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(dns_fixedname_name(&fident), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(identity, ns_g_lctx, ISC_LOG_ERROR,
"'%s' is not a valid name", str);
@ -283,8 +283,7 @@ configure_zone_ssutable(const cfg_obj_t *zconfig, dns_zone_t *zone,
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(dns_fixedname_name(&fname),
&b, dns_rootname,
ISC_FALSE, NULL);
&b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(identity, ns_g_lctx, ISC_LOG_ERROR,
"'%s' is not a valid name", str);

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.32 2009/07/14 22:54:56 each Exp $
# $Id: Makefile.in,v 1.33 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -26,7 +26,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
${ISC_INCLUDES} ${ISCCFG_INCLUDES} @DST_GSSAPI_INC@
CDEFINES = @USE_GSSAPI@
CDEFINES = -DBIND9 @USE_GSSAPI@
CWARNINGS =
LWRESLIBS = ../../lib/lwres/liblwres.@A@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsupdate.c,v 1.171 2009/07/19 04:18:04 each Exp $ */
/* $Id: nsupdate.c,v 1.172 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -526,8 +526,7 @@ setup_keystr(void) {
isc_buffer_add(&keynamesrc, n - name);
debug("namefromtext");
result = dns_name_fromtext(keyname, &keynamesrc, dns_rootname,
ISC_FALSE, NULL);
result = dns_name_fromtext(keyname, &keynamesrc, dns_rootname, 0, NULL);
check_result(result, "dns_name_fromtext");
secretlen = strlen(secretstr) * 3 / 4;
@ -1110,8 +1109,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
dns_message_takebuffer(msg, &namebuf);
isc_buffer_init(&source, word, strlen(word));
isc_buffer_add(&source, strlen(word));
result = dns_name_fromtext(*namep, &source, dns_rootname,
ISC_FALSE, NULL);
result = dns_name_fromtext(*namep, &source, dns_rootname, 0, NULL);
check_result(result, "dns_name_fromtext");
isc_buffer_invalidate(&source);
return (STATUS_MORE);
@ -1433,7 +1431,7 @@ evaluate_key(char *cmdline) {
isc_buffer_init(&b, namestr, strlen(namestr));
isc_buffer_add(&b, strlen(namestr));
result = dns_name_fromtext(keyname, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(keyname, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
fprintf(stderr, "could not parse key name\n");
return (STATUS_SYNTAX);
@ -1490,8 +1488,7 @@ evaluate_zone(char *cmdline) {
userzone = dns_fixedname_name(&fuserzone);
isc_buffer_init(&b, word, strlen(word));
isc_buffer_add(&b, strlen(word));
result = dns_name_fromtext(userzone, &b, dns_rootname, ISC_FALSE,
NULL);
result = dns_name_fromtext(userzone, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
userzone = NULL; /* Lest it point to an invalid name */
fprintf(stderr, "could not parse zone name\n");
@ -2426,8 +2423,7 @@ start_gssrequest(dns_name_t *master)
isc_result_totext(result));
isc_buffer_init(&buf, servicename, strlen(servicename));
isc_buffer_add(&buf, strlen(servicename));
result = dns_name_fromtext(servname, &buf, dns_rootname,
ISC_FALSE, NULL);
result = dns_name_fromtext(servname, &buf, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
fatal("dns_name_fromtext(servname) failed: %s",
isc_result_totext(result));
@ -2444,8 +2440,7 @@ start_gssrequest(dns_name_t *master)
isc_buffer_init(&buf, keystr, strlen(keystr));
isc_buffer_add(&buf, strlen(keystr));
result = dns_name_fromtext(keyname, &buf, dns_rootname,
ISC_FALSE, NULL);
result = dns_name_fromtext(keyname, &buf, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
fatal("dns_name_fromtext(keyname) failed: %s",
isc_result_totext(result));
@ -2596,8 +2591,7 @@ recvgss(isc_task_t *task, isc_event_t *event) {
servname = dns_fixedname_name(&fname);
isc_buffer_init(&buf, servicename, strlen(servicename));
isc_buffer_add(&buf, strlen(servicename));
result = dns_name_fromtext(servname, &buf, dns_rootname,
ISC_FALSE, NULL);
result = dns_name_fromtext(servname, &buf, dns_rootname, 0, NULL);
check_result(result, "dns_name_fromtext");
tsigkey = NULL;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.46 2009/06/11 23:47:55 tbox Exp $
# $Id: Makefile.in,v 1.47 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -26,7 +26,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I${srcdir}/include ${ISC_INCLUDES} ${ISCCC_INCLUDES} \
${ISCCFG_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.134 2009/03/02 03:53:29 each Exp $
# $Id: Makefile.in,v 1.135 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -24,7 +24,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
${LWRES_INCLUDES} ${OMAPI_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb_test.c,v 1.68 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: adb_test.c,v 1.69 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file */
@ -249,8 +249,7 @@ lookup(const char *target) {
isc_buffer_add(&t, strlen(target));
isc_buffer_init(&namebuf, namedata, sizeof(namedata));
dns_name_init(&name, NULL);
result = dns_name_fromtext(&name, &t, dns_rootname, ISC_FALSE,
&namebuf);
result = dns_name_fromtext(&name, &t, dns_rootname, 0, &namebuf);
check_result(result, "dns_name_fromtext %s", target);
result = dns_name_dup(&name, mctx, &client->name);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: byname_test.c,v 1.31 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: byname_test.c,v 1.32 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file
* \author
@ -343,7 +343,7 @@ main(int argc, char *argv[]) {
dns_fixedname_init(&name);
dns_fixedname_init(&target);
RUNTIME_CHECK(dns_name_fromtext(dns_fixedname_name(&name), &b,
dns_rootname, ISC_FALSE, NULL) ==
dns_rootname, 0, NULL) ==
ISC_R_SUCCESS);
RUNTIME_CHECK(isc_app_onrun(mctx, task, run, NULL) == ISC_R_SUCCESS);

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.29 2007/06/19 23:46:59 tbox Exp $
# $Id: Makefile.in,v 1.30 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_db.c,v 1.38 2009/01/22 23:47:53 tbox Exp $ */
/* $Id: t_db.c,v 1.39 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -61,7 +61,7 @@ t_create(const char *db_type, const char *origin, const char *class,
isc_buffer_init(&origin_buffer, origin, len);
isc_buffer_add(&origin_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_origin),
&origin_buffer, NULL, ISC_FALSE, NULL);
&origin_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -190,7 +190,7 @@ t_dns_db_load(char **av) {
isc_buffer_init(&findname_buffer, findname, len);
isc_buffer_add(&findname_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname),
&findname_buffer, NULL, ISC_FALSE, NULL);
&findname_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -305,7 +305,7 @@ t_dns_db_zc_x(char *filename, char *db_type, char *origin, char *class,
isc_buffer_init(&origin_buffer, origin, len);
isc_buffer_add(&origin_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_origin),
&origin_buffer, NULL, ISC_FALSE, NULL);
&origin_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -584,7 +584,7 @@ t_dns_db_origin(char **av) {
}
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_origin),
&origin_buffer, NULL, ISC_FALSE, NULL);
&origin_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -832,7 +832,7 @@ t_dns_db_currentversion(char **av) {
isc_buffer_init(&findname_buffer, findname, len);
isc_buffer_add(&findname_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname),
&findname_buffer, NULL, ISC_FALSE, NULL);
&findname_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -1123,7 +1123,7 @@ t_dns_db_newversion(char **av) {
isc_buffer_init(&newname_buffer, newname, len);
isc_buffer_add(&newname_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_newname),
&newname_buffer, NULL, ISC_FALSE, NULL);
&newname_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -1449,7 +1449,7 @@ t_dns_db_closeversion_1(char **av) {
isc_buffer_init(&name_buffer, existing_name, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_existingname),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -1528,7 +1528,7 @@ t_dns_db_closeversion_1(char **av) {
isc_buffer_init(&name_buffer, new_name, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_newname),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -1861,7 +1861,7 @@ t_dns_db_closeversion_2(char **av) {
isc_buffer_init(&name_buffer, existing_name, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_existingname),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -1942,7 +1942,7 @@ t_dns_db_closeversion_2(char **av) {
isc_buffer_init(&name_buffer, new_name, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_newname),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -2279,7 +2279,7 @@ t_dns_db_expirenode(char **av) {
isc_buffer_init(&name_buffer, existing_name, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_existingname),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));
@ -2525,7 +2525,7 @@ t_dns_db_findnode_1(char **av) {
isc_buffer_init(&name_buffer, find_name, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_name),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name),
ISC_FALSE, &nodep);
@ -2681,7 +2681,7 @@ t_dns_db_findnode_2(char **av) {
isc_buffer_init(&name_buffer, newname, len);
isc_buffer_add(&name_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_name),
&name_buffer, NULL, ISC_FALSE, NULL);
&name_buffer, NULL, 0, NULL);
dns_result = dns_db_findnode(db, dns_fixedname_name(&dns_name),
ISC_FALSE, &nodep);
@ -2886,7 +2886,7 @@ t_dns_db_find_x(char **av) {
isc_buffer_init(&findname_buffer, findname, len);
isc_buffer_add(&findname_buffer, len);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname),
&findname_buffer, NULL, ISC_FALSE, NULL);
&findname_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db_test.c,v 1.66 2008/09/25 04:02:38 tbox Exp $ */
/* $Id: db_test.c,v 1.67 2009/09/01 00:22:25 jinmei Exp $ */
/*! \file
* \author
@ -134,8 +134,7 @@ select_db(char *origintext) {
isc_buffer_add(&source, len);
dns_fixedname_init(&forigin);
origin = dns_fixedname_name(&forigin);
result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE,
NULL);
result = dns_name_fromtext(origin, &source, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
print_result("bad name", result);
return (NULL);
@ -188,8 +187,7 @@ list(dbinfo *dbi, char *seektext) {
result = dns_name_fromtext(seekname, &source,
dns_db_origin(
dbi->db),
ISC_FALSE,
NULL);
0, NULL);
if (result == ISC_R_SUCCESS)
result = dns_dbiterator_seek(
dbi->dbiterator,
@ -271,8 +269,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
isc_buffer_add(&source, len);
dns_fixedname_init(&forigin);
origin = dns_fixedname_name(&forigin);
result = dns_name_fromtext(origin, &source, dns_rootname, ISC_FALSE,
NULL);
result = dns_name_fromtext(origin, &source, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);
@ -736,8 +733,7 @@ main(int argc, char *argv[]) {
isc_buffer_init(&source, s, len);
isc_buffer_add(&source, len);
isc_buffer_init(&target, b, sizeof(b));
result = dns_name_fromtext(&name, &source, origin,
ISC_FALSE, &target);
result = dns_name_fromtext(&name, &source, origin, 0, &target);
if (result != ISC_R_SUCCESS) {
print_result("bad name: ", result);
continue;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.48 2009/03/02 23:47:43 tbox Exp $
# $Id: Makefile.in,v 1.49 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -24,7 +24,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} \
${ISC_INCLUDES} @DST_GSSAPI_INC@
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dst_test.c,v 1.45 2009/03/02 23:47:43 tbox Exp $ */
/* $Id: dst_test.c,v 1.46 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -264,7 +264,7 @@ main(void) {
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "test.", 5);
isc_buffer_add(&b, 5);
result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, NULL, 0, NULL);
if (result != ISC_R_SUCCESS)
return (1);
io(name, 23616, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
@ -276,7 +276,7 @@ main(void) {
isc_buffer_init(&b, "dh.", 3);
isc_buffer_add(&b, 3);
result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, NULL, 0, NULL);
if (result != ISC_R_SUCCESS)
return (1);
dh(name, 18602, name, 48957, mctx);

View file

@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gsstest.c,v 1.6 2007/06/19 23:47:00 tbox Exp $ */
/* $Id: gsstest.c,v 1.7 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -212,7 +212,7 @@ sendquery(isc_task_t *task, isc_event_t *event)
isc_buffer_init(&buf, host, strlen(host));
isc_buffer_add(&buf, strlen(host));
result = dns_name_fromtext(dns_fixedname_name(&queryname), &buf,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
CHECK("dns_name_fromtext", result);
result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &message);
@ -369,7 +369,7 @@ initctx1(isc_task_t *task, isc_event_t *event) {
isc_buffer_init(&buf, contextname, strlen(contextname));
isc_buffer_add(&buf, strlen(contextname));
result = dns_name_fromtext(dns_fixedname_name(&servername), &buf,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
CHECK("dns_name_fromtext", result);
/* Make name happen */
@ -377,7 +377,7 @@ initctx1(isc_task_t *task, isc_event_t *event) {
isc_buffer_init(&buf, gssid, strlen(gssid));
isc_buffer_add(&buf, strlen(gssid));
result = dns_name_fromtext(dns_fixedname_name(&gssname), &buf,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
CHECK("dns_name_fromtext", result);
query = NULL;

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_dst.c,v 1.57 2009/01/22 23:47:54 tbox Exp $ */
/* $Id: t_dst.c,v 1.58 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -405,7 +405,7 @@ t1(void) {
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "test.", 5);
isc_buffer_add(&b, 5);
isc_result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
isc_result = dns_name_fromtext(name, &b, NULL, 0, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
isc_result_totext(isc_result));
@ -427,7 +427,7 @@ t1(void) {
isc_buffer_init(&b, "dh.", 3);
isc_buffer_add(&b, 3);
isc_result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
isc_result = dns_name_fromtext(name, &b, NULL, 0, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
isc_result_totext(isc_result));
@ -686,7 +686,7 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, keyname, strlen(keyname));
isc_buffer_add(&b, strlen(keyname));
isc_result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
isc_result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
isc_result_totext(isc_result));

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.28 2007/06/19 23:47:00 tbox Exp $
# $Id: Makefile.in,v 1.29 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
# Note that we do not want to use libtool for libt_api

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_master.c,v 1.38 2009/01/22 23:47:54 tbox Exp $ */
/* $Id: t_master.c,v 1.39 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -94,7 +94,7 @@ test_master(char *testfile, char *origin, char *class, isc_result_t exp_result)
isc_buffer_init(&target, name_buf, BUFLEN);
dns_name_init(&dns_origin, NULL);
dns_result = dns_name_fromtext(&dns_origin, &source, dns_rootname,
ISC_FALSE, &target);
0, &target);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
dns_result_totext(dns_result));

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master_test.c,v 1.30 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: master_test.c,v 1.31 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -75,7 +75,7 @@ main(int argc, char *argv[]) {
isc_buffer_init(&target, name_buf, 255);
dns_name_init(&origin, NULL);
result = dns_name_fromtext(&origin, &source, dns_rootname,
ISC_FALSE, &target);
0, &target);
if (result != ISC_R_SUCCESS) {
fprintf(stdout, "dns_name_fromtext: %s\n",
dns_result_totext(result));

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.34 2007/06/19 23:47:00 tbox Exp $
# $Id: Makefile.in,v 1.35 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCLIBS = ../../../lib/isc/libisc.@A@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name_test.c,v 1.41 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: name_test.c,v 1.42 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -73,7 +73,7 @@ main(int argc, char *argv[]) {
isc_buffer_t source;
isc_region_t r;
dns_name_t *name, *origin, *comp, *down;
isc_boolean_t downcase = ISC_FALSE;
unsigned int downcase = 0;
size_t len;
isc_boolean_t quiet = ISC_FALSE;
isc_boolean_t concatenate = ISC_FALSE;
@ -128,8 +128,7 @@ main(int argc, char *argv[]) {
dns_fixedname_init(&oname);
origin = &oname.name;
result = dns_name_fromtext(origin, &source,
dns_rootname, ISC_FALSE,
NULL);
dns_rootname, 0, NULL);
if (result != 0) {
fprintf(stderr,
"dns_name_fromtext() failed: %d\n",
@ -151,8 +150,8 @@ main(int argc, char *argv[]) {
isc_buffer_add(&source, len);
dns_fixedname_init(&compname);
comp = &compname.name;
result = dns_name_fromtext(comp, &source,
origin, ISC_FALSE, NULL);
result = dns_name_fromtext(comp, &source, origin,
0, NULL);
if (result != 0) {
fprintf(stderr,
"dns_name_fromtext() failed: %d\n",

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.28 2007/06/19 23:47:00 tbox Exp $
# $Id: Makefile.in,v 1.29 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
# Note that we do not want to use libtool for libt_api

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_names.c,v 1.48 2009/01/22 23:47:54 tbox Exp $ */
/* $Id: t_names.c,v 1.49 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -344,8 +344,7 @@ dname_from_tname(char *name, dns_name_t *dns_name) {
isc_buffer_init(binbuf, junk, BUFLEN);
dns_name_init(dns_name, NULL);
dns_name_setbuffer(dns_name, binbuf);
result = dns_name_fromtext(dns_name, &txtbuf,
NULL, ISC_FALSE, NULL);
result = dns_name_fromtext(dns_name, &txtbuf, NULL, 0, NULL);
} else {
result = ISC_R_NOSPACE;
if (junk != NULL)
@ -535,7 +534,7 @@ test_dns_name_isabsolute(char *test_name, isc_boolean_t expected) {
isc_buffer_init(&binbuf, &junk[0], BUFLEN);
dns_name_init(&name, NULL);
dns_name_setbuffer(&name, &binbuf);
result = dns_name_fromtext(&name, &buf, NULL, ISC_FALSE, NULL);
result = dns_name_fromtext(&name, &buf, NULL, 0, NULL);
if (result == ISC_R_SUCCESS) {
isabs_p = dns_name_isabsolute(&name);
if (isabs_p == expected)
@ -1659,7 +1658,7 @@ static const char *a40 =
static int
test_dns_name_fromtext(char *test_name1, char *test_name2, char *test_origin,
isc_boolean_t downcase)
unsigned int downcase)
{
int result;
int order;
@ -1702,8 +1701,8 @@ test_dns_name_fromtext(char *test_name1, char *test_name2, char *test_origin,
dns_name_setbuffer(&dns_name2, &binbuf2);
dns_name_setbuffer(&dns_name3, &binbuf3);
dns_result = dns_name_fromtext(&dns_name3, &txtbuf3, NULL,
ISC_FALSE, &binbuf3);
dns_result = dns_name_fromtext(&dns_name3, &txtbuf3, NULL, 0,
&binbuf3);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext(dns_name3) failed, result == %s\n",
dns_result_totext(dns_result));
@ -1718,8 +1717,8 @@ test_dns_name_fromtext(char *test_name1, char *test_name2, char *test_origin,
return (T_FAIL);
}
dns_result = dns_name_fromtext(&dns_name2, &txtbuf2, NULL,
ISC_FALSE, &binbuf2);
dns_result = dns_name_fromtext(&dns_name2, &txtbuf2, NULL, 0,
&binbuf2);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext(dns_name2) failed, result == %s\n",
dns_result_totext(dns_result));
@ -1777,8 +1776,8 @@ t_dns_name_fromtext(void) {
Tokens[2],
atoi(Tokens[3])
== 0 ?
ISC_FALSE :
ISC_TRUE);
0 :
DNS_NAME_DOWNCASE);
} else {
t_info("bad format at line %d\n", line);
}
@ -1830,8 +1829,7 @@ test_dns_name_totext(char *test_name, isc_boolean_t omit_final) {
/*
* Out of the data file to dns_name1.
*/
dns_result = dns_name_fromtext(&dns_name1, &buf1, NULL, ISC_FALSE,
&buf2);
dns_result = dns_name_fromtext(&dns_name1, &buf1, NULL, 0, &buf2);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed, result == %s\n",
dns_result_totext(dns_result));
@ -1855,8 +1853,7 @@ test_dns_name_totext(char *test_name, isc_boolean_t omit_final) {
*/
dns_name_init(&dns_name2, NULL);
isc_buffer_init(&buf3, junk3, BUFLEN);
dns_result = dns_name_fromtext(&dns_name2, &buf1, NULL, ISC_FALSE,
&buf3);
dns_result = dns_name_fromtext(&dns_name2, &buf1, NULL, 0, &buf3);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed, result == %s\n",
dns_result_totext(dns_result));
@ -2195,8 +2192,7 @@ test_dns_name_towire(char *testname, unsigned int dc_method, char *exp_data,
isc_buffer_init(&iscbuf1, testname, len);
isc_buffer_add(&iscbuf1, len);
isc_buffer_init(&iscbuf2, buf2, BUFLEN);
dns_result = dns_name_fromtext(&dns_name, &iscbuf1, NULL, ISC_FALSE,
&iscbuf2);
dns_result = dns_name_fromtext(&dns_name, &iscbuf1, NULL, 0, &iscbuf2);
if (dns_result == ISC_R_SUCCESS) {
isc_buffer_init(&iscbuf3, buf3, buflen);
dns_result = dns_name_towire(&dns_name, &cctx, &iscbuf3);

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.16 2007/06/19 23:47:00 tbox Exp $
# $Id: Makefile.in,v 1.17 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCLIBS = ../../../lib/isc/libisc.@A@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsecify.c,v 1.8 2008/09/25 04:02:38 tbox Exp $ */
/* $Id: nsecify.c,v 1.9 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -139,7 +139,7 @@ nsecify(char *filename) {
len = strlen(origintext);
isc_buffer_init(&b, origintext, len);
isc_buffer_add(&b, len);
result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
check_result(result, "dns_name_fromtext()");
db = NULL;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.28 2007/06/19 23:47:00 tbox Exp $
# $Id: Makefile.in,v 1.29 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
# Note that we do not want to use libtool for libt_api

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_rbt.c,v 1.32 2009/01/22 23:47:54 tbox Exp $ */
/* $Id: t_rbt.c,v 1.33 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -152,7 +152,7 @@ create_name(char *s, isc_mem_t *mctx, dns_name_t **dns_name) {
isc_buffer_init(&target, name + 1, DNSNAMELEN);
result = dns_name_fromtext(name, &source, dns_rootname,
ISC_FALSE, &target);
0, &target);
if (result != ISC_R_SUCCESS) {
++nfails;
@ -832,7 +832,7 @@ t_dns_rbtnodechain_init(char *dbfile, char *findname,
dns_fixedname_init(&dns_nextname);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname),
&isc_buffer, NULL, ISC_FALSE, NULL);
&isc_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
@ -1494,7 +1494,7 @@ t_dns_rbtnodechain_next(char *dbfile, char *findname,
dns_fixedname_init(&dns_origin);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname),
&isc_buffer, NULL, ISC_FALSE, NULL);
&isc_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
@ -1701,7 +1701,7 @@ t_dns_rbtnodechain_prev(char *dbfile, char *findname, char *prevname,
dns_fixedname_init(&dns_origin);
dns_result = dns_name_fromtext(dns_fixedname_name(&dns_findname),
&isc_buffer, NULL, ISC_FALSE, NULL);
&isc_buffer, NULL, 0, NULL);
if (dns_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rbt_test.c,v 1.48 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: rbt_test.c,v 1.49 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -71,8 +71,7 @@ create_name(char *s) {
dns_name_init(name, NULL);
isc_buffer_init(&target, name + 1, DNSNAMELEN);
result = dns_name_fromtext(name, &source, dns_rootname,
ISC_FALSE, &target);
result = dns_name_fromtext(name, &source, dns_rootname, 0, &target);
if (result != ISC_R_SUCCESS) {
printf("dns_name_fromtext(%s) failed: %s\n",

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sig0_test.c,v 1.17 2008/07/22 23:47:04 tbox Exp $ */
/* $Id: sig0_test.c,v 1.18 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -157,8 +157,7 @@ buildquery(void) {
isc_buffer_add(&namesrc, strlen(nametext));
isc_buffer_init(&namedst, namedata, sizeof(namedata));
dns_name_init(qname, NULL);
result = dns_name_fromtext(qname, &namesrc, dns_rootname, ISC_FALSE,
&namedst);
result = dns_name_fromtext(qname, &namesrc, dns_rootname, 0, &namedst);
CHECK("dns_name_fromtext", result);
ISC_LIST_APPEND(qname->list, question, link);
dns_message_addname(query, qname, DNS_SECTION_QUESTION);
@ -264,7 +263,7 @@ main(int argc, char *argv[]) {
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "child.example.", strlen("child.example."));
isc_buffer_add(&b, strlen("child.example."));
result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
CHECK("dns_name_fromtext", result);
key = NULL;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.23 2009/02/06 23:47:42 tbox Exp $
# $Id: Makefile.in,v 1.24 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCLIBS = ../../../lib/isc/libisc.@A@ @DNS_CRYPTO_LIBS@

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.19 2007/06/19 23:47:03 tbox Exp $
# $Id: Makefile.in,v 1.20 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -25,7 +25,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${LWRES_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
LWRESLIBS = ../../../../lib/lwres/liblwres.@A@

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.11 2007/06/19 23:47:06 tbox Exp $
# $Id: Makefile.in,v 1.12 2009/09/01 00:22:25 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -25,7 +25,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keycreate.c,v 1.17 2009/07/19 23:47:55 tbox Exp $ */
/* $Id: keycreate.c,v 1.18 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -153,14 +153,14 @@ sendquery(isc_task_t *task, isc_event_t *event) {
isc_buffer_init(&namestr, "tkeytest.", 9);
isc_buffer_add(&namestr, 9);
result = dns_name_fromtext(dns_fixedname_name(&keyname), &namestr,
NULL, ISC_FALSE, NULL);
NULL, 0, NULL);
CHECK("dns_name_fromtext", result);
dns_fixedname_init(&ownername);
isc_buffer_init(&namestr, ownername_str, strlen(ownername_str));
isc_buffer_add(&namestr, strlen(ownername_str));
result = dns_name_fromtext(dns_fixedname_name(&ownername), &namestr,
NULL, ISC_FALSE, NULL);
NULL, 0, NULL);
CHECK("dns_name_fromtext", result);
isc_buffer_init(&keybuf, keydata, 9);

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.32 2009/02/06 23:47:42 tbox Exp $
# $Id: Makefile.in,v 1.33 2009/09/01 00:22:26 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCLIBS = ../../../lib/isc/libisc.@A@ @DNS_CRYPTO_LIBS@

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.30 2009/02/06 23:47:42 tbox Exp $
# $Id: Makefile.in,v 1.31 2009/09/01 00:22:26 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${TEST_INCLUDES} ${ISC_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCLIBS = ../../../lib/isc/libisc.@A@ @DNS_CRYPTO_LIBS@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone_test.c,v 1.33 2007/06/19 23:46:59 tbox Exp $ */
/* $Id: zone_test.c,v 1.34 2009/09/01 00:22:25 jinmei Exp $ */
#include <config.h>
@ -104,7 +104,7 @@ setup(const char *zonename, const char *filename, const char *classname) {
isc_buffer_add(&buffer, strlen(zonename));
dns_fixedname_init(&fixorigin);
result = dns_name_fromtext(dns_fixedname_name(&fixorigin),
&buffer, dns_rootname, ISC_FALSE, NULL);
&buffer, dns_rootname, 0, NULL);
ERRRET(result, "dns_name_fromtext");
origin = dns_fixedname_name(&fixorigin);
@ -206,7 +206,7 @@ query(void) {
isc_buffer_init(&buffer, buf, strlen(buf));
isc_buffer_add(&buffer, strlen(buf));
result = dns_name_fromtext(dns_fixedname_name(&name),
&buffer, dns_rootname, ISC_FALSE, NULL);
&buffer, dns_rootname, 0, NULL);
ERRCONT(result, "dns_name_fromtext");
result = dns_db_find(db, dns_fixedname_name(&name),

View file

@ -12,7 +12,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.7 2009/07/21 02:41:01 marka Exp $
# $Id: Makefile.in,v 1.8 2009/09/01 00:22:26 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \
${LWRES_INCLUDES} ${OMAPI_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@

View file

@ -16,7 +16,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.in,v 1.117 2009/08/13 01:51:19 marka Exp $ */
/* $Id: config.h.in,v 1.118 2009/09/01 00:22:24 jinmei Exp $ */
/*! \file */
@ -292,6 +292,12 @@ int sigwait(const unsigned int *set, int *sig);
/* Defined if extern char *optarg is not declared. */
#undef NEED_OPTARG
/* Define to the buffer length type used by getnameinfo(3). */
#undef IRS_GETNAMEINFO_BUFLEN_T
/* Define to the flags type used by getnameinfo(3). */
#undef IRS_GETNAMEINFO_FLAGS_T
/* Define if connect does not honour the permission on the UNIX domain socket.
*/
#undef NEED_SECURE_DIRECTORY

View file

@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.473 $)
AC_REVISION($Revision: 1.474 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.59)
@ -62,7 +62,6 @@ It is available from http://www.isc.org as a separate download.])
;;
esac
#
# Make very sure that these are the first files processed by
# config.status, since we use the processed output as the input for
@ -1323,6 +1322,54 @@ AC_SUBST(LIBTOOL_MODE_LINK)
AC_SUBST(LIBTOOL_ALLOW_UNDEFINED)
AC_SUBST(LIBTOOL_IN_MAIN)
#
# build exportable DNS library?
#
AC_ARG_ENABLE(exportlib,
[ --enable-exportlib build exportable library (GNU make required)
[[default=no]]])
case "$enable_exportlib" in
yes)
gmake=
for x in gmake gnumake make; do
if $x --version 2>/dev/null | grep GNU > /dev/null; then
gmake=$x
break;
fi
done
if test -z "$gmake"; then
AC_MSG_ERROR([exportlib requires GNU make. Install it or disable the feature.])
fi
LIBEXPORT=lib/export
AC_SUBST(LIBEXPORT)
BIND9_CO_RULE="%.$O: \${srcdir}/%.c"
;;
no|*)
BIND9_CO_RULE=".c.$O:"
;;
esac
AC_SUBST(BIND9_CO_RULE)
AC_ARG_WITH(export-libdir,
[ --with-export-libdir[=PATH]
installation directory for the export library
[[EPREFIX/lib/bind9]]],
export_libdir="$withval",)
if test -z "$export_libdir"; then
export_libdir="\${exec_prefix}/lib/bind9/"
fi
AC_SUBST(export_libdir)
AC_ARG_WITH(export-installdir,
[ --with-export-installdir[=PATH]
installation directory for the header files of the
export library [[PREFIX/include/bind9]]],
export_installdir="$withval",)
if test -z "$export_includedir"; then
export_includedir="\${prefix}/include/bind9/"
fi
AC_SUBST(export_includedir)
#
# Here begins a very long section to determine the system's networking
# capabilities. The order of the tests is significant.
@ -1707,10 +1754,13 @@ AC_TRY_COMPILE([
[struct addrinfo a; return (0);],
[AC_MSG_RESULT(yes)
ISC_LWRES_NEEDADDRINFO="#undef ISC_LWRES_NEEDADDRINFO"
ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
AC_DEFINE(HAVE_ADDRINFO)],
[AC_MSG_RESULT(no)
ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"])
ISC_LWRES_NEEDADDRINFO="#define ISC_LWRES_NEEDADDRINFO 1"
ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
AC_SUBST(ISC_LWRES_NEEDADDRINFO)
AC_SUBST(ISC_IRS_NEEDADDRINFO)
#
# Check for rrsetinfo
@ -1797,6 +1847,35 @@ AC_TRY_COMPILE([
ISC_LWRES_NEEDHERRNO="#define ISC_LWRES_NEEDHERRNO 1"])
AC_SUBST(ISC_LWRES_NEEDHERRNO)
#
# Sadly, the definitions of system-supplied getnameinfo(3) vary. Try to catch
# known variations here:
#
AC_MSG_CHECKING(for getnameinfo prototype definitions)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int getnameinfo(const struct sockaddr *, socklen_t, char *,
socklen_t, char *, socklen_t, unsigned int);],
[ return (0);],
[AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int)],
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int getnameinfo(const struct sockaddr *, socklen_t, char *,
size_t, char *, size_t, int);],
[ return (0);],
[AC_MSG_RESULT(size_t for buflen; int for flags)
AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
[AC_MSG_RESULT(not match any subspecies; assume standard definition)
AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])
AC_CHECK_FUNC(getipnodebyname,
[ISC_LWRES_GETIPNODEPROTO="#undef ISC_LWRES_GETIPNODEPROTO"],
[ISC_LWRES_GETIPNODEPROTO="#define ISC_LWRES_GETIPNODEPROTO 1"])
@ -1811,6 +1890,7 @@ AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
AC_SUBST(ISC_LWRES_GETIPNODEPROTO)
AC_SUBST(ISC_LWRES_GETADDRINFOPROTO)
AC_SUBST(ISC_LWRES_GETNAMEINFOPROTO)
AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
AC_ARG_ENABLE(getifaddrs,
[ --enable-getifaddrs Enable the use of getifaddrs() [[yes|no]].],
@ -2144,6 +2224,8 @@ AC_SUBST(ISC_PLATFORM_USEDECLSPEC)
ISC_PLATFORM_USEDECLSPEC="#undef ISC_PLATFORM_USEDECLSPEC"
AC_SUBST(LWRES_PLATFORM_USEDECLSPEC)
LWRES_PLATFORM_USEDECLSPEC="#undef LWRES_PLATFORM_USEDECLSPEC"
AC_SUBST(IRS_PLATFORM_USEDECLSPEC)
IRS_PLATFORM_USEDECLSPEC="#undef IRS_PLATFORM_USEDECLSPEC"
#
# Random remaining OS-specific issues involving compiler warnings.
@ -2752,6 +2834,9 @@ LIBBIND9_API=$srcdir/lib/bind9/api
AC_SUBST_FILE(LIBLWRES_API)
LIBLWRES_API=$srcdir/lib/lwres/api
AC_SUBST_FILE(LIBIRS_API)
LIBIRS_API=$srcdir/lib/irs/api
#
# Configure any DLZ drivers.
#
@ -2941,10 +3026,38 @@ AC_CONFIG_FILES([
lib/isccfg/Makefile
lib/isccfg/include/Makefile
lib/isccfg/include/isccfg/Makefile
lib/irs/Makefile
lib/irs/include/Makefile
lib/irs/include/irs/Makefile
lib/irs/include/irs/netdb.h
lib/irs/include/irs/platform.h
lib/dns/Makefile
lib/dns/include/Makefile
lib/dns/include/dns/Makefile
lib/dns/include/dst/Makefile
lib/export/Makefile
lib/export/isc/Makefile
lib/export/isc/include/Makefile
lib/export/isc/include/isc/Makefile
lib/export/isc/unix/Makefile
lib/export/isc/unix/include/Makefile
lib/export/isc/unix/include/isc/Makefile
lib/export/isc/nls/Makefile
lib/export/isc/$thread_dir/Makefile
lib/export/isc/$thread_dir/include/Makefile
lib/export/isc/$thread_dir/include/isc/Makefile
lib/export/dns/Makefile
lib/export/dns/include/Makefile
lib/export/dns/include/dns/Makefile
lib/export/dns/include/dst/Makefile
lib/export/irs/Makefile
lib/export/irs/include/Makefile
lib/export/irs/include/irs/Makefile
lib/export/isccfg/Makefile
lib/export/isccfg/include/Makefile
lib/export/isccfg/include/isccfg/Makefile
lib/export/samples/Makefile
lib/export/samples/Makefile-postinstall
lib/bind9/Makefile
lib/bind9/include/Makefile
lib/bind9/include/bind9/Makefile

View file

@ -914,7 +914,7 @@ dbus_mgr_get_name_list
dnsName = dns_fixedname_name(fixedname);
result= dns_name_fromtext
( dnsName, &buffer, ( *(endp-1) != '.') ? dns_rootname : NULL, ISC_FALSE, NULL
( dnsName, &buffer, ( *(endp-1) != '.') ? dns_rootname : NULL, 0, NULL
);
if( result != ISC_R_SUCCESS )
@ -1566,7 +1566,7 @@ dbus_mgr_handle_get_forwarders
dnsName = dns_fixedname_name(&fixedname);
result = dns_name_fromtext
( dnsName, &buffer, dns_rootname, ISC_FALSE, NULL
( dnsName, &buffer, dns_rootname, 0, NULL
);
if( result != ISC_R_SUCCESS )
@ -1740,7 +1740,7 @@ dns_name_t *dbus_mgr_if_reverse_ip_name
dns_name = dns_fixedname_name(fixedname);
result= dns_name_fromtext
( dns_name, &buffer, dns_rootname, ISC_FALSE, NULL
( dns_name, &buffer, dns_rootname, 0, NULL
);
ISC_LINK_INIT(dns_name, link);

View file

@ -13,7 +13,7 @@
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.3 2007/09/07 06:53:03 marka Exp $
# $Id: Makefile.in,v 1.4 2009/09/01 00:22:26 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -27,8 +27,8 @@ DLZINCLUDES = @DLZ_DRIVER_INCLUDES@
CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include \
${ISC_INCLUDES} ${DLZINCLUDES}
CDEFINES = @USE_DLZ@
CDEFINES = -DBIND9 @USE_DLZ@
CWARNINGS =
DLZLIBS = @DLZ_DRIVER_LIBS@

View file

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone2bdb.c,v 1.2 2008/09/24 02:46:21 marka Exp $ */
/* $Id: zone2bdb.c,v 1.3 2009/09/01 00:22:26 jinmei Exp $ */
#include <stdio.h>
@ -137,7 +137,7 @@ main(int argc, char *argv[])
dns_fixedname_init(&origin);
REQUIRE(dns_name_fromtext(dns_fixedname_name(&origin), &b, dns_rootname,
ISC_FALSE, NULL) == ISC_R_SUCCESS);
0, NULL) == ISC_R_SUCCESS);
REQUIRE(dns_db_create(mctx, "rbt", dns_fixedname_name(&origin),
dns_dbtype_zone, dns_rdataclass_in, 0, NULL,
&db) == ISC_R_SUCCESS);

View file

@ -201,7 +201,7 @@ main (int *argc, char **argv)
isc_buffer_add (&buff, strlen (argzone));
dns_fixedname_init (&fixedzone);
zone = dns_fixedname_name (&fixedzone);
result = dns_name_fromtext (zone, &buff, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext (zone, &buff, dns_rootname, 0, NULL);
isc_result_check (result, "dns_name_fromtext");
result = dns_db_create (mctx, "rbt", zone, dns_dbtype_zone,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zonetodb.c,v 1.21 2008/11/27 06:14:22 marka Exp $ */
/* $Id: zonetodb.c,v 1.22 2009/09/01 00:22:26 jinmei Exp $ */
#include <stdlib.h>
#include <string.h>
@ -174,7 +174,7 @@ main(int argc, char **argv) {
isc_buffer_add(&b, strlen(porigin));
dns_fixedname_init(&forigin);
origin = dns_fixedname_name(&forigin);
result = dns_name_fromtext(origin, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(origin, &b, dns_rootname, 0, NULL);
check_result(result, "dns_name_fromtext");
db = NULL;

View file

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone2sqlite.c,v 1.2 2008/09/24 02:46:21 marka Exp $ */
/* $Id: zone2sqlite.c,v 1.3 2009/09/01 00:22:26 jinmei Exp $ */
#include <stdlib.h>
#include <string.h>
@ -181,7 +181,7 @@ main(int argc, char *argv[])
isc_buffer_add(&b, strlen(porigin));
dns_fixedname_init(&forigin);
origin = dns_fixedname_name(&forigin);
result = dns_name_fromtext(origin, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(origin, &b, dns_rootname, 0, NULL);
check_result(result, "dns_name_fromtext");
db = NULL;

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.11 2007/06/19 23:47:16 tbox Exp $
# $Id: Makefile.in,v 1.12 2009/09/01 00:22:26 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -28,7 +28,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = -I. ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
${ISCCFG_INCLUDES}
CDEFINES =
CDEFINES = -DBIND9
CWARNINGS =
ISCLIBS = ../../lib/isc/libisc.@A@

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: check.c,v 1.106 2009/08/23 11:44:44 fdupont Exp $ */
/* $Id: check.c,v 1.107 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -100,7 +100,7 @@ check_orderent(const cfg_obj_t *ent, isc_log_t *logctx) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"rrset-order: invalid name '%s'", str);
@ -199,7 +199,7 @@ check_dual_stack(const cfg_obj_t *options, isc_log_t *logctx) {
dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
tresult = dns_name_fromtext(name, &buffer, dns_rootname,
ISC_FALSE, NULL);
0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"bad name '%s'", str);
@ -262,7 +262,7 @@ disabled_algorithms(const cfg_obj_t *disabled, isc_log_t *logctx) {
str = cfg_obj_asstring(obj);
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
tresult = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"bad domain name '%s'", str);
@ -349,7 +349,7 @@ mustbesecure(const cfg_obj_t *secure, isc_symtab_t *symtab, isc_log_t *logctx,
str = cfg_obj_asstring(obj);
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"bad domain name '%s'", str);
@ -617,7 +617,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(name, &b,
dns_rootname,
ISC_FALSE, NULL);
0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"bad domain name '%s'",
@ -680,7 +680,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
isc_buffer_init(&b, dlv, strlen(dlv));
isc_buffer_add(&b, strlen(dlv));
tresult = dns_name_fromtext(name, &b, dns_rootname,
ISC_TRUE, NULL);
0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"bad domain name '%s'", dlv);
@ -715,7 +715,8 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
isc_buffer_add(&b, strlen(dlv));
tresult = dns_name_fromtext(name, &b,
dns_rootname,
ISC_TRUE, NULL);
DNS_NAME_DOWNCASE,
NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"bad domain name '%s'",
@ -771,7 +772,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"empty-server: invalid name '%s'", str);
@ -786,7 +787,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"empty-contact: invalid name '%s'", str);
@ -805,7 +806,7 @@ check_options(const cfg_obj_t *options, isc_log_t *logctx, isc_mem_t *mctx) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(obj, logctx, ISC_LOG_ERROR,
"disable-empty-zone: invalid name '%s'",
@ -990,7 +991,7 @@ check_update_policy(const cfg_obj_t *policy, isc_log_t *logctx) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(dns_fixedname_name(&fixed), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(identity, logctx, ISC_LOG_ERROR,
"'%s' is not a valid name", str);
@ -1004,8 +1005,7 @@ check_update_policy(const cfg_obj_t *policy, isc_log_t *logctx) {
isc_buffer_init(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str));
tresult = dns_name_fromtext(dns_fixedname_name(&fixed),
&b, dns_rootname,
ISC_FALSE, NULL);
&b, dns_rootname, 0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(dname, logctx, ISC_LOG_ERROR,
"'%s' is not a valid name", str);
@ -1198,7 +1198,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
isc_buffer_init(&b, zname, strlen(zname));
isc_buffer_add(&b, strlen(zname));
tresult = dns_name_fromtext(dns_fixedname_name(&fixedname), &b,
dns_rootname, ISC_TRUE, NULL);
dns_rootname, DNS_NAME_DOWNCASE, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(zconfig, logctx, ISC_LOG_ERROR,
"zone '%s': is not a valid name", zname);
@ -1511,7 +1511,7 @@ check_keylist(const cfg_obj_t *keys, isc_symtab_t *symtab,
isc_buffer_init(&b, keyid, strlen(keyid));
isc_buffer_add(&b, strlen(keyid));
tresult = dns_name_fromtext(name, &b, dns_rootname,
ISC_FALSE, NULL);
0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(key, logctx, ISC_LOG_ERROR,
"key '%s': bad key name", keyid);
@ -1681,7 +1681,7 @@ check_servers(const cfg_obj_t *config, const cfg_obj_t *voptions,
isc_buffer_add(&b, strlen(keyval));
keyname = dns_fixedname_name(&fname);
tresult = dns_name_fromtext(keyname, &b, dns_rootname,
ISC_FALSE, NULL);
0, NULL);
if (tresult != ISC_R_SUCCESS) {
cfg_obj_log(keys, logctx, ISC_LOG_ERROR,
"bad key name '%s'", keyval);

View file

@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: Makefile.in,v 1.165 2009/07/01 23:47:36 tbox Exp $
# $Id: Makefile.in,v 1.166 2009/09/01 00:22:26 jinmei Exp $
srcdir = @srcdir@
VPATH = @srcdir@
@ -34,7 +34,7 @@ USE_ISC_SPNEGO = @USE_ISC_SPNEGO@
CINCLUDES = -I. -Iinclude ${DNS_INCLUDES} \
${ISC_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
CDEFINES = -DUSE_MD5 @USE_OPENSSL@ @USE_PKCS11@ @USE_GSSAPI@ \
CDEFINES = -DBIND9 -DUSE_MD5 @USE_OPENSSL@ @USE_PKCS11@ @USE_GSSAPI@ \
${USE_ISC_SPNEGO}
CWARNINGS =
@ -68,7 +68,7 @@ DNSOBJS = acache.@O@ acl.@O@ adb.@O@ byaddr.@O@ \
resolver.@O@ result.@O@ rootns.@O@ rriterator.@O@ sdb.@O@ \
sdlz.@O@ soa.@O@ ssu.@O@ \
stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \
tsig.@O@ ttl.@O@ validator.@O@ \
tsec.@O@ tsig.@O@ ttl.@O@ validator.@O@ \
version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ zt.@O@
OBJS= ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS}
@ -94,7 +94,7 @@ DNSSRCS = acache.c acl.c adb.c byaddr.c \
resolver.c result.c rootns.c rriterator.c sdb.c sdlz.c \
soa.c ssu.c \
stats.c tcpmsg.c time.c timer.c tkey.c \
tsig.c ttl.c validator.c \
tsec.c tsig.c ttl.c validator.c \
version.c view.c xfrin.c zone.c zonekey.c zt.c ${OTHERSRCS}
SRCS = ${DSTSRCS} ${DNSSRCS}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: byaddr.c,v 1.39 2007/06/19 23:47:16 tbox Exp $ */
/* $Id: byaddr.c,v 1.40 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -43,25 +43,6 @@
* XXXRTH We could use a static event...
*/
struct dns_byaddr {
/* Unlocked. */
unsigned int magic;
isc_mem_t * mctx;
isc_mutex_t lock;
dns_fixedname_t name;
/* Locked by lock. */
unsigned int options;
dns_lookup_t * lookup;
isc_task_t * task;
dns_byaddrevent_t * event;
isc_boolean_t canceled;
};
#define BYADDR_MAGIC ISC_MAGIC('B', 'y', 'A', 'd')
#define VALID_BYADDR(b) ISC_MAGIC_VALID(b, BYADDR_MAGIC)
#define MAX_RESTARTS 16
static char hex_digits[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
@ -125,10 +106,29 @@ dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
len = (unsigned int)strlen(textname);
isc_buffer_init(&buffer, textname, len);
isc_buffer_add(&buffer, len);
return (dns_name_fromtext(name, &buffer, dns_rootname,
ISC_FALSE, NULL));
return (dns_name_fromtext(name, &buffer, dns_rootname, 0, NULL));
}
#ifdef BIND9
struct dns_byaddr {
/* Unlocked. */
unsigned int magic;
isc_mem_t * mctx;
isc_mutex_t lock;
dns_fixedname_t name;
/* Locked by lock. */
unsigned int options;
dns_lookup_t * lookup;
isc_task_t * task;
dns_byaddrevent_t * event;
isc_boolean_t canceled;
};
#define BYADDR_MAGIC ISC_MAGIC('B', 'y', 'A', 'd')
#define VALID_BYADDR(b) ISC_MAGIC_VALID(b, BYADDR_MAGIC)
#define MAX_RESTARTS 16
static inline isc_result_t
copy_ptr_targets(dns_byaddr_t *byaddr, dns_rdataset_t *rdataset) {
isc_result_t result;
@ -314,3 +314,4 @@ dns_byaddr_destroy(dns_byaddr_t **byaddrp) {
*byaddrp = NULL;
}
#endif /* BIND9 */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cache.c,v 1.84 2009/05/06 22:53:54 jinmei Exp $ */
/* $Id: cache.c,v 1.85 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -450,6 +450,7 @@ dns_cache_setfilename(dns_cache_t *cache, const char *filename) {
return (ISC_R_SUCCESS);
}
#ifdef BIND9
isc_result_t
dns_cache_load(dns_cache_t *cache) {
isc_result_t result;
@ -465,6 +466,7 @@ dns_cache_load(dns_cache_t *cache) {
return (result);
}
#endif /* BIND9 */
isc_result_t
dns_cache_dump(dns_cache_t *cache) {
@ -475,10 +477,14 @@ dns_cache_dump(dns_cache_t *cache) {
if (cache->filename == NULL)
return (ISC_R_SUCCESS);
#ifdef BIND9
LOCK(&cache->filelock);
result = dns_master_dump(cache->mctx, cache->db, NULL,
&dns_master_style_cache, cache->filename);
UNLOCK(&cache->filelock);
#else
return (ISC_R_NOTIMPLEMENTED);
#endif
return (result);
}

2994
lib/dns/client.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db.c,v 1.93 2009/07/19 23:47:55 tbox Exp $ */
/* $Id: db.c,v 1.94 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -63,14 +63,18 @@ struct dns_dbimplementation {
*/
#include "rbtdb.h"
#ifdef BIND9
#include "rbtdb64.h"
#endif
static ISC_LIST(dns_dbimplementation_t) implementations;
static isc_rwlock_t implock;
static isc_once_t once = ISC_ONCE_INIT;
static dns_dbimplementation_t rbtimp;
#ifdef BIND9
static dns_dbimplementation_t rbt64imp;
#endif
static void
initialize(void) {
@ -82,15 +86,19 @@ initialize(void) {
rbtimp.driverarg = NULL;
ISC_LINK_INIT(&rbtimp, link);
#ifdef BIND9
rbt64imp.name = "rbt64";
rbt64imp.create = dns_rbtdb64_create;
rbt64imp.mctx = NULL;
rbt64imp.driverarg = NULL;
ISC_LINK_INIT(&rbt64imp, link);
#endif
ISC_LIST_INIT(implementations);
ISC_LIST_APPEND(implementations, &rbtimp, link);
#ifdef BIND9
ISC_LIST_APPEND(implementations, &rbt64imp, link);
#endif
}
static inline dns_dbimplementation_t *
@ -292,6 +300,7 @@ dns_db_class(dns_db_t *db) {
return (db->rdclass);
}
#ifdef BIND9
isc_result_t
dns_db_beginload(dns_db_t *db, dns_addrdatasetfunc_t *addp,
dns_dbload_t **dbloadp) {
@ -383,6 +392,7 @@ dns_db_dump2(dns_db_t *db, dns_dbversion_t *version, const char *filename,
return ((db->methods->dump)(db, version, filename, masterformat));
}
#endif /* BIND9 */
/***
*** Version Methods

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dispatch.c,v 1.163 2009/04/28 21:39:00 jinmei Exp $ */
/* $Id: dispatch.c,v 1.164 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -417,7 +417,7 @@ request_log(dns_dispatch_t *disp, dns_dispentry_t *resp,
/*%
* ARC4 random number generator derived from OpenBSD.
* Only dispatch_arc4random() and dispatch_arc4uniformrandom() are expected
* Only dispatch_random() and dispatch_uniformrandom() are expected
* to be called from general dispatch routines; the rest of them are subroutines
* for these two.
*
@ -437,8 +437,11 @@ request_log(dns_dispatch_t *disp, dns_dispentry_t *resp,
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef BIND9
static void
dispatch_arc4init(arc4ctx_t *actx, isc_entropy_t *entropy, isc_mutex_t *lock) {
dispatch_initrandom(arc4ctx_t *actx, isc_entropy_t *entropy,
isc_mutex_t *lock)
{
int n;
for (n = 0; n < 256; n++)
actx->s[n] = n;
@ -527,7 +530,7 @@ dispatch_arc4stir(arc4ctx_t *actx) {
}
static isc_uint16_t
dispatch_arc4random(arc4ctx_t *actx) {
dispatch_random(arc4ctx_t *actx) {
isc_uint16_t result;
if (actx->lock != NULL)
@ -543,9 +546,38 @@ dispatch_arc4random(arc4ctx_t *actx) {
return (result);
}
#else
/*
* For general purpose library, we don't have to be too strict about the
* quality of random values. Performance doesn't matter much, either.
* So we simply use the isc_random module to keep the library as small as
* possible.
*/
static void
dispatch_initrandom(arc4ctx_t *actx, isc_entropy_t *entropy,
isc_mutex_t *lock)
{
UNUSED(actx);
UNUSED(entropy);
UNUSED(lock);
return;
}
static isc_uint16_t
dispatch_arc4uniformrandom(arc4ctx_t *actx, isc_uint16_t upper_bound) {
dispatch_random(arc4ctx_t *actx) {
isc_uint32_t r;
UNUSED(actx);
isc_random_get(&r);
return (r & 0xffff);
}
#endif /* BIND9 */
static isc_uint16_t
dispatch_uniformrandom(arc4ctx_t *actx, isc_uint16_t upper_bound) {
isc_uint16_t min, r;
if (upper_bound < 2)
@ -568,7 +600,7 @@ dispatch_arc4uniformrandom(arc4ctx_t *actx, isc_uint16_t upper_bound) {
* to re-roll.
*/
for (;;) {
r = dispatch_arc4random(actx);
r = dispatch_random(actx);
if (r >= min)
break;
}
@ -851,7 +883,7 @@ get_dispsocket(dns_dispatch_t *disp, isc_sockaddr_t *dest,
*/
localaddr = disp->local;
for (i = 0; i < 64; i++) {
port = ports[dispatch_arc4uniformrandom(DISP_ARC4CTX(disp),
port = ports[dispatch_uniformrandom(DISP_ARC4CTX(disp),
nports)];
isc_sockaddr_setport(&localaddr, port);
@ -956,6 +988,7 @@ deactivate_dispsocket(dns_dispatch_t *disp, dispsocket_t *dispsock) {
INSIST(dispsock->portentry != NULL);
deref_portentry(disp, &dispsock->portentry);
#ifdef BIND9
if (disp->nsockets > DNS_DISPATCH_POOLSOCKS)
destroy_dispsocket(disp, &dispsock);
else {
@ -979,6 +1012,13 @@ deactivate_dispsocket(dns_dispatch_t *disp, dispsocket_t *dispsock) {
destroy_dispsocket(disp, &dispsock);
}
}
#else
/* This kind of optimization isn't necessary for normal use */
UNUSED(qid);
UNUSED(result);
destroy_dispsocket(disp, &dispsock);
#endif
}
/*
@ -1704,8 +1744,10 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) {
DESTROYLOCK(&mgr->pool_lock);
#ifdef BIND9
if (mgr->entropy != NULL)
isc_entropy_detach(&mgr->entropy);
#endif /* BIND9 */
if (mgr->qid != NULL)
qid_destroy(mctx, &mgr->qid);
@ -1744,9 +1786,13 @@ open_socket(isc_socketmgr_t *mgr, isc_sockaddr_t *local,
return (result);
isc_socket_setname(sock, "dispatcher", NULL);
} else {
#ifdef BIND9
result = isc_socket_open(sock);
if (result != ISC_R_SUCCESS)
return (result);
#else
INSIST(0);
#endif
}
#ifndef ISC_ALLOW_MAPPED
@ -1756,8 +1802,13 @@ open_socket(isc_socketmgr_t *mgr, isc_sockaddr_t *local,
if (result != ISC_R_SUCCESS) {
if (*sockp == NULL)
isc_socket_detach(&sock);
else
else {
#ifdef BIND9
isc_socket_close(sock);
#else
INSIST(0);
#endif
}
return (result);
}
@ -1889,10 +1940,14 @@ dns_dispatchmgr_create(isc_mem_t *mctx, isc_entropy_t *entropy,
if (result != ISC_R_SUCCESS)
goto kill_dpool;
#ifdef BIND9
if (entropy != NULL)
isc_entropy_attach(entropy, &mgr->entropy);
#else
UNUSED(entropy);
#endif
dispatch_arc4init(&mgr->arc4ctx, mgr->entropy, &mgr->arc4_lock);
dispatch_initrandom(&mgr->arc4ctx, mgr->entropy, &mgr->arc4_lock);
*mgrp = mgr;
return (ISC_R_SUCCESS);
@ -2393,7 +2448,7 @@ dispatch_allocate(dns_dispatchmgr_t *mgr, unsigned int maxrequests,
ISC_LIST_INIT(disp->activesockets);
ISC_LIST_INIT(disp->inactivesockets);
disp->nsockets = 0;
dispatch_arc4init(&disp->arc4ctx, mgr->entropy, NULL);
dispatch_initrandom(&disp->arc4ctx, mgr->entropy, NULL);
disp->port_table = NULL;
disp->portpool = NULL;
@ -2690,7 +2745,7 @@ get_udpsocket(dns_dispatchmgr_t *mgr, dns_dispatch_t *disp,
for (i = 0; i < 1024; i++) {
in_port_t prt;
prt = ports[dispatch_arc4uniformrandom(
prt = ports[dispatch_uniformrandom(
DISP_ARC4CTX(disp),
nports)];
isc_sockaddr_setport(&localaddr_bound, prt);
@ -2826,8 +2881,10 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
disp->task[i] = NULL;
result = isc_task_create(taskmgr, 0, &disp->task[i]);
if (result != ISC_R_SUCCESS) {
while (--i >= 0)
isc_task_destroy(&disp->task[i]);
while (--i >= 0) {
isc_task_shutdown(disp->task[i]);
isc_task_detach(&disp->task[i]);
}
goto kill_socket;
}
isc_task_setname(disp->task[i], "udpdispatch", disp);
@ -3027,7 +3084,7 @@ dns_dispatch_addresponse2(dns_dispatch_t *disp, isc_sockaddr_t *dest,
/*
* Try somewhat hard to find an unique ID.
*/
id = (dns_messageid_t)dispatch_arc4random(DISP_ARC4CTX(disp));
id = (dns_messageid_t)dispatch_random(DISP_ARC4CTX(disp));
bucket = dns_hash(qid, dest, id, localport);
ok = ISC_FALSE;
for (i = 0; i < 64; i++) {

View file

@ -31,7 +31,7 @@
/*
* Principal Author: Brian Wellington
* $Id: dst_api.c,v 1.26 2009/08/14 06:28:40 each Exp $
* $Id: dst_api.c,v 1.27 2009/09/01 00:22:26 jinmei Exp $
*/
/*! \file */
@ -69,7 +69,9 @@
#define DST_AS_STR(t) ((t).value.as_textregion.base)
static dst_func_t *dst_t_func[DST_MAX_ALGS];
#ifdef BIND9
static isc_entropy_t *dst_entropy_pool = NULL;
#endif
static unsigned int dst_entropy_flags = 0;
static isc_boolean_t dst_initialized = ISC_FALSE;
@ -126,7 +128,7 @@ static isc_result_t addsuffix(char *filename, unsigned int len,
return (_r); \
} while (0); \
#ifdef OPENSSL
#if defined(OPENSSL) && defined(BIND9)
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
@ -146,12 +148,17 @@ isc_result_t
dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags) {
isc_result_t result;
REQUIRE(mctx != NULL && ectx != NULL);
REQUIRE(mctx != NULL);
#ifdef BIND9
REQUIRE(ectx != NULL);
#else
UNUSED(ectx);
#endif
REQUIRE(dst_initialized == ISC_FALSE);
dst__memory_pool = NULL;
#ifdef OPENSSL
#if defined(OPENSSL) && defined(BIND9)
UNUSED(mctx);
/*
* When using --with-openssl, there seems to be no good way of not
@ -170,7 +177,9 @@ dst_lib_init(isc_mem_t *mctx, isc_entropy_t *ectx, unsigned int eflags) {
#else
isc_mem_attach(mctx, &dst__memory_pool);
#endif
#ifdef BIND9
isc_entropy_attach(ectx, &dst_entropy_pool);
#endif
dst_entropy_flags = eflags;
dst_result_register();
@ -218,9 +227,10 @@ dst_lib_destroy(void) {
#endif
if (dst__memory_pool != NULL)
isc_mem_detach(&dst__memory_pool);
#ifdef BIND9
if (dst_entropy_pool != NULL)
isc_entropy_detach(&dst_entropy_pool);
#endif
}
isc_boolean_t
@ -1045,7 +1055,7 @@ dst_key_read_public(const char *filename, int type,
isc_buffer_init(&b, DST_AS_STR(token), strlen(DST_AS_STR(token)));
isc_buffer_add(&b, strlen(DST_AS_STR(token)));
ret = dns_name_fromtext(dns_fixedname_name(&name), &b, dns_rootname,
ISC_FALSE, NULL);
0, NULL);
if (ret != ISC_R_SUCCESS)
goto cleanup;
@ -1397,13 +1407,25 @@ addsuffix(char *filename, unsigned int len, const char *odirname,
isc_result_t
dst__entropy_getdata(void *buf, unsigned int len, isc_boolean_t pseudo) {
#ifdef BIND9
unsigned int flags = dst_entropy_flags;
if (pseudo)
flags &= ~ISC_ENTROPY_GOODONLY;
return (isc_entropy_getdata(dst_entropy_pool, buf, len, NULL, flags));
#else
UNUSED(buf);
UNUSED(len);
UNUSED(pseudo);
return (ISC_R_NOTIMPLEMENTED);
#endif
}
unsigned int
dst__entropy_status(void) {
#ifdef BIND9
return (isc_entropy_status(dst_entropy_pool));
#else
return (0);
#endif
}

797
lib/dns/ecdb.c Normal file
View file

@ -0,0 +1,797 @@
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and 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.
*/
/* $Id: ecdb.c,v 1.2 2009/09/01 00:22:26 jinmei Exp $ */
#include "config.h"
#include <isc/result.h>
#include <isc/util.h>
#include <isc/mutex.h>
#include <isc/mem.h>
#include <dns/db.h>
#include <dns/ecdb.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdataslab.h>
#define ECDB_MAGIC ISC_MAGIC('E', 'C', 'D', 'B')
#define VALID_ECDB(db) ((db) != NULL && \
(db)->common.impmagic == ECDB_MAGIC)
#define ECDBNODE_MAGIC ISC_MAGIC('E', 'C', 'D', 'N')
#define VALID_ECDBNODE(ecdbn) ISC_MAGIC_VALID(ecdbn, ECDBNODE_MAGIC)
#if DNS_RDATASET_FIXED
#error "Fixed rdataset isn't supported in this implementation"
#endif
/*%
* The 'ephemeral' cache DB (ecdb) implementation. An ecdb just provides
* temporary storage for ongoing name resolution with the common DB interfaces.
* It actually doesn't cache anything. The implementation expects any stored
* data is released within a short period, and does not care about the
* scalability in terms of the number of nodes.
*/
typedef struct dns_ecdb {
/* Unlocked */
dns_db_t common;
isc_mutex_t lock;
/* Locked */
unsigned int references;
ISC_LIST(struct dns_ecdbnode) nodes;
} dns_ecdb_t;
typedef struct dns_ecdbnode {
/* Unlocked */
unsigned int magic;
isc_mutex_t lock;
dns_ecdb_t *ecdb;
dns_name_t name;
ISC_LINK(struct dns_ecdbnode) link;
/* Locked */
ISC_LIST(struct rdatasetheader) rdatasets;
unsigned int references;
} dns_ecdbnode_t;
typedef struct rdatasetheader {
dns_rdatatype_t type;
dns_ttl_t ttl;
dns_trust_t trust;
dns_rdatatype_t covers;
unsigned int attributes;
ISC_LINK(struct rdatasetheader) link;
} rdatasetheader_t;
/* Copied from rbtdb.c */
#define RDATASET_ATTR_NXDOMAIN 0x0010
#define NXDOMAIN(header) \
(((header)->attributes & RDATASET_ATTR_NXDOMAIN) != 0)
static isc_result_t dns_ecdb_create(isc_mem_t *mctx, dns_name_t *origin,
dns_dbtype_t type,
dns_rdataclass_t rdclass,
unsigned int argc, char *argv[],
void *driverarg, dns_db_t **dbp);
static void rdataset_disassociate(dns_rdataset_t *rdataset);
static isc_result_t rdataset_first(dns_rdataset_t *rdataset);
static isc_result_t rdataset_next(dns_rdataset_t *rdataset);
static void rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata);
static void rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target);
static unsigned int rdataset_count(dns_rdataset_t *rdataset);
static dns_rdatasetmethods_t rdataset_methods = {
rdataset_disassociate,
rdataset_first,
rdataset_next,
rdataset_current,
rdataset_clone,
rdataset_count,
NULL, /* addnoqname */
NULL, /* getnoqname */
NULL, /* addclosest */
NULL, /* getclosest */
NULL, /* getadditional */
NULL, /* setadditional */
NULL /* putadditional */
};
typedef struct ecdb_rdatasetiter {
dns_rdatasetiter_t common;
rdatasetheader_t *current;
} ecdb_rdatasetiter_t;
static void rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp);
static isc_result_t rdatasetiter_first(dns_rdatasetiter_t *iterator);
static isc_result_t rdatasetiter_next(dns_rdatasetiter_t *iterator);
static void rdatasetiter_current(dns_rdatasetiter_t *iterator,
dns_rdataset_t *rdataset);
static dns_rdatasetitermethods_t rdatasetiter_methods = {
rdatasetiter_destroy,
rdatasetiter_first,
rdatasetiter_next,
rdatasetiter_current
};
isc_result_t
dns_ecdb_register(isc_mem_t *mctx, dns_dbimplementation_t **dbimp) {
REQUIRE(mctx != NULL);
REQUIRE(dbimp != NULL && *dbimp == NULL);
return (dns_db_register("ecdb", dns_ecdb_create, NULL, mctx, dbimp));
}
void
dns_ecdb_unregister(dns_dbimplementation_t **dbimp) {
REQUIRE(dbimp != NULL && *dbimp != NULL);
dns_db_unregister(dbimp);
}
/*%
* DB routines
*/
static void
attach(dns_db_t *source, dns_db_t **targetp) {
dns_ecdb_t *ecdb = (dns_ecdb_t *)source;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(targetp != NULL && *targetp == NULL);
LOCK(&ecdb->lock);
ecdb->references++;
UNLOCK(&ecdb->lock);
*targetp = source;
}
static void
destroy_ecdb(dns_ecdb_t **ecdbp) {
dns_ecdb_t *ecdb = *ecdbp;
isc_mem_t *mctx = ecdb->common.mctx;
if (dns_name_dynamic(&ecdb->common.origin))
dns_name_free(&ecdb->common.origin, mctx);
DESTROYLOCK(&ecdb->lock);
ecdb->common.impmagic = 0;
ecdb->common.magic = 0;
isc_mem_putanddetach(&mctx, ecdb, sizeof(*ecdb));
*ecdbp = NULL;
}
static void
detach(dns_db_t **dbp) {
dns_ecdb_t *ecdb;
isc_boolean_t need_destroy = ISC_FALSE;
REQUIRE(dbp != NULL);
ecdb = (dns_ecdb_t *)*dbp;
REQUIRE(VALID_ECDB(ecdb));
LOCK(&ecdb->lock);
ecdb->references--;
if (ecdb->references == 0 && ISC_LIST_EMPTY(ecdb->nodes))
need_destroy = ISC_TRUE;
UNLOCK(&ecdb->lock);
if (need_destroy)
destroy_ecdb(&ecdb);
*dbp = NULL;
}
static void
attachnode(dns_db_t *db, dns_dbnode_t *source, dns_dbnode_t **targetp) {
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
dns_ecdbnode_t *node = (dns_ecdbnode_t *)source;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(VALID_ECDBNODE(node));
REQUIRE(targetp != NULL && *targetp == NULL);
LOCK(&node->lock);
INSIST(node->references > 0);
node->references++;
INSIST(node->references != 0); /* Catch overflow. */
UNLOCK(&node->lock);
*targetp = node;
}
static void
destroynode(dns_ecdbnode_t *node) {
isc_mem_t *mctx;
dns_ecdb_t *ecdb = node->ecdb;
isc_boolean_t need_destroydb = ISC_FALSE;
rdatasetheader_t *header;
mctx = ecdb->common.mctx;
LOCK(&ecdb->lock);
ISC_LIST_UNLINK(ecdb->nodes, node, link);
if (ecdb->references == 0 && ISC_LIST_EMPTY(ecdb->nodes))
need_destroydb = ISC_TRUE;
UNLOCK(&ecdb->lock);
dns_name_free(&node->name, mctx);
while ((header = ISC_LIST_HEAD(node->rdatasets)) != NULL) {
unsigned int headersize;
ISC_LIST_UNLINK(node->rdatasets, header, link);
headersize =
dns_rdataslab_size((unsigned char *)header,
sizeof(*header));
isc_mem_put(mctx, header, headersize);
}
DESTROYLOCK(&node->lock);
node->magic = 0;
isc_mem_put(mctx, node, sizeof(*node));
if (need_destroydb)
destroy_ecdb(&ecdb);
}
static void
detachnode(dns_db_t *db, dns_dbnode_t **nodep) {
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
dns_ecdbnode_t *node;
isc_boolean_t need_destroy = ISC_FALSE;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(nodep != NULL);
node = (dns_ecdbnode_t *)*nodep;
REQUIRE(VALID_ECDBNODE(node));
UNUSED(ecdb); /* in case REQUIRE() is empty */
LOCK(&node->lock);
INSIST(node->references > 0);
node->references--;
if (node->references == 0)
need_destroy = ISC_TRUE;
UNLOCK(&node->lock);
if (need_destroy)
destroynode(node);
*nodep = NULL;
}
static isc_result_t
find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
dns_rdatatype_t type, unsigned int options, isc_stdtime_t now,
dns_dbnode_t **nodep, dns_name_t *foundname, dns_rdataset_t *rdataset,
dns_rdataset_t *sigrdataset)
{
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
REQUIRE(VALID_ECDB(ecdb));
UNUSED(name);
UNUSED(version);
UNUSED(type);
UNUSED(options);
UNUSED(now);
UNUSED(nodep);
UNUSED(foundname);
UNUSED(rdataset);
UNUSED(sigrdataset);
return (ISC_R_NOTFOUND);
}
static isc_result_t
findzonecut(dns_db_t *db, dns_name_t *name,
unsigned int options, isc_stdtime_t now,
dns_dbnode_t **nodep, dns_name_t *foundname,
dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset)
{
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
REQUIRE(VALID_ECDB(ecdb));
UNUSED(name);
UNUSED(options);
UNUSED(now);
UNUSED(nodep);
UNUSED(foundname);
UNUSED(rdataset);
UNUSED(sigrdataset);
return (ISC_R_NOTFOUND);
}
static isc_result_t
findnode(dns_db_t *db, dns_name_t *name, isc_boolean_t create,
dns_dbnode_t **nodep)
{
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
isc_mem_t *mctx;
dns_ecdbnode_t *node;
isc_result_t result;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(nodep != NULL && *nodep == NULL);
UNUSED(name);
if (create != ISC_TRUE) {
/* an 'ephemeral' node is never reused. */
return (ISC_R_NOTFOUND);
}
mctx = ecdb->common.mctx;
node = isc_mem_get(mctx, sizeof(*node));
if (node == NULL)
return (ISC_R_NOMEMORY);
result = isc_mutex_init(&node->lock);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_mutex_init() failed: %s",
isc_result_totext(result));
isc_mem_put(mctx, node, sizeof(*node));
return (ISC_R_UNEXPECTED);
}
dns_name_init(&node->name, NULL);
result = dns_name_dup(name, mctx, &node->name);
if (result != ISC_R_SUCCESS) {
DESTROYLOCK(&node->lock);
isc_mem_put(mctx, node, sizeof(*node));
return (result);
}
node->ecdb= ecdb;
node->references = 1;
ISC_LIST_INIT(node->rdatasets);
ISC_LINK_INIT(node, link);
LOCK(&ecdb->lock);
ISC_LIST_APPEND(ecdb->nodes, node, link);
UNLOCK(&ecdb->lock);
node->magic = ECDBNODE_MAGIC;
*nodep = node;
return (ISC_R_SUCCESS);
}
static void
bind_rdataset(dns_ecdb_t *ecdb, dns_ecdbnode_t *node,
rdatasetheader_t *header, dns_rdataset_t *rdataset)
{
unsigned char *raw;
/*
* Caller must be holding the node lock.
*/
REQUIRE(!dns_rdataset_isassociated(rdataset));
rdataset->methods = &rdataset_methods;
rdataset->rdclass = ecdb->common.rdclass;
rdataset->type = header->type;
rdataset->covers = header->covers;
rdataset->ttl = header->ttl;
rdataset->trust = header->trust;
if (NXDOMAIN(header))
rdataset->attributes |= DNS_RDATASETATTR_NXDOMAIN;
rdataset->private1 = ecdb;
rdataset->private2 = node;
raw = (unsigned char *)header + sizeof(*header);
rdataset->private3 = raw;
rdataset->count = 0;
/*
* Reset iterator state.
*/
rdataset->privateuint4 = 0;
rdataset->private5 = NULL;
INSIST(node->references > 0);
node->references++;
}
static isc_result_t
addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options,
dns_rdataset_t *addedrdataset)
{
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
isc_region_t r;
isc_result_t result = ISC_R_SUCCESS;
isc_mem_t *mctx;
dns_ecdbnode_t *ecdbnode = (dns_ecdbnode_t *)node;
rdatasetheader_t *header;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(VALID_ECDBNODE(ecdbnode));
UNUSED(version);
UNUSED(now);
UNUSED(options);
mctx = ecdb->common.mctx;
LOCK(&ecdbnode->lock);
/*
* Sanity check: this implementation does not allow overriding an
* existing rdataset of the same type.
*/
for (header = ISC_LIST_HEAD(ecdbnode->rdatasets); header != NULL;
header = ISC_LIST_NEXT(header, link)) {
INSIST(header->type != rdataset->type ||
header->covers != rdataset->covers);
}
result = dns_rdataslab_fromrdataset(rdataset, mctx,
&r, sizeof(rdatasetheader_t));
if (result != ISC_R_SUCCESS)
goto unlock;
header = (rdatasetheader_t *)r.base;
header->type = rdataset->type;
header->ttl = rdataset->ttl;
header->trust = rdataset->trust;
header->covers = rdataset->covers;
header->attributes = 0;
if ((rdataset->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0)
header->attributes |= RDATASET_ATTR_NXDOMAIN;
ISC_LINK_INIT(header, link);
ISC_LIST_APPEND(ecdbnode->rdatasets, header, link);
if (addedrdataset == NULL)
goto unlock;
bind_rdataset(ecdb, ecdbnode, header, addedrdataset);
unlock:
UNLOCK(&ecdbnode->lock);
return (result);
}
static isc_result_t
deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
dns_rdatatype_t type, dns_rdatatype_t covers)
{
UNUSED(db);
UNUSED(node);
UNUSED(version);
UNUSED(type);
UNUSED(covers);
return (ISC_R_NOTIMPLEMENTED);
}
static isc_result_t
createiterator(dns_db_t *db, isc_boolean_t relative_names,
dns_dbiterator_t **iteratorp)
{
UNUSED(db);
UNUSED(relative_names);
UNUSED(iteratorp);
return (ISC_R_NOTIMPLEMENTED);
}
static isc_result_t
allrdatasets(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
isc_stdtime_t now, dns_rdatasetiter_t **iteratorp)
{
dns_ecdb_t *ecdb = (dns_ecdb_t *)db;
dns_ecdbnode_t *ecdbnode = (dns_ecdbnode_t *)node;
isc_mem_t *mctx;
ecdb_rdatasetiter_t *iterator;
REQUIRE(VALID_ECDB(ecdb));
REQUIRE(VALID_ECDBNODE(ecdbnode));
mctx = ecdb->common.mctx;
iterator = isc_mem_get(mctx, sizeof(ecdb_rdatasetiter_t));
if (iterator == NULL)
return (ISC_R_NOMEMORY);
iterator->common.magic = DNS_RDATASETITER_MAGIC;
iterator->common.methods = &rdatasetiter_methods;
iterator->common.db = db;
iterator->common.node = NULL;
attachnode(db, node, &iterator->common.node);
iterator->common.version = version;
iterator->common.now = now;
*iteratorp = (dns_rdatasetiter_t *)iterator;
return (ISC_R_SUCCESS);
}
static dns_dbmethods_t ecdb_methods = {
attach,
detach,
NULL, /* beginload */
NULL, /* endload */
NULL, /* dump */
NULL, /* currentversion */
NULL, /* newversion */
NULL, /* attachversion */
NULL, /* closeversion */
findnode,
find,
findzonecut,
attachnode,
detachnode,
NULL, /* expirenode */
NULL, /* printnode */
createiterator, /* createiterator */
NULL, /* findrdataset */
allrdatasets,
addrdataset,
NULL, /* subtractrdataset */
deleterdataset,
NULL, /* issecure */
NULL, /* nodecount */
NULL, /* ispersistent */
NULL, /* overmem */
NULL, /* settask */
NULL, /* getoriginnode */
NULL, /* transfernode */
NULL, /* getnsec3parameters */
NULL, /* findnsec3node */
NULL, /* setsigningtime */
NULL, /* getsigningtime */
NULL, /* resigned */
NULL, /* isdnssec */
NULL /* getrrsetstats */
};
static isc_result_t
dns_ecdb_create(isc_mem_t *mctx, dns_name_t *origin, dns_dbtype_t type,
dns_rdataclass_t rdclass, unsigned int argc, char *argv[],
void *driverarg, dns_db_t **dbp)
{
dns_ecdb_t *ecdb;
isc_result_t result;
REQUIRE(mctx != NULL);
REQUIRE(origin == dns_rootname);
REQUIRE(type == dns_dbtype_cache);
REQUIRE(dbp != NULL && *dbp == NULL);
UNUSED(argc);
UNUSED(argv);
UNUSED(driverarg);
ecdb = isc_mem_get(mctx, sizeof(*ecdb));
if (ecdb == NULL)
return (ISC_R_NOMEMORY);
ecdb->common.attributes = DNS_DBATTR_CACHE;
ecdb->common.rdclass = rdclass;
ecdb->common.methods = &ecdb_methods;
dns_name_init(&ecdb->common.origin, NULL);
result = dns_name_dupwithoffsets(origin, mctx, &ecdb->common.origin);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, ecdb, sizeof(*ecdb));
return (result);
}
result = isc_mutex_init(&ecdb->lock);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_mutex_init() failed: %s",
isc_result_totext(result));
if (dns_name_dynamic(&ecdb->common.origin))
dns_name_free(&ecdb->common.origin, mctx);
isc_mem_put(mctx, ecdb, sizeof(*ecdb));
return (ISC_R_UNEXPECTED);
}
ecdb->references = 1;
ISC_LIST_INIT(ecdb->nodes);
ecdb->common.mctx = NULL;
isc_mem_attach(mctx, &ecdb->common.mctx);
ecdb->common.impmagic = ECDB_MAGIC;
ecdb->common.magic = DNS_DB_MAGIC;
*dbp = (dns_db_t *)ecdb;
return (ISC_R_SUCCESS);
}
/*%
* Rdataset Methods
*/
static void
rdataset_disassociate(dns_rdataset_t *rdataset) {
dns_db_t *db = rdataset->private1;
dns_dbnode_t *node = rdataset->private2;
dns_db_detachnode(db, &node);
}
static isc_result_t
rdataset_first(dns_rdataset_t *rdataset) {
unsigned char *raw = rdataset->private3;
unsigned int count;
count = raw[0] * 256 + raw[1];
if (count == 0) {
rdataset->private5 = NULL;
return (ISC_R_NOMORE);
}
raw += 2;
/*
* The privateuint4 field is the number of rdata beyond the cursor
* position, so we decrement the total count by one before storing
* it.
*/
count--;
rdataset->privateuint4 = count;
rdataset->private5 = raw;
return (ISC_R_SUCCESS);
}
static isc_result_t
rdataset_next(dns_rdataset_t *rdataset) {
unsigned int count;
unsigned int length;
unsigned char *raw;
count = rdataset->privateuint4;
if (count == 0)
return (ISC_R_NOMORE);
count--;
rdataset->privateuint4 = count;
raw = rdataset->private5;
length = raw[0] * 256 + raw[1];
raw += length + 2;
rdataset->private5 = raw;
return (ISC_R_SUCCESS);
}
static void
rdataset_current(dns_rdataset_t *rdataset, dns_rdata_t *rdata) {
unsigned char *raw = rdataset->private5;
isc_region_t r;
unsigned int length;
unsigned int flags = 0;
REQUIRE(raw != NULL);
length = raw[0] * 256 + raw[1];
raw += 2;
if (rdataset->type == dns_rdatatype_rrsig) {
if (*raw & DNS_RDATASLAB_OFFLINE)
flags |= DNS_RDATA_OFFLINE;
length--;
raw++;
}
r.length = length;
r.base = raw;
dns_rdata_fromregion(rdata, rdataset->rdclass, rdataset->type, &r);
rdata->flags |= flags;
}
static void
rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
dns_db_t *db = source->private1;
dns_dbnode_t *node = source->private2;
dns_dbnode_t *cloned_node = NULL;
attachnode(db, node, &cloned_node);
*target = *source;
/*
* Reset iterator state.
*/
target->privateuint4 = 0;
target->private5 = NULL;
}
static unsigned int
rdataset_count(dns_rdataset_t *rdataset) {
unsigned char *raw = rdataset->private3;
unsigned int count;
count = raw[0] * 256 + raw[1];
return (count);
}
/*
* Rdataset Iterator Methods
*/
static void
rdatasetiter_destroy(dns_rdatasetiter_t **iteratorp) {
ecdb_rdatasetiter_t *ecdbiterator;
isc_mem_t *mctx;
REQUIRE(iteratorp != NULL);
ecdbiterator = (ecdb_rdatasetiter_t *)*iteratorp;
REQUIRE(DNS_RDATASETITER_VALID(&ecdbiterator->common));
mctx = ecdbiterator->common.db->mctx;
ecdbiterator->common.magic = 0;
dns_db_detachnode(ecdbiterator->common.db, &ecdbiterator->common.node);
isc_mem_put(mctx, ecdbiterator, sizeof(ecdb_rdatasetiter_t));
*iteratorp = NULL;
}
static isc_result_t
rdatasetiter_first(dns_rdatasetiter_t *iterator) {
ecdb_rdatasetiter_t *ecdbiterator = (ecdb_rdatasetiter_t *)iterator;
dns_ecdbnode_t *ecdbnode = (dns_ecdbnode_t *)iterator->node;
REQUIRE(DNS_RDATASETITER_VALID(iterator));
if (ISC_LIST_EMPTY(ecdbnode->rdatasets))
return (ISC_R_NOMORE);
ecdbiterator->current = ISC_LIST_HEAD(ecdbnode->rdatasets);
return (ISC_R_SUCCESS);
}
static isc_result_t
rdatasetiter_next(dns_rdatasetiter_t *iterator) {
ecdb_rdatasetiter_t *ecdbiterator = (ecdb_rdatasetiter_t *)iterator;
REQUIRE(DNS_RDATASETITER_VALID(iterator));
ecdbiterator->current = ISC_LIST_NEXT(ecdbiterator->current, link);
if (ecdbiterator->current == NULL)
return (ISC_R_NOMORE);
else
return (ISC_R_SUCCESS);
}
static void
rdatasetiter_current(dns_rdatasetiter_t *iterator, dns_rdataset_t *rdataset) {
ecdb_rdatasetiter_t *ecdbiterator = (ecdb_rdatasetiter_t *)iterator;
dns_ecdb_t *ecdb;
ecdb = (dns_ecdb_t *)iterator->db;
REQUIRE(VALID_ECDB(ecdb));
bind_rdataset(ecdb, iterator->node, ecdbiterator->current, rdataset);
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: forward.c,v 1.12 2007/06/19 23:47:16 tbox Exp $ */
/* $Id: forward.c,v 1.13 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -132,6 +132,22 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
return (result);
}
isc_result_t
dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name) {
isc_result_t result;
REQUIRE(VALID_FWDTABLE(fwdtable));
RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
if (result == DNS_R_PARTIALMATCH)
result = ISC_R_NOTFOUND;
return (result);
}
isc_result_t
dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
dns_forwarders_t **forwardersp)

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gssapictx.c,v 1.12 2008/04/03 06:09:04 tbox Exp $ */
/* $Id: gssapictx.c,v 1.13 2009/09/01 00:22:26 jinmei Exp $ */
#include <config.h>
@ -630,7 +630,7 @@ dst_gssapi_acceptctx(gss_cred_id_t cred,
isc_buffer_add(&namebuf, r.length);
RETERR(dns_name_fromtext(principal, &namebuf, dns_rootname,
ISC_FALSE, NULL));
0, NULL));
if (gnamebuf.length != 0) {
gret = gss_release_buffer(&minor, &gnamebuf);

View file

@ -0,0 +1,621 @@
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and 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.
*/
/* $Id: client.h,v 1.2 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_CLIENT_H
#define DNS_CLIENT_H 1
/*****
***** Module Info
*****/
/*! \file
*
* \brief
* The DNS client module provides convenient programming interfaces to various
* DNS services, such as name resolution with or without DNSSEC validation or
* dynamic DNS update. This module is primarily expected to be used by other
* applications than BIND9-related ones that need such advanced DNS features.
*
* MP:
*\li In the typical usage of this module, application threads will not share
* the same data structures created and manipulated in this module.
* However, the module still ensures appropriate synchronization of such
* data structures.
*
* Resources:
*\li TBS
*
* Security:
*\li This module does not handle any low-level data directly, and so no
* security issue specific to this module is anticipated.
*/
#include <isc/event.h>
#include <isc/sockaddr.h>
#include <dns/tsig.h>
#include <dns/types.h>
#include <dst/dst.h>
typedef enum {
updateop_none = 0,
updateop_add = 1,
updateop_delete = 2,
updateop_exist = 3,
updateop_notexist = 4,
updateop_max = 5
} dns_client_updateop_t;
ISC_LANG_BEGINDECLS
/***
*** Types
***/
/*%
* Optional flags for dns_client_create(x).
*/
/*%< Enable caching resolution results (experimental). */
#define DNS_CLIENTCREATEOPT_USECACHE 0x8000
/*%
* Optional flags for dns_client_(start)resolve.
*/
/*%< Disable DNSSEC validation. */
#define DNS_CLIENTRESOPT_NODNSSEC 0x01
/*%< Allow running external context. */
#define DNS_CLIENTRESOPT_ALLOWRUN 0x02
/*%
* Optional flags for dns_client_(start)request.
*/
/*%< Allow running external context. */
#define DNS_CLIENTREQOPT_ALLOWRUN 0x01
/*%
* A dns_clientresevent_t is sent when name resolution performed by a client
* completes. 'result' stores the result code of the entire resolution
* procedure. 'vresult' specifically stores the result code of DNSSEC
* validation if it is performed. When name resolution successfully completes,
* 'answerlist' is typically non empty, containing answer names along with
* RRsets. It is the receiver's responsibility to free this list by calling
* dns_client_freeresanswer() before freeing the event structure.
*/
typedef struct dns_clientresevent {
ISC_EVENT_COMMON(struct dns_clientresevent);
isc_result_t result;
isc_result_t vresult;
dns_namelist_t answerlist;
} dns_clientresevent_t; /* too long? */
/*%
* Status of a dynamic update procedure.
*/
typedef enum {
dns_clientupdatestate_prepare, /*%< no updates have been sent */
dns_clientupdatestate_sent, /*%< updates were sent, no response */
dns_clientupdatestate_done /*%< update was sent and succeeded */
} dns_clientupdatestate_t;
/*%
* A dns_clientreqevent_t is sent when a DNS request is completed by a client.
* 'result' stores the result code of the entire transaction.
* If the transaction is successfully completed but the response packet cannot
* be parsed, 'result' will store the result code of dns_message_parse().
* If the response packet is received, 'rmessage' will contain the response
* message, whether it is successfully parsed or not.
*/
typedef struct dns_clientreqevent {
ISC_EVENT_COMMON(struct dns_clientreqevent);
isc_result_t result;
dns_message_t *rmessage;
} dns_clientreqevent_t; /* too long? */
/*%
* A dns_clientupdateevent_t is sent when dynamic update performed by a client
* completes. 'result' stores the result code of the entire update procedure.
* 'state' specifies the status of the update procedure when this event is
* sent. This can be used as a hint by the receiver to determine whether
* the update attempt was ever made. In particular, if the state is
* dns_clientupdatestate_prepare, the receiver can be sure that the requested
* update was not applied.
*/
typedef struct dns_clientupdateevent {
ISC_EVENT_COMMON(struct dns_clientupdateevent);
isc_result_t result;
dns_clientupdatestate_t state;
} dns_clientupdateevent_t; /* too long? */
isc_result_t
dns_client_create(dns_client_t **clientp, unsigned int options);
isc_result_t
dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx, isc_taskmgr_t *taskmgr,
isc_socketmgr_t *socketmgr, isc_timermgr_t *timermgr,
unsigned int options, dns_client_t **clientp);
/*%<
* Create a DNS client. These functions create a new client object with
* minimal internal resources such as the default 'view' for the IN class and
* IPv4/IPv6 dispatches for the view.
*
* dns_client_createx() takes 'manager' arguments so that the caller can
* control the behavior of the client through the underlying event framework.
* On the other hand, dns_client_create() simplifies the interface and creates
* the managers internally. A DNS client object created via
* dns_client_create() is expected to be used by an application that only needs
* simple synchronous services or by a thread-based application.
*
* If the DNS_CLIENTCREATEOPT_USECACHE flag is set in 'options',
* dns_client_create(x) will create a cache database with the view.
*
* Requires:
*
*\li 'mctx' is a valid memory context.
*
*\li 'actx' is a valid application context.
*
*\li 'taskmgr' is a valid task manager.
*
*\li 'socketmgr' is a valid socket manager.
*
*\li 'timermgr' is a valid timer manager.
*
*\li clientp != NULL && *clientp == NULL.
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
void
dns_client_destroy(dns_client_t **clientp);
/*%<
* Destroy 'client'.
*
* Requires:
*
*\li '*clientp' is a valid client.
*
* Ensures:
*
*\li *clientp == NULL.
*/
isc_result_t
dns_client_setservers(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *namespace, isc_sockaddrlist_t *addrs);
/*%<
* Specify a list of addresses of recursive name servers that the client will
* use for name resolution. A view for the 'rdclass' class must be created
* beforehand. If 'namespace' is non NULL, the specified server will be used
* if and only if the query name is a subdomain of 'namespace'. When servers
* for multiple 'namespace's are provided, and a query name is covered by
* more than one 'namespace', the servers for the best (longest) matching
* namespace will be used. If 'namespace' is NULL, it works as if
* dns_rootname (.) were specified.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namespace' is NULL or a valid name.
*
*\li 'addrs' != NULL.
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
isc_result_t
dns_client_clearservers(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *namespace);
/*%<
* Remove configured recursive name servers for the 'rdclass' and 'namespace'
* from the client. See the description of dns_client_setservers() for
* the requirements about 'rdclass' and 'namespace'.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namespace' is NULL or a valid name.
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
isc_result_t
dns_client_resolve(dns_client_t *client, dns_name_t *name,
dns_rdataclass_t rdclass, dns_rdatatype_t type,
unsigned int options, dns_namelist_t *namelist);
isc_result_t
dns_client_startresolve(dns_client_t *client, dns_name_t *name,
dns_rdataclass_t rdclass, dns_rdatatype_t type,
unsigned int options, isc_task_t *task,
isc_taskaction_t action, void *arg,
dns_clientrestrans_t **transp);
/*%<
* Perform name resolution for 'name', 'rdclass', and 'type'.
*
* If any trusted keys are configured and the query name is considered to
* belong to a secure zone, these functions also validate the responses
* using DNSSEC by default. If the DNS_CLIENTRESOPT_NODNSSEC flag is set
* in 'options', DNSSEC validation is disabled regardless of the configured
* trusted keys or the query name.
*
* dns_client_resolve() provides a synchronous service. This function starts
* name resolution internally and blocks until it completes. On success,
* 'namelist' will contain a list of answer names, each of which has
* corresponding RRsets. The caller must provide a valid empty list, and
* is responsible for freeing the list content via dns_client_freeresanswer().
* If the name resolution fails due to an error in DNSSEC validation,
* dns_client_resolve() returns the result code indicating the validation
* error. Otherwise, it returns the result code of the entire resolution
* process, either success or failure.
*
* It is typically expected that the client object passed to
* dns_client_resolve() was created via dns_client_create() and has its own
* managers and contexts. However, if the DNS_CLIENTRESOPT_ALLOWRUN flag is
* set in 'options', this function performs the synchronous service even if
* it does not have its own manager and context structures.
*
* dns_client_startresolve() is an asynchronous version of dns_client_resolve()
* and does not block. When name resolution is completed, 'action' will be
* called with the argument of a 'dns_clientresevent_t' object, which contains
* the resulting list of answer names (on success). On return, '*transp' is
* set to an opaque transaction ID so that the caller can cancel this
* resolution process.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'addrs' != NULL.
*
*\li 'name' is a valid name.
*
*\li 'namelist' != NULL and is not empty.
*
*\li 'task' is a valid task.
*
*\li 'transp' != NULL && *transp == NULL;
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
void
dns_client_cancelresolve(dns_clientrestrans_t *trans);
/*%<
* Cancel an ongoing resolution procedure started via
* dns_client_startresolve().
*
* Notes:
*
*\li If the resolution procedure has not completed, post its CLIENTRESDONE
* event with a result code of #ISC_R_CANCELED.
*
* Requires:
*
*\li 'trans' is a valid transaction ID.
*/
void
dns_client_destroyrestrans(dns_clientrestrans_t **transp);
/*%<
* Destroy name resolution transaction state identified by '*transp'.
*
* Requires:
*
*\li '*transp' is a valid transaction ID.
*
*\li The caller has received the CLIENTRESDONE event (either because the
* resolution completed or because dns_client_cancelresolve() was called).
*
* Ensures:
*
*\li *transp == NULL.
*/
void
dns_client_freeresanswer(dns_client_t *client, dns_namelist_t *namelist);
/*%<
* Free resources allocated for the content of 'namelist'.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'namelist' != NULL.
*/
isc_result_t
dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *keyname, isc_buffer_t *keydatabuf);
/*%<
* Add a DNSSEC trusted key for the 'rdclass' class. A view for the 'rdclass'
* class must be created beforehand. 'keyname' is the DNS name of the key,
* and 'keydatabuf' stores the resource data of the key.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'keyname' is a valid name.
*
*\li 'keydatabuf' is a valid buffer.
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
isc_result_t
dns_client_request(dns_client_t *client, dns_message_t *qmessage,
dns_message_t *rmessage, isc_sockaddr_t *server,
unsigned int options, unsigned int parseoptions,
dns_tsec_t *tsec, unsigned int timeout,
unsigned int udptimeout, unsigned int udpretries);
isc_result_t
dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
dns_message_t *rmessage, isc_sockaddr_t *server,
unsigned int options, unsigned int parseoptions,
dns_tsec_t *tsec, unsigned int timeout,
unsigned int udptimeout, unsigned int udpretries,
isc_task_t *task, isc_taskaction_t action, void *arg,
dns_clientreqtrans_t **transp);
/*%<
* Send a DNS request containig a query message 'query' to 'server'.
*
* 'parseoptions' will be used when the response packet is parsed, and will be
* passed to dns_message_parse() via dns_request_getresponse(). See
* dns_message_parse() for more details.
*
* 'tsec' is a transaction security object containing, e.g. a TSIG key for
* authenticating the request/response transaction. This is optional and can
* be NULL, in which case this library performs the transaction without any
* transaction authentication.
*
* 'timeout', 'udptimeout', and 'udpretries' are passed to
* dns_request_createvia3(). See dns_request_createvia3() for more details.
*
* dns_client_request() provides a synchronous service. This function sends
* the request and blocks until a response is received. On success,
* 'rmessage' will contain the response message. The caller must provide a
* valid initialized message.
*
* It is usually expected that the client object passed to
* dns_client_request() was created via dns_client_create() and has its own
* managers and contexts. However, if the DNS_CLIENTREQOPT_ALLOWRUN flag is
* set in 'options', this function performs the synchronous service even if
* it does not have its own manager and context structures.
*
* dns_client_startrequest() is an asynchronous version of dns_client_request()
* and does not block. When the transaction is completed, 'action' will be
* called with the argument of a 'dns_clientreqevent_t' object, which contains
* the response message (on success). On return, '*transp' is set to an opaque
* transaction ID so that the caller can cancel this request.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'qmessage' and 'rmessage' are valid initialized message.
*
*\li 'server' is a valid socket address structure.
*
*\li 'task' is a valid task.
*
*\li 'transp' != NULL && *transp == NULL;
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*
*\li Any result that dns_message_parse() can return.
*/
void
dns_client_cancelrequest(dns_clientreqtrans_t *transp);
/*%<
* Cancel an ongoing DNS request procedure started via
* dns_client_startrequest().
*
* Notes:
*
*\li If the request procedure has not completed, post its CLIENTREQDONE
* event with a result code of #ISC_R_CANCELED.
*
* Requires:
*
*\li 'trans' is a valid transaction ID.
*/
void
dns_client_destroyreqtrans(dns_clientreqtrans_t **transp);
/*%
* Destroy DNS request transaction state identified by '*transp'.
*
* Requires:
*
*\li '*transp' is a valid transaction ID.
*
*\li The caller has received the CLIENTREQDONE event (either because the
* request completed or because dns_client_cancelrequest() was called).
*
* Ensures:
*
*\li *transp == NULL.
*/
isc_result_t
dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *zonename, dns_namelist_t *prerequisites,
dns_namelist_t *updates, isc_sockaddrlist_t *servers,
dns_tsec_t *tsec, unsigned int options);
isc_result_t
dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
dns_name_t *zonename, dns_namelist_t *prerequisites,
dns_namelist_t *updates, isc_sockaddrlist_t *servers,
dns_tsec_t *tsec, unsigned int options,
isc_task_t *task, isc_taskaction_t action, void *arg,
dns_clientupdatetrans_t **transp);
/*%<
* Perform DNS dynamic update for 'updates' of the 'rdclass' class with
* optional 'prerequisites'.
*
* 'updates' are a list of names with associated RRsets to be updated.
*
* 'prerequisites' are a list of names with associated RRsets corresponding to
* the prerequisites of the updates. This is optional and can be NULL, in
* which case the prerequisite section of the update message will be empty.
*
* Both 'updates' and 'prerequisites' must be constructed as specified in
* RFC2136.
*
* 'zonename' is the name of the zone in which the updated names exist.
* This is optional and can be NULL. In this case, these functions internally
* identify the appropriate zone through some queries for the SOA RR starting
* with the first name in prerequisites or updates.
*
* 'servers' is a list of authoritative servers to which the update message
* should be sent. This is optional and can be NULL. In this case, these
* functions internally identify the appropriate primary server name and its
* addresses through some queries for the SOA RR (like the case of zonename)
* and supplemental A/AAAA queries for the server name.
* Note: The client module generally assumes the given addresses are of the
* primary server of the corresponding zone. It will work even if a secondary
* server address is specified as long as the server allows update forwarding,
* it is generally discouraged to include secondary server addresses unless
* there's strong reason to do so.
*
* 'tsec' is a transaction security object containing, e.g. a TSIG key for
* authenticating the update transaction (and the supplemental query/response
* transactions if the server is specified). This is optional and can be
* NULL, in which case the library tries the update without any transaction
* authentication.
*
* dns_client_update() provides a synchronous service. This function blocks
* until the entire update procedure completes, including the additional
* queries when necessary.
*
* dns_client_startupdate() is an asynchronous version of dns_client_update().
* It immediately returns (typically with *transp being set to a non-NULL
* pointer), and performs the update procedure through a set of internal
* events. All transactions including the additional query exchanges are
* performed as a separate event, so none of these events cause blocking
* operation. When the update procedure completes, the specified function
* 'action' will be called with the argument of a 'dns_clientupdateevent_t'
* structure. On return, '*transp' is set to an opaque transaction ID so that
* the caller can cancel this update process.
*
* Notes:
*\li No options are currently defined.
*
* Requires:
*
*\li 'client' is a valid client.
*
*\li 'updates' != NULL.
*
*\li 'task' is a valid task.
*
*\li 'transp' != NULL && *transp == NULL;
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
void
dns_client_cancelupdate(dns_clientupdatetrans_t *trans);
/*%<
* Cancel an ongoing dynamic update procedure started via
* dns_client_startupdate().
*
* Notes:
*
*\li If the update procedure has not completed, post its UPDATEDONE
* event with a result code of #ISC_R_CANCELED.
*
* Requires:
*
*\li 'trans' is a valid transaction ID.
*/
void
dns_client_destroyupdatetrans(dns_clientupdatetrans_t **transp);
/*%<
* Destroy dynamic update transaction identified by '*transp'.
*
* Requires:
*
*\li '*transp' is a valid transaction ID.
*
*\li The caller has received the UPDATEDONE event (either because the
* update completed or because dns_client_cancelupdate() was called).
*
* Ensures:
*
*\li *transp == NULL.
*/
isc_result_t
dns_client_updaterec(dns_client_updateop_t op, dns_name_t *owner,
dns_rdatatype_t type, dns_rdata_t *source,
dns_ttl_t ttl, dns_name_t *target,
dns_rdataset_t *rdataset, dns_rdatalist_t *rdatalist,
dns_rdata_t *rdata, isc_mem_t *mctx);
/*%<
* TBD
*/
void
dns_client_freeupdate(dns_name_t **namep);
/*%<
* TBD
*/
isc_mem_t *
dns_client_mctx(dns_client_t *client);
ISC_LANG_ENDDECLS
#endif /* DNS_CLIENT_H */

View file

@ -0,0 +1,52 @@
/*
* Copyright (C) 2005 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and 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.
*/
/* $Id: ecdb.h,v 1.2 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_ECDB_H
#define DNS_ECDB_H 1
/*****
***** Module Info
*****/
/* TBD */
/***
*** Imports
***/
#include <dns/types.h>
/***
*** Types
***/
/***
*** Functions
***/
/* TBD: describe those */
isc_result_t
dns_ecdb_register(isc_mem_t *mctx, dns_dbimplementation_t **dbimp);
void
dns_ecdb_unregister(dns_dbimplementation_t **dbimp);
ISC_LANG_ENDDECLS
#endif /* DNS_ECDB_H */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: events.h,v 1.52 2009/06/30 02:52:32 each Exp $ */
/* $Id: events.h,v 1.53 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_EVENTS_H
#define DNS_EVENTS_H 1
@ -70,6 +70,8 @@
#define DNS_EVENT_ACACHEOVERMEM (ISC_EVENTCLASS_DNS + 40)
#define DNS_EVENT_RBTPRUNE (ISC_EVENTCLASS_DNS + 41)
#define DNS_EVENT_MANAGEKEYS (ISC_EVENTCLASS_DNS + 42)
#define DNS_EVENT_CLIENTRESDONE (ISC_EVENTCLASS_DNS + 43)
#define DNS_EVENT_CLIENTREQDONE (ISC_EVENTCLASS_DNS + 44)
#define DNS_EVENT_FIRSTEVENT (ISC_EVENTCLASS_DNS + 0)
#define DNS_EVENT_LASTEVENT (ISC_EVENTCLASS_DNS + 65535)

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: forward.h,v 1.11 2007/06/19 23:47:16 tbox Exp $ */
/* $Id: forward.h,v 1.12 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_FORWARD_H
#define DNS_FORWARD_H 1
@ -66,6 +66,21 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
* \li #ISC_R_NOMEMORY
*/
isc_result_t
dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name);
/*%<
* Removes an entry for 'name' from the forwarding table. If an entry
* that exactly matches 'name' does not exist, ISC_R_NOTFOUND will be returned.
*
* Requires:
* \li fwdtable is a valid forwarding table.
* \li name is a valid name
*
* Returns:
* \li #ISC_R_SUCCESS
* \li #ISC_R_NOTFOUND
*/
isc_result_t
dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
dns_forwarders_t **forwardersp);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lib.h,v 1.16 2007/06/19 23:47:17 tbox Exp $ */
/* $Id: lib.h,v 1.17 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_LIB_H
#define DNS_LIB_H 1
@ -40,6 +40,20 @@ dns_lib_initmsgcat(void);
* has not already been initialized.
*/
isc_result_t
dns_lib_init(void);
/*%<
* A set of initialization procedure used in the DNS library. This function
* is provided for an application that is not aware of the underlying ISC or
* DNS libraries much.
*/
void
dns_lib_shutdown(void);
/*%<
* Free temporary resources allocated in dns_lib_init().
*/
ISC_LANG_ENDDECLS
#endif /* DNS_LIB_H */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: message.h,v 1.127 2009/01/17 23:47:43 tbox Exp $ */
/* $Id: message.h,v 1.128 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_MESSAGE_H
#define DNS_MESSAGE_H 1
@ -81,8 +81,7 @@
* name = NULL;
* name = dns_message_gettempname(message, &name);
* dns_name_init(name, NULL);
* result = dns_name_fromtext(name, &source, dns_rootname, ISC_FALSE,
* buffer);
* result = dns_name_fromtext(name, &source, dns_rootname, 0, buffer);
* dns_message_takebuffer(message, &buffer);
* \endcode
*

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.h,v 1.130 2009/06/30 02:52:32 each Exp $ */
/* $Id: name.h,v 1.131 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_NAME_H
#define DNS_NAME_H 1
@ -127,21 +127,27 @@ struct dns_name {
#define DNS_NAME_MAGIC ISC_MAGIC('D','N','S','n')
#define DNS_NAMEATTR_ABSOLUTE 0x0001
#define DNS_NAMEATTR_READONLY 0x0002
#define DNS_NAMEATTR_DYNAMIC 0x0004
#define DNS_NAMEATTR_DYNOFFSETS 0x0008
#define DNS_NAMEATTR_NOCOMPRESS 0x0010
#define DNS_NAMEATTR_ABSOLUTE 0x00000001
#define DNS_NAMEATTR_READONLY 0x00000002
#define DNS_NAMEATTR_DYNAMIC 0x00000004
#define DNS_NAMEATTR_DYNOFFSETS 0x00000008
#define DNS_NAMEATTR_NOCOMPRESS 0x00000010
/*
* Attributes below 0x0100 reserved for name.c usage.
*/
#define DNS_NAMEATTR_CACHE 0x0100 /*%< Used by resolver. */
#define DNS_NAMEATTR_ANSWER 0x0200 /*%< Used by resolver. */
#define DNS_NAMEATTR_NCACHE 0x0400 /*%< Used by resolver. */
#define DNS_NAMEATTR_CHAINING 0x0800 /*%< Used by resolver. */
#define DNS_NAMEATTR_CHASE 0x1000 /*%< Used by resolver. */
#define DNS_NAMEATTR_WILDCARD 0x2000 /*%< Used by server. */
#define DNS_NAMEATTR_CACHE 0x00000100 /*%< Used by resolver. */
#define DNS_NAMEATTR_ANSWER 0x00000200 /*%< Used by resolver. */
#define DNS_NAMEATTR_NCACHE 0x00000400 /*%< Used by resolver. */
#define DNS_NAMEATTR_CHAINING 0x00000800 /*%< Used by resolver. */
#define DNS_NAMEATTR_CHASE 0x00001000 /*%< Used by resolver. */
#define DNS_NAMEATTR_WILDCARD 0x00002000 /*%< Used by server. */
#define DNS_NAMEATTR_PREREQUISITE 0x00004000 /*%< Used by client. */
#define DNS_NAMEATTR_UPDATE 0x00008000 /*%< Used by client. */
#define DNS_NAMEATTR_HASUPDATEREC 0x00010000 /*%< Used by client. */
/*
* Various flags.
*/
#define DNS_NAME_DOWNCASE 0x0001
#define DNS_NAME_CHECKNAMES 0x0002 /*%< Used by rdata. */
#define DNS_NAME_CHECKNAMESFAIL 0x0004 /*%< Used by rdata. */
@ -1294,6 +1300,13 @@ 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
/*

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.h,v 1.73 2009/01/17 23:47:43 tbox Exp $ */
/* $Id: rdata.h,v 1.74 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_RDATA_H
#define DNS_RDATA_H 1
@ -95,6 +95,7 @@
#include <dns/types.h>
#include <dns/name.h>
#include <dns/message.h>
ISC_LANG_BEGINDECLS
@ -698,6 +699,21 @@ dns_rdata_checknames(dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad);
* 'bad' to be NULL or valid.
*/
void
dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type);
void
dns_rdata_notexist(dns_rdata_t *rdata, dns_rdatatype_t type);
void
dns_rdata_deleterrset(dns_rdata_t *rdata, dns_rdatatype_t type);
void
dns_rdata_makedelete(dns_rdata_t *rdata);
const char *
dns_rdata_updateop(dns_rdata_t *rdata, dns_section_t section);
ISC_LANG_ENDDECLS
#endif /* DNS_RDATA_H */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.h,v 1.63 2009/01/27 22:29:59 jinmei Exp $ */
/* $Id: resolver.h,v 1.64 2009/09/01 00:22:26 jinmei Exp $ */
#ifndef DNS_RESOLVER_H
#define DNS_RESOLVER_H 1
@ -81,6 +81,7 @@ typedef struct dns_fetchevent {
dns_fixedname_t foundname;
isc_sockaddr_t * client;
dns_messageid_t id;
isc_result_t vresult;
} dns_fetchevent_t;
/*

135
lib/dns/include/dns/tsec.h Normal file
View file

@ -0,0 +1,135 @@
/*
* Copyright (C) 2006 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and 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.
*/
/* $Id: tsec.h,v 1.2 2009/09/01 00:22:27 jinmei Exp $ */
#ifndef DNS_TSEC_H
#define DNS_TSEC_H 1
/*****
***** Module Info
*****/
/*! \file
*
* \brief
* The TSEC (Transaction Security) module is an abstraction layer for managing
* DNS transaction mechanisms such as TSIG or SIG(0). A TSEC structure is a
* mechanism-independent object containing key information specific to the
* mechanism, and is expected to be used as an argument to other modules
* that use transaction security in a mechanism-independent manner.
*
* MP:
*\li A TSEC structure is expected to be thread-specific. No inter-thread
* synchronization is ensured in multiple access to a single TSEC
* structure.
*
* Resources:
*\li TBS
*
* Security:
*\li This module does not handle any low-level data directly, and so no
* security issue specific to this module is anticipated.
*/
#include <dns/types.h>
#include <dst/dst.h>
ISC_LANG_BEGINDECLS
/***
*** Types
***/
/*%
* Transaction security types.
*/
typedef enum {
dns_tsectype_none,
dns_tsectype_tsig,
dns_tsectype_sig0
} dns_tsectype_t;
isc_result_t
dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key,
dns_tsec_t **tsecp);
/*%<
* Create a TSEC structure and stores a type-dependent key structure in it.
* For a TSIG key (type is dns_tsectype_tsig), dns_tsec_create() creates a
* TSIG key structure from '*key' and keeps it in the structure. For other
* types, this function simply retains '*key' in the structure. In either
* case, the ownership of '*key' is transferred to the TSEC module; the caller
* must not modify or destroy it after the call to dns_tsec_create().
*
* Requires:
*
*\li 'mctx' is a valid memory context.
*
*\li 'type' is a valid value of dns_tsectype_t (see above).
*
*\li 'key' is a valid key.
*
*\li tsecp != NULL && *tsecp == NULL.
*
* Returns:
*
*\li #ISC_R_SUCCESS On success.
*
*\li Anything else Failure.
*/
void
dns_tsec_destroy(dns_tsec_t **tsecp);
/*%<
* Destroy the TSEC structure. The stored key is also detached or destroyed.
*
* Requires
*
*\li '*tsecp' is a valid TSEC structure.
*
* Ensures
*
*\li *tsecp == NULL.
*
*/
dns_tsectype_t
dns_tsec_gettype(dns_tsec_t *tsec);
/*%<
* Return the TSEC type of '*tsec'.
*
* Requires
*
*\li 'tsec' is a valid TSEC structure.
*
*/
void
dns_tsec_getkey(dns_tsec_t *tsec, void *keyp);
/*%<
* Return the TSEC key of '*tsec' in '*keyp'.
*
* Requires
*
*\li keyp != NULL
*
* Ensures
*
*\li *tsecp points to a valid key structure depending on the TSEC type.
*/
#endif /* DNS_TSEC_H */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: types.h,v 1.135 2009/07/19 04:18:05 each Exp $ */
/* $Id: types.h,v 1.136 2009/09/01 00:22:27 jinmei Exp $ */
#ifndef DNS_TYPES_H
#define DNS_TYPES_H 1
@ -44,6 +44,10 @@ typedef struct dns_adbentry dns_adbentry_t;
typedef struct dns_adbfind dns_adbfind_t;
typedef ISC_LIST(dns_adbfind_t) dns_adbfindlist_t;
typedef struct dns_byaddr dns_byaddr_t;
typedef struct dns_client dns_client_t;
typedef void dns_clientrestrans_t;
typedef void dns_clientreqtrans_t;
typedef void dns_clientupdatetrans_t;
typedef struct dns_cache dns_cache_t;
typedef isc_uint16_t dns_cert_t;
typedef struct dns_compress dns_compress_t;
@ -114,6 +118,7 @@ typedef struct dns_stats dns_stats_t;
typedef isc_uint32_t dns_rdatastatstype_t;
typedef struct dns_tkeyctx dns_tkeyctx_t;
typedef isc_uint16_t dns_trust_t;
typedef struct dns_tsec dns_tsec_t;
typedef struct dns_tsig_keyring dns_tsig_keyring_t;
typedef struct dns_tsigkey dns_tsigkey_t;
typedef isc_uint32_t dns_ttl_t;

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lib.c,v 1.16 2007/06/19 23:47:16 tbox Exp $ */
/* $Id: lib.c,v 1.17 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -23,11 +23,20 @@
#include <stddef.h>
#include <isc/once.h>
#include <isc/hash.h>
#include <isc/mem.h>
#include <isc/msgcat.h>
#include <isc/mutex.h>
#include <isc/once.h>
#include <isc/util.h>
#include <dns/db.h>
#include <dns/ecdb.h>
#include <dns/lib.h>
#include <dns/result.h>
#include <dst/dst.h>
/***
*** Globals
@ -63,3 +72,97 @@ dns_lib_initmsgcat(void) {
RUNTIME_CHECK(isc_once_do(&msgcat_once, open_msgcat) == ISC_R_SUCCESS);
}
static isc_once_t init_once = ISC_ONCE_INIT;
static isc_mem_t *dns_g_mctx = NULL;
#ifndef BIND9
static dns_dbimplementation_t *dbimp = NULL;
#endif
static isc_boolean_t initialize_done = ISC_FALSE;
static isc_mutex_t reflock;
static unsigned int references = 0;
static void
initialize() {
isc_result_t result;
REQUIRE(initialize_done == ISC_FALSE);
result = isc_mem_create(0, 0, &dns_g_mctx);
if (result != ISC_R_SUCCESS)
return;
dns_result_register();
#ifndef BIND9
result = dns_ecdb_register(dns_g_mctx, &dbimp);
if (result != ISC_R_SUCCESS)
goto cleanup_mctx;
#endif
result = isc_hash_create(dns_g_mctx, NULL, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
goto cleanup_db;
result = dst_lib_init(dns_g_mctx, NULL, 0);
if (result != ISC_R_SUCCESS)
goto cleanup_hash;
result = isc_mutex_init(&reflock);
if (result != ISC_R_SUCCESS)
goto cleanup_dst;
initialize_done = ISC_TRUE;
return;
cleanup_dst:
dst_lib_destroy();
cleanup_hash:
isc_hash_destroy();
cleanup_db:
#ifndef BIND9
dns_ecdb_unregister(&dbimp);
cleanup_mctx:
#endif
isc_mem_detach(&dns_g_mctx);
}
isc_result_t
dns_lib_init(void) {
isc_result_t result;
/*
* Since this routine is expected to be used by a normal application,
* it should be better to return an error, instead of an emergency
* abort, on any failure.
*/
result = isc_once_do(&init_once, initialize);
if (result != ISC_R_SUCCESS)
return (result);
if (!initialize_done)
return (ISC_R_FAILURE);
LOCK(&reflock);
references++;
UNLOCK(&reflock);
return (ISC_R_SUCCESS);
}
void
dns_lib_shutdown(void) {
isc_boolean_t cleanup_ok = ISC_FALSE;
LOCK(&reflock);
if (--references == 0)
cleanup_ok = ISC_TRUE;
UNLOCK(&reflock);
if (!cleanup_ok)
return;
dst_lib_destroy();
isc_hash_destroy();
#ifndef BIND9
dns_ecdb_unregister(&dbimp);
#endif
isc_mem_detach(&dns_g_mctx);
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.177 2009/06/30 02:52:32 each Exp $ */
/* $Id: master.c,v 1.178 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -1382,7 +1382,7 @@ load_text(dns_loadctx_t *lctx) {
isc_buffer_setactive(&buffer,
token.value.as_region.length);
result = dns_name_fromtext(new_name, &buffer,
ictx->origin, ISC_FALSE, NULL);
ictx->origin, 0, NULL);
if (MANYERRS(lctx, result)) {
SETRESULT(lctx, result);
LOGIT(result);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: masterdump.c,v 1.97 2009/01/17 23:47:42 tbox Exp $ */
/* $Id: masterdump.c,v 1.98 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -162,6 +162,7 @@ static char spaces[N_SPACES+1] = " ";
#define N_TABS 10
static char tabs[N_TABS+1] = "\t\t\t\t\t\t\t\t\t\t";
#ifdef BIND9
struct dns_dumpctx {
unsigned int magic;
isc_mem_t *mctx;
@ -189,6 +190,7 @@ struct dns_dumpctx {
dns_totext_ctx_t *ctx,
isc_buffer_t *buffer, FILE *f);
};
#endif /* BIND9 */
#define NXDOMAIN(x) (((x)->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0)
@ -698,6 +700,7 @@ dns_master_questiontotext(dns_name_t *owner_name,
ISC_FALSE, target));
}
#ifdef BIND9
/*
* Print an rdataset. 'buffer' is a scratch buffer, which must have been
* dynamically allocated by the caller. It must be large enough to
@ -1775,6 +1778,7 @@ dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
return (result);
}
#endif /* BIND9 */
isc_result_t
dns_master_stylecreate(dns_master_style_t **stylep, unsigned int flags,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name.c,v 1.167 2009/03/11 23:47:35 tbox Exp $ */
/* $Id: name.c,v 1.168 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -1019,6 +1019,31 @@ 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,
@ -2385,7 +2410,7 @@ dns_name_fromstring(dns_name_t *target, const char *src, isc_mem_t *mctx) {
dns_fixedname_init(&fn);
name = dns_fixedname_name(&fn);
result = dns_name_fromtext(name, &buf, dns_rootname, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: peer.c,v 1.31 2008/04/03 06:09:04 tbox Exp $ */
/* $Id: peer.c,v 1.32 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -536,7 +536,7 @@ dns_peer_setkeybycharp(dns_peer_t *peer, const char *keyval) {
isc_buffer_init(&b, keyval, strlen(keyval));
isc_buffer_add(&b, strlen(keyval));
result = dns_name_fromtext(dns_fixedname_name(&fname), &b,
dns_rootname, ISC_FALSE, NULL);
dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rbtdb.c,v 1.277 2009/07/13 07:02:46 marka Exp $ */
/* $Id: rbtdb.c,v 1.278 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -625,8 +625,10 @@ typedef struct rbtdb_dbiterator {
static void free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log,
isc_event_t *event);
static void overmem(dns_db_t *db, isc_boolean_t overmem);
#ifdef BIND9
static void setnsec3parameters(dns_db_t *db, rbtdb_version_t *version,
isc_boolean_t *nsec3createflag);
#endif
/*%
* 'init_count' is used to initialize 'newheader->count' which inturn
@ -1925,6 +1927,13 @@ cleanup_nondirty(rbtdb_version_t *version, rbtdb_changedlist_t *cleanup_list) {
static void
iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) {
#ifndef BIND9
UNUSED(db);
UNUSED(version);
UNUSED(origin);
return;
#else
dns_rdataset_t keyset;
dns_rdataset_t nsecset, signsecset;
dns_rdata_t rdata = DNS_RDATA_INIT;
@ -1988,12 +1997,14 @@ iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) {
version->secure = dns_db_partial;
else
version->secure = dns_db_insecure;
#endif
}
/*%<
* Walk the origin node looking for NSEC3PARAM records.
* Cache the nsec3 parameters.
*/
#ifdef BIND9
static void
setnsec3parameters(dns_db_t *db, rbtdb_version_t *version,
isc_boolean_t *nsec3createflag)
@ -2098,6 +2109,7 @@ setnsec3parameters(dns_db_t *db, rbtdb_version_t *version,
isc_rwlocktype_read);
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
}
#endif
static void
closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) {
@ -6505,9 +6517,17 @@ dump(dns_db_t *db, dns_dbversion_t *version, const char *filename,
REQUIRE(VALID_RBTDB(rbtdb));
#ifdef BIND9
return (dns_master_dump2(rbtdb->common.mctx, db, version,
&dns_master_style_default,
filename, masterformat));
#else
UNUSED(version);
UNUSED(filename);
UNUSED(masterformat);
return (ISC_R_NOTIMPLEMENTED);
#endif /* BIND9 */
}
static void
@ -8089,6 +8109,21 @@ rdataset_getadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type,
dns_name_t *fname, dns_message_t *msg,
isc_stdtime_t now)
{
#ifndef BIND9
UNUSED(rdataset);
UNUSED(type);
UNUSED(qtype);
UNUSED(acache);
UNUSED(zonep);
UNUSED(dbp);
UNUSED(versionp);
UNUSED(nodep);
UNUSED(fname);
UNUSED(msg);
UNUSED(now);
return (ISC_R_NOTIMPLEMENTED);
#else
dns_rbtdb_t *rbtdb = rdataset->private1;
dns_rbtnode_t *rbtnode = rdataset->private2;
unsigned char *raw = rdataset->private3; /* RDATASLAB */
@ -8205,8 +8240,10 @@ acache_callback(dns_acacheentry_t *entry, void **arg) {
dns_db_detach((dns_db_t **)(void*)&rbtdb);
*arg = NULL;
#endif /* BIND9 */
}
#ifdef BIND9
static void
acache_cancelentry(isc_mem_t *mctx, dns_acacheentry_t *entry,
acache_cbarg_t **cbargp)
@ -8227,6 +8264,7 @@ acache_cancelentry(isc_mem_t *mctx, dns_acacheentry_t *entry,
*cbargp = NULL;
}
#endif /* BIND9 */
static isc_result_t
rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type,
@ -8235,6 +8273,19 @@ rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type,
dns_dbversion_t *version, dns_dbnode_t *node,
dns_name_t *fname)
{
#ifndef BIND9
UNUSED(rdataset);
UNUSED(type);
UNUSED(qtype);
UNUSED(acache);
UNUSED(zone);
UNUSED(db);
UNUSED(version);
UNUSED(node);
UNUSED(fname);
return (ISC_R_NOTIMPLEMENTED);
#else
dns_rbtdb_t *rbtdb = rdataset->private1;
dns_rbtnode_t *rbtnode = rdataset->private2;
unsigned char *raw = rdataset->private3; /* RDATASLAB */
@ -8358,12 +8409,21 @@ rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type,
}
return (result);
#endif
}
static isc_result_t
rdataset_putadditional(dns_acache_t *acache, dns_rdataset_t *rdataset,
dns_rdatasetadditional_t type, dns_rdatatype_t qtype)
{
#ifndef BIND9
UNUSED(acache);
UNUSED(rdataset);
UNUSED(type);
UNUSED(qtype);
return (ISC_R_NOTIMPLEMENTED);
#else
dns_rbtdb_t *rbtdb = rdataset->private1;
dns_rbtnode_t *rbtnode = rdataset->private2;
unsigned char *raw = rdataset->private3; /* RDATASLAB */
@ -8428,6 +8488,7 @@ rdataset_putadditional(dns_acache_t *acache, dns_rdataset_t *rdataset,
}
return (ISC_R_SUCCESS);
#endif
}
/*%

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata.c,v 1.200 2008/12/12 04:37:23 marka Exp $ */
/* $Id: rdata.c,v 1.201 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -38,6 +38,7 @@
#include <dns/enumtype.h>
#include <dns/keyflags.h>
#include <dns/keyvalues.h>
#include <dns/message.h>
#include <dns/rcode.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
@ -1767,3 +1768,93 @@ dns_rdatatype_isknown(dns_rdatatype_t type) {
return (ISC_TRUE);
return (ISC_FALSE);
}
void
dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type) {
REQUIRE(rdata != NULL);
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
rdata->data = NULL;
rdata->length = 0;
rdata->flags = DNS_RDATA_UPDATE;
rdata->type = type;
rdata->rdclass = dns_rdataclass_any;
}
void
dns_rdata_notexist(dns_rdata_t *rdata, dns_rdatatype_t type) {
REQUIRE(rdata != NULL);
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
rdata->data = NULL;
rdata->length = 0;
rdata->flags = DNS_RDATA_UPDATE;
rdata->type = type;
rdata->rdclass = dns_rdataclass_none;
}
void
dns_rdata_deleterrset(dns_rdata_t *rdata, dns_rdatatype_t type) {
REQUIRE(rdata != NULL);
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
rdata->data = NULL;
rdata->length = 0;
rdata->flags = DNS_RDATA_UPDATE;
rdata->type = type;
rdata->rdclass = dns_rdataclass_any;
}
void
dns_rdata_makedelete(dns_rdata_t *rdata) {
REQUIRE(rdata != NULL);
rdata->rdclass = dns_rdataclass_none;
}
const char *
dns_rdata_updateop(dns_rdata_t *rdata, dns_section_t section) {
REQUIRE(rdata != NULL);
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
switch (section) {
case DNS_SECTION_PREREQUISITE:
switch (rdata->rdclass) {
case dns_rdataclass_none:
switch (rdata->type) {
case dns_rdatatype_any:
return ("domain doesn't exist");
default:
return ("rrset doesn't exist");
}
case dns_rdataclass_any:
switch (rdata->type) {
case dns_rdatatype_any:
return ("domain exists");
default:
return ("rrset exists (value independent)");
}
default:
return ("rrset exists (value dependent)");
}
case DNS_SECTION_UPDATE:
switch (rdata->rdclass) {
case dns_rdataclass_none:
return ("delete");
case dns_rdataclass_any:
switch (rdata->type) {
case dns_rdatatype_any:
return ("delete all rrsets");
default:
return ("delete rrset");
}
default:
return ("add");
}
}
return ("invalid");
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: request.c,v 1.84 2009/01/17 23:47:43 tbox Exp $ */
/* $Id: request.c,v 1.85 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -449,7 +449,8 @@ req_send(dns_request_t *request, isc_task_t *task, isc_sockaddr_t *address) {
}
static isc_result_t
new_request(isc_mem_t *mctx, dns_request_t **requestp) {
new_request(isc_mem_t *mctx, dns_request_t **requestp)
{
dns_request_t *request;
request = isc_mem_get(mctx, sizeof(*request));

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.404 2009/08/13 04:33:51 marka Exp $ */
/* $Id: resolver.c,v 1.405 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -1013,6 +1013,7 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result, int line) {
ISC_LIST_UNLINK(fctx->events, event, ev_link);
task = event->ev_sender;
event->ev_sender = fctx;
event->vresult = fctx->vresult;
if (!HAVE_ANSWER(fctx))
event->result = result;
@ -3889,6 +3890,7 @@ validated(isc_task_t *task, isc_event_t *event) {
REQUIRE(!ISC_LIST_EMPTY(fctx->validators));
vevent = (dns_validatorevent_t *)event;
fctx->vresult = vevent->result;
FCTXTRACE("received validation completion event");
@ -7151,6 +7153,7 @@ dns_resolver_create(dns_view_t *view,
return (result);
}
#ifdef BIND9
static void
prime_done(isc_task_t *task, isc_event_t *event) {
dns_resolver_t *res;
@ -7256,6 +7259,7 @@ dns_resolver_prime(dns_resolver_t *res) {
}
}
}
#endif /* BIND9 */
void
dns_resolver_freeze(dns_resolver_t *res) {

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdb.c,v 1.69 2009/06/26 06:21:02 marka Exp $ */
/* $Id: sdb.c,v 1.70 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -450,7 +450,7 @@ getnode(dns_sdballnodes_t *allnodes, const char *name, dns_sdbnode_t **nodep) {
isc_buffer_init(&b, name, strlen(name));
isc_buffer_add(&b, strlen(name));
result = dns_name_fromtext(newname, &b, origin, ISC_FALSE, NULL);
result = dns_name_fromtext(newname, &b, origin, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);

View file

@ -50,7 +50,7 @@
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdlz.c,v 1.21 2009/06/26 06:21:03 marka Exp $ */
/* $Id: sdlz.c,v 1.22 2009/09/01 00:22:26 jinmei Exp $ */
/*! \file */
@ -1620,7 +1620,7 @@ dns_sdlz_putnamedrr(dns_sdlzallnodes_t *allnodes, const char *name,
isc_buffer_init(&b, name, strlen(name));
isc_buffer_add(&b, strlen(name));
result = dns_name_fromtext(newname, &b, origin, ISC_FALSE, NULL);
result = dns_name_fromtext(newname, &b, origin, 0, NULL);
if (result != ISC_R_SUCCESS)
return (result);

Some files were not shown because too many files have changed in this diff Show more