dighost.c revision 0819ae2ca51571d205df061b52d8468889f3a0df
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington * Copyright (C) 2000 Internet Software Consortium.
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * Permission to use, copy, modify, and distribute this software for any
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * purpose with or without fee is hereby granted, provided that the above
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15a44745412679c30a6d022733925af70a38b715David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15a44745412679c30a6d022733925af70a38b715David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15a44745412679c30a6d022733925af70a38b715David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
f1b68725503ff3e46001eee5a1751e29a43a09d1Andreas Gustafsson/* $Id: dighost.c,v 1.70 2000/07/06 01:02:41 mws Exp $ */
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * Notice to programmers: Do not use this code as an example of how to
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * use the ISC library to perform DNS lookups. Dig and Host both operate
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * on the request level, since they allow fine-tuning of output and are
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * intended as debugging tools. As a result, they perform many of the
b24e559dee9f6eef29d78c8686e3e99e4c570086Michael Graff * functions which could be better handled using the dns_resolver
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff * functions in most applications.
f4ce616539dd81322fa4db9676f42ef2e0a19031Michael Graff#if (!(defined(HAVE_ADDRINFO) && defined(HAVE_GETADDRINFO)))
static isc_boolean_t
s = string;
unsigned int len;
isc_region_t r;
isc_buffer_remainingregion(b, &r);
if (exitcode == 0)
#ifdef NEVER
if (isc_mem_debugging)
if (debugging) {
for (i = 0; i < numclasses; i++)
return (ISC_TRUE);
return (ISC_FALSE);
for (i = 0; i < numtypes; i++) {
return (ISC_TRUE);
return (ISC_FALSE);
if (free_now)
return(ISC_R_SUCCESS);
if (servers) {
while (s != NULL) {
sizeof(struct dig_server));
MXNAME);
link);
return (looknew);
setup_system(void) {
char *ptr;
dig_lookup_t *l;
int secretsize;
unsigned char *secretstore;
if (fixeddomain[0] != 0) {
if (get_servers &&
sizeof(struct dig_server));
__LINE__);
ptr,
ndots);
&& usesearch){
!= NULL) {
mctx, sizeof(struct
dig_server));
__LINE__);
ptr,
link);
(fixeddomain[0] == 0 )){
!= NULL) {
mctx, sizeof(struct
dig_server));
__LINE__);
ptr,
link);
l != NULL;
if (keysecret[0] != 0) {
goto SYSSETUP_FAIL;
namebuf);
goto SYSSETUP_FAIL;
setup_libs(void) {
static isc_boolean_t
if (free_now)
return (ISC_TRUE);
if (still_working)
return (ISC_FALSE);
return (ISC_TRUE);
return (ISC_TRUE);
return (ISC_FALSE);
isc_region_t r;
int len;
if (free_now)
BUFSIZE);
NULL,
isc_buffer_usedregion(b, &r);
(char *)r.base);
if (!success) {
if (section ==
query->
query->
sizeof(struct dig_server));
isc_buffer_free(&b);
if (free_now)
MXNAME);
int len;
isc_region_t r;
isc_buffer_t b;
if (free_now)
lookup_counter = 0;
isc_buffer_usedregion(&b, &r);
isc_buffer_usedregion(&b, &r);
DNS_SECTION_QUESTION, 0);
ISC_TRUE);
static isc_boolean_t
sockcount--;
sendcount++;
isc_region_t r;
q != NULL;
if (q->working) {
if (!free_now) {
isc_buffer_clear(b);
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
isc_region_t r;
if (free_now) {
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
sockcount--;
length);
if (free_now)
sockcount--;
if (include_question) {
link);
sendcount++;
isc_region_t r;
if (free_now) {
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static isc_boolean_t
isc_buffer_t b;
isc_region_t r;
return (ISC_TRUE);
#ifdef NEVER
&name);
return (ISC_TRUE);
goto next_rdata;
&soa,
mctx);
goto xfr_done;
goto next_rdata;
goto next_rdata;
isc_buffer_usedregion(&b, &r);
return (ISC_TRUE);
goto next_rdata;
goto xfr_done;
return (ISC_FALSE);
isc_region_t r;
dig_lookup_t *n;
if (free_now) {
if (free_now) {
sendcount--;
&msg);
hex_dump(b);
if ((show_details ||
== ISC_R_SUCCESS))) &&
if (show_details) {
== ISC_R_SUCCESS) &&
if (docancel) {
&ab);
== ISC_R_SUCCESS) &&
(char *)r.base,
query);
int result;
if (result != 0) {
port);
sockcount++;
if (specified_source)
sockcount++;
if (specified_source)
start_lookup(void) {
if (free_now)
free_lists(void) {
void *ptr;
dig_lookup_t *l;
dig_query_t *q;
dig_server_t *s;
dig_searchlist_t *o;
if (free_now)
while (l != NULL) {
q = ISC_LIST_HEAD(l->q);
while (q != NULL) {
sockcount--;
while (s != NULL) {
ptr = s;
while (o != NULL) {
ptr = o;
while (l != NULL) {
q = ISC_LIST_HEAD(l->q);
while (q != NULL) {
link);
link);
ptr = q;
if (l->use_my_server_list) {
while (s != NULL) {
ptr = s;
ptr = l;
if (is_dst_up) {