dighost.c revision 7fe4b0447fb3ef0c8ff9851624a7bca072732973
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Copyright (C) 2000-2003 Internet Software Consortium.
7e4d75a5daeaaf8a7f559f9bd7fbf540184e235cMark Andrews * Permission to use, copy, modify, and/or distribute this software for any
7e4d75a5daeaaf8a7f559f9bd7fbf540184e235cMark Andrews * purpose with or without fee is hereby granted, provided that the above
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
15a44745412679c30a6d022733925af70a38b715David Lawrence * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15a44745412679c30a6d022733925af70a38b715David Lawrence * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15a44745412679c30a6d022733925af70a38b715David Lawrence * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15a44745412679c30a6d022733925af70a38b715David Lawrence * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PERFORMANCE OF THIS SOFTWARE.
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson/* $Id: dighost.c,v 1.328 2009/11/10 17:27:40 each Exp $ */
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Notice to programmers: Do not use this code as an example of how to
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * use the ISC library to perform DNS lookups. Dig and Host both operate
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * on the request level, since they allow fine-tuning of output and are
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * intended as debugging tools. As a result, they perform many of the
37d266d288410d1ead241c02a8a1dbcb0160be46Michael Graff * functions which could be better handled using the dns_resolver
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley * functions in most applications.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsunsigned int timeout = 0;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsstatic void initialize_idn(void);
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrencestatic isc_result_t output_filter(isc_buffer_t *buffer,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsstatic idn_result_t append_textname(char *name, const char *origin,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsstatic void idn_check_result(idn_result_t r, const char *msg);
efe2f579ba6fbec4229129015780f2d925085b04Michael Graff * Exit Codes:
6add3af8397580475ab9fa10ac8c1269465cff87Mark Andrews *\li 0 Everything went well, including things like NXDOMAIN
6add3af8397580475ab9fa10ac8c1269465cff87Mark Andrews *\li 1 Usage error
6add3af8397580475ab9fa10ac8c1269465cff87Mark Andrews *\li 7 Got too many RR's or Names
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellington *\li 8 Couldn't open batch file
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews *\li 9 No reply from server
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews *\li 10 Internal error
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrewsunsigned int digestbits = 0;
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrewsdns_rdataset_t * sigchase_scanname(dns_rdatatype_t type,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsdns_rdataset_t * chase_scanname_section(dns_message_t *msg,
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrewsisc_result_t advanced_rrsearch(dns_rdataset_t **rdataset,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsisc_result_t sigchase_verify_sig_key(dns_name_t *name,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsisc_result_t sigchase_verify_sig(dns_name_t *name,
03084608809afbaf570093a14d2dc4ad507336a0Brian Wellingtonisc_result_t sigchase_verify_ds(dns_name_t *name,
af9cfbc64363b61aa5903dd916e9fbc152084d4cMark Andrewsvoid print_rdata(dns_rdata_t *rdata, isc_mem_t *mctx);
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrewsvoid dup_name(dns_name_t *source, dns_name_t* target,
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrencevoid free_name(dns_name_t *name, isc_mem_t *mctx);
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrencevoid dump_database_section(dns_message_t *msg, int section);
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrencedns_rdataset_t * search_type(dns_name_t *name, dns_rdatatype_t type,
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrenceisc_result_t contains_trusted_key(dns_name_t *name,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsisc_result_t prove_nx_domain(dns_message_t * msg,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsisc_result_t prove_nx_type(dns_message_t * msg, dns_name_t *name,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsisc_result_t prove_nx(dns_message_t * msg, dns_name_t * name,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsstatic void nameFromString(const char *str, dns_name_t *p_ret);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsint inf_name(dns_name_t * name1, dns_name_t * name2);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsisc_result_t opentmpkey(isc_mem_t *mctx, const char *file,
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrenceisc_result_t removetmpkey(isc_mem_t *mctx, const char *file);
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrenceisc_result_t initialization(dns_name_t *name);
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrenceisc_result_t prepare_lookup(dns_name_t *name);
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrenceisc_result_t grandfather_pb_test(dns_name_t * zone_name,
171d0db7f93bf796f870713d6208b21893401cfcBrian Wellington * the current name is the parent name when we follow delegation
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * the child name is used for delegation (NS DS responses in AUTHORITY section)
03084608809afbaf570093a14d2dc4ad507336a0Brian WellingtonISC_LIST(dig_message_t) chase_message_list2;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsstruct_tk_list tk_list = { {NULL, NULL, NULL, NULL, NULL}, 0};
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Apply and clear locks at the event level in global task.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Can I get rid of these using shutdown events? XXX
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews debug("lock_lookup %s:%d", __FILE__, __LINE__);\
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews check_result(isc_mutex_lock((&lookup_lock)), "isc_mutex_lock");\
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews debug("unlock_lookup %s:%d", __FILE__, __LINE__);\
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews check_result(isc_mutex_unlock((&lookup_lock)),\
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrews "isc_mutex_unlock");\
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsrecv_done(isc_task_t *task, isc_event_t *event);
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrewsconnect_timeout(isc_task_t *task, isc_event_t *event);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewslaunch_next_query(dig_query_t *query, isc_boolean_t include_question);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsstatic void *
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrence while (*s != '\0') {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews if (*s == '.')
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews unsigned int len, i;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Append 'len' bytes of 'text' at '*p', failing with
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * ISC_R_NOSPACE if that would advance p past 'end'.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsappend(const char *text, int len, char **p, char *end) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsreverse_octets(const char *in, char **p, char *end) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsget_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews r = inet_pton(AF_INET6, value, &addr.type.in6);
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence /* This is a valid IPv6 address. */
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews unsigned int options = 0;
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence result = dns_byaddr_createptrname2(&addr, options, name);
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence * Not a valid IPv6 address. Assume IPv4.
ed71ea51c6ecb5d7d659b6e6a20f6b3f5c2678c6David Lawrence * If 'strict' is not set, construct the
ed019cabc1cc75d4412010c331876e4ae5080a4dDavid Lawrence * in-addr.arpa name by blindly reversing
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * octets whether or not they look like integers,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * so that this can be used for RFC2317 names
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews if (strict && inet_pton(AF_INET, value, &addr.type.in) != 1)
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews /* Append .in-addr.arpa. and a terminating NUL. */
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrews result = append(".in-addr.arpa.", 15, &p, end);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewscheck_result(isc_result_t result, const char *msg) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews fatal("%s: %s", msg, isc_result_totext(result));
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Create a server structure, which is part of the lookup structure.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * This is little more than a linked list of servers to query in hopes
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * of finding the answer the user is looking for
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsmake_server(const char *servname, const char *userarg) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews srv = isc_mem_allocate(mctx, sizeof(struct dig_server));
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Create a copy of the server list from the lwres configuration structure.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * The dest list must have already had ISC_LIST_INIT applied.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewscopy_server_list(lwres_conf_t *confdata, dig_serverlist_t *dest) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrence af = addr2af(confdata->nameservers[i].family);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews lwres_net_ntop(af, confdata->nameservers[i].address,
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews while (s != NULL) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews for (i = 0; i < count; i++) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsadd_nameserver(lwres_conf_t *confdata, const char *addr, int af) {
1a03b5e68553c37e9cc0097368909dfc37fb8cefMark Andrews if (confdata->nsnext >= LWRES_CONFMAXNAMESERVERS)
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews confdata->nameservers[i].family = LWRES_ADDRTYPE_V4;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews confdata->nameservers[i].family = LWRES_ADDRTYPE_V6;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews confdata->nameservers[i].length = NS_IN6ADDRSZ;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews if (lwres_net_pton(af, addr, &confdata->nameservers[i].address) == 1) {
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrence * Produce a cloned server list. The dest list must have already had
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrence * ISC_LIST_INIT applied.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrewsclone_server_list(dig_serverlist_t src, dig_serverlist_t *dest) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews newsrv = make_server(srv->servername, srv->userarg);
88ed7381f16a72409061875ddeda598f477e5ef6Michael Graff * Create an empty lookup structure, which holds all the information needed
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * to get an answer to a user's question. This structure contains two
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * linked lists: the server list (servers to query) and the query list
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * (outstanding queries which have been made to the listed servers).
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews looknew = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrence looknew->rdtype_sigchase = dns_rdatatype_any;
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson * Clone a lookup, perhaps copying the server list. This does not clone
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * the query list, since it will be regenerated by the setup_lookup()
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * function, nor does it queue up the new lookup for processing.
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * Caution: If you don't clone the servers, you MUST clone the server
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews * list separately from somewhere else, or construct it by hand.
ca81c3971cd0c9cfd830c0a18289d4d1b0f9de01David Lawrenceclone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews strncpy(looknew->textname, lookold->textname, MXNAME);
d736db6dc53e615e3f2d66d1ddbe28473694d107Michael Graff strncpy(looknew->textnamesigchase, lookold->textnamesigchase, MXNAME);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews strncpy(looknew->cmdline, lookold->cmdline, MXNAME);
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews looknew->identify_previous_line = lookold->identify_previous_line;
7d2b275f7e9238e2c709737601f6260b5a9a4ee1Mark Andrews looknew->servfail_stops = lookold->servfail_stops;
if (servers)
return (looknew);
return (looknew);
setup_text_key(void) {
int secretsize;
unsigned char *secretstore;
goto failure;
goto failure;
const char *desc) {
isc_uint32_t n;
return (result);
*uip = n;
return (ISC_R_SUCCESS);
static isc_uint32_t
return (tmp);
int len;
digestbits = 0;
digestbits = 0;
* Get a key from a named.conf format keyfile
static isc_result_t
read_confkey(void) {
const char *keyname;
const char *secretstr;
const char *algorithm;
return (ISC_R_FILENOTFOUND);
goto cleanup;
&file);
goto cleanup;
goto cleanup;
return (result);
setup_file_key(void) {
&dstkey);
goto failure;
case DST_ALG_HMACMD5:
case DST_ALG_HMACSHA1:
case DST_ALG_HMACSHA224:
case DST_ALG_HMACSHA256:
case DST_ALG_HMACSHA384:
case DST_ALG_HMACSHA512:
goto failure;
goto failure;
static dig_searchlist_t *
return (search);
* Setup the system as a whole, reading key information and resolv.conf
setup_system(void) {
unsigned int lwresflags;
if (have_ipv4)
if (have_ipv6)
/* If user doesn't specify server use nameservers from resolv.conf. */
if (have_ipv4) {
if (have_ipv6) {
#ifdef WITH_IDN
if (keyfile[0] != 0)
else if (keysecret[0] != 0)
#ifdef DIG_SIGCHASE
#if DIG_SIGCHASE_TD
#if DIG_SIGCHASE_BU
clear_searchlist(void) {
* Override the search list derived from resolv.conf by 'domain'.
setup_libs(void) {
if (dnssec)
if (nsid) {
* part of dig.c, host.c, or nslookup.c) to either shutdown the system as
check_if_done(void) {
sendcount == 0) {
link);
link);
sockcount--;
static isc_boolean_t
dig_query_t *q;
if (debugging) {
while (q != NULL) {
return (ISC_FALSE);
return (ISC_TRUE);
dig_server_t *s;
void *ptr;
while (s != NULL) {
ptr = s;
start_lookup(void) {
if (cancel_now)
#if DIG_SIGCHASE_TD
isc_region_t r;
goto novalidation;
goto novalidation;
ISC_FALSE, b);
isc_buffer_usedregion(b, &r);
MXNAME);
isc_buffer_free(&b);
&chase_name);
start_lookup();
int numLookups = 0;
0, &rdataset);
&rdataset);
unsigned int nlabels;
int order;
if (!horizontal)
if (!bad)
numLookups++;
if (!success) {
isc_uint32_t i, j;
for (i = numLookups; i > 0; i--) {
isc_random_get(&j);
return (numLookups);
static isc_boolean_t
if (!usesearch)
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
int len;
isc_buffer_t b;
#ifdef WITH_IDN
#ifdef WITH_IDN
lookup_counter = 0;
#ifdef WITH_IDN
* is TRUE or we got a domain line in the resolv.conf file.
#ifdef WITH_IDN
#ifdef WITH_IDN
sizeof(utf8_origin));
sizeof(utf8_textname));
#ifdef WITH_IDN
dns_rootname, 0,
dns_rootname, 0,
DNS_SECTION_QUESTION, 0);
extrabytes = 0;
ISC_TRUE);
dig_lookup_t *l;
sendcount--;
b != NULL;
dig_lookup_t *l;
unsigned int local_timeout;
if (timeout == 0)
l, &l->timer);
connect_timeout, l,
sizeof(isc_event_t));
dig_lookup_t *l;
if (specified_source &&
sockcount++;
if (specified_source)
sockcount++;
if (specified_source) {
link);
recvcount++;
sendcount++;
if (!l->tcp_mode)
if (!l->tcp_mode) {
l->retries--;
l->retries);
l->retries--;
cancel_lookup(l);
cancel_lookup(l);
dig_lookup_t *l;
recvcount--;
sizeof(sockstr));
sockcount--;
if (length == 0) {
recvcount++;
dig_lookup_t *l;
sockcount--;
if (include_question)
recvcount++;
sendcount++;
dig_lookup_t *l;
sockcount--;
sockcount--;
static isc_boolean_t
return (ISC_TRUE);
&name);
return (ISC_TRUE);
goto next_rdata;
goto next_rdata;
goto doexit;
goto next_rdata;
goto doexit;
goto doexit;
goto next_rdata;
goto doexit;
goto next_rdata;
goto doexit;
return (ISC_FALSE);
return (ISC_TRUE);
#ifdef DIG_SIGCHASE
dig_lookup_t *n, *l;
unsigned int parseflags;
unsigned int msgflags;
#ifdef DIG_SIGCHASE
isc_region_t r;
recvcount--;
sockcount--;
if (!l->tcp_mode &&
sizeof(buf1));
sizeof(buf2));
if (l->tcp_mode) {
if (fail) {
if (!match)
goto udp_mismatch;
&l->querysig);
if (l->msgcounter != 0)
l->msgcounter++;
#ifdef DIG_SIGCHASE
if (!l->sigchase) {
parseflags = 0;
if (l->besteffort) {
hex_dump(b);
cancel_lookup(l);
&name);
sizeof(namestr));
sizeof(typebuf));
sizeof(classbuf));
if (!match) {
if (l->tcp_mode) {
goto udp_mismatch;
cancel_lookup(l);
if (l->tcp_mode)
unsigned int local_timeout;
if (timeout == 0) {
if (l->tcp_mode)
NULL,
&l->interval,
#ifdef DIG_SIGCHASE
if (!do_sigchase)
} else if (l->trace) {
if (!l->ns_search_only)
if (!l->trace_root)
} else if (count == 0)
if (l->trace_root) {
#ifdef DIG_SIGCHASE
if (!do_sigchase)
#ifdef DIG_SIGCHASE
if (do_sigchase) {
sizeof(dig_message_t));
link);
isc_buffer_usedregion(b, &r);
sizeof(dig_message_t));
link);
#ifdef DIG_SIGCHASE
if (l->pending)
if (l->doing_xfr) {
if (!docancel)
if (docancel) {
cancel_lookup(l);
#ifdef DIG_SIGCHASE
if (!l->sigchase)
#ifdef DIG_SIGCHASE
if (!do_sigchase)
cancel_lookup(l);
#ifdef DIG_SIGCHASE
if (do_sigchase)
recvcount++;
int count;
return (result);
return (ISC_R_SUCCESS);
start_lookup();
cancel_all(void) {
dig_lookup_t *l, *n;
if (free_now) {
while (q != NULL) {
q, current_lookup);
clear_query(q);
q = nq;
while (l != NULL) {
try_clear_lookup(l);
destroy_libs(void) {
#ifdef DIG_SIGCHASE
void * ptr;
#ifdef WITH_IDN
#ifdef WITH_IDN
if (is_dst_up) {
#ifdef DIG_SIGCHASE
#if DIG_SIGCHASE_TD
#if DIG_SIGCHASE_BU
if (memdebugging != 0)
#ifdef WITH_IDN
initialize_idn(void) {
idn_result_t r;
#ifdef HAVE_SETLOCALE
if (r != idn_success)
idn_result_tostring(r));
static isc_result_t
return (ISC_R_SUCCESS);
fromlen++;
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
tolen--;
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static idn_result_t
return idn_success;
return idn_buffer_overflow;
return idn_success;
if (r != idn_success) {
#ifdef DIG_SIGCHASE
isc_region_t r;
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
dump_database(void) {
== ISC_R_SUCCESS)
== ISC_R_SUCCESS)
== ISC_R_SUCCESS)
return (rdataset);
return (rdataset);
return (rdataset);
return (NULL);
int section)
return (rdataset);
return (NULL);
== ISC_R_SUCCESS)
return (rdataset);
== ISC_R_SUCCESS)
rdataset =
return (rdataset);
== ISC_R_SUCCESS)
rdataset =
return (rdataset);
return (NULL);
isc_region_t r;
return (temp);
return (NULL);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
return (NULL);
return (NULL);
for (i= 0; i < MAX_TRUSTED_KEY; i++) {
char alphnum[] =
int tempnamekeylen;
return (ISC_R_NOMEMORY);
return (result);
int tempnamelen;
int tempnamekeylen;
char *cp;
return (ISC_R_NOMEMORY);
goto cleanup;
cp++;
return (ISC_R_FAILURE);
x = cp--;
x = cp--;
return (ISC_R_NOMEMORY);
return (ISC_R_FAILURE);
*fp = f;
return (ISC_R_SUCCESS);
return (result);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
filename);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
#if DIG_SIGCHASE_TD
dig_server_t *s;
void *ptr;
while (s != NULL) {
s, lookup);
ptr = s;
#define __FOLLOW_GLUE__
#ifdef __FOLLOW_GLUE__
isc_region_t r;
#ifdef __FOLLOW_GLUE__
dns_rdatatype_any, &true);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
dns_rdatatype_any, &true);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
dns_rdata_reset(&a);
return (ISC_R_SUCCESS);
int orderp;
unsigned int nlabelsp;
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
dns_rdatatype_any, &true);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
isc_region_t r;
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
return (ISC_R_FAILURE);
== ISC_TRUE) {
mctx)
== ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
return (result);
return (ISC_R_NOTFOUND);
return (result);
&newdsrdata) == 0) {
mctx);
return (result);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
if (tmplookedup)
return (ISC_R_FAILURE);
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
#if DIG_SIGCHASE_TD
== ISC_R_SUCCESS) {
have_answer = true;
&name);
if (have_answer) {
goto cleanandgo;
goto cleanandgo;
if (!delegation_follow) {
mctx);
mctx);
goto cleanandgo;
if (have_response) {
goto cleanandgo;
goto cleanandgo;
&tmp_name);
if (have_response)
goto finalstep;
if (have_delegation_ns) {
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
goto cleanandgo;
#if DIG_SIGCHASE_BU
!= ISC_R_SUCCESS) {
return (ISC_R_ADDRNOTAVAIL);
dns_rdatatype_any, &true);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
return (ISC_R_NOTFOUND);
dns_rdatatype_ds, &true);
mctx);
int ret;
#if DIG_SIGCHASE_TD
#if DIG_SIGCHASE_BU
unsigned int nblabel1;
unsigned int nblabel2;
int min_lum_label;
if (ret < 0)
else if (ret > 0)
!= ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ISC_R_SUCCESS);
== ISC_R_SUCCESS);
return (ISC_R_FAILURE);
return (ISC_R_FAILURE);
return (ret);
!= ISC_R_SUCCESS) {
return (ISC_R_FAILURE);
return (ret);
return (ISC_R_SUCCESS);
return (ret);