dighost.c revision 6bc106bb7ed216ca3a86245181ea8e2b0b658a64
b7b6b01a0d0622181a4c28dd60401f0ab2480d00Mark Andrews * Copyright (C) 2000 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * purpose with or without fee is hereby granted, provided that the above
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews/* $Id: dighost.c,v 1.57 2000/06/23 20:57:19 mws Exp $ */
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * Notice to programmers: Do not use this code as an example of how to
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * use the ISC library to perform DNS lookups. Dig and Host both operate
f80ea74e1984e0b1dbe48dd86ecdd3a2380393cbBob Halley * on the request level, since they allow fine-tuning of output and are
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * intended as debugging tools. As a result, they perform many of the
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * functions which could be better handled using the dns_resolver
fc8a6561cbb0a1fea849950a3217aacd3b8f1eacDavid Lawrence * functions in most applications.
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson#if defined(HAVE_ADDRINFO) && defined(HAVE_GETADDRINFO)
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafssonisc_boolean_t have_ipv6 = ISC_FALSE, specified_source = ISC_FALSE,
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein free_now = ISC_FALSE, show_details = ISC_FALSE, usesearch=ISC_TRUE,
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein while (*s != 0) {
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence if (*s == '.')
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson printf("Printing a buffer with length %d\n", r.length);
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrewscheck_result(isc_result_t result, const char *msg) {
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews fatal("%s: %s", msg, isc_result_totext(result));
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews /* Tests if a field is a class, without needing isc libs
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews * initialized. This list will have to be manually kept in
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews * sync with what the libs support.
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews const char *classlist[] = {"in", "hs", "chaos"};
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews for (i = 0; i < numclasses; i++)
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews /* Tests if a field is a type, without needing isc libs
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews * initialized. This list will have to be manually kept in
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews * sync with what the libs support.
261a6a1f7d95eaf0cd882f3123dcfd775517a54fMark Andrews const char *typelist[] = {"a", "ns", "md", "mf", "cname",
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington for (i = 0; i < numtypes; i++) {
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson for (i=0;i<tw;i++) {
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington*requeue_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington fatal ("Memory allocation failure in %s:%d",
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington strncpy (looknew->textname, lookold-> textname, MXNAME);
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington strncpy (looknew->rttext, lookold-> rttext, 32);
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington strncpy (looknew->rctext, lookold-> rctext, 32);
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington looknew->ixfr_serial = lookold->ixfr_serial;
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson looknew->trace_root = lookold->trace_root;
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson looknew->ns_search_only = lookold->ns_search_only;
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson looknew->section_question = lookold->section_question;
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson looknew->section_answer = lookold->section_answer;
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson looknew->section_authority = lookold->section_authority;
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington looknew->section_additional = lookold->section_additional;
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington looknew->use_my_server_list = lookold->use_my_server_list;
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington s = ISC_LIST_HEAD(lookold->my_server_list);
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington while (s != NULL) {
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington srv = isc_mem_allocate (mctx, sizeof(struct
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson ISC_LIST_ENQUEUE(looknew->my_server_list, srv,
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson "-> %lx, new@%lx "
ed04318ef686581fc9a20965a5be02abfb4f1bd5Andreas Gustafsson ISC_LIST_INSERTAFTER(lookup_list, lookold, looknew, link);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews "%lx, new = %lx, "
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington unsigned char *secretstore;
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington debug("Using fixed domain %s", fixeddomain);
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington search = isc_mem_allocate( mctx, sizeof(struct dig_server));
5e387b9ce6bafdfadedb5b34e4c33a4404e5d589Brian Wellington fatal("Memory allocation failure in %s:%d",
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence strncpy(search->origin, fixeddomain, MXNAME - 1);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson get_servers = ISC_TF(server_list.head == NULL);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson while (fgets(rcinput, MXNAME, fp) != 0) {
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson sizeof(struct dig_server));
1f1d36a87b65186d9f89aac7f456ab1fd2a39ef6Andreas Gustafsson } else if ((strcasecmp(ptr, "search") == 0)
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence mctx, sizeof(struct
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence "failure in %s:"
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson } else if ((strcasecmp(ptr, "domain") == 0) &&
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson mctx, sizeof(struct
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson "failure in %s:"
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington srv = isc_mem_allocate(mctx, sizeof(dig_server_t));
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson l -> origin = ISC_LIST_HEAD(search_list);
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington result = dns_tsigkeyring_create(mctx, &keyring);
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington check_result(result, "dns_tsigkeyring_create");
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = isc_buffer_allocate(mctx, &namebuf, MXNAME);
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington check_result(result, "isc_buffer_allocate");
f0e246e271f84c6fe960a3c36703a56d1067431cBrian Wellington isc_buffer_init(&secretsrc, keysecret, strlen(keysecret));
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson isc_buffer_add(&secretsrc, strlen(keysecret));
8f79820c6930ee5ef6b4a54f36d2559400bdf47dAndreas Gustafsson isc_buffer_init(&secretbuf, secretstore, secretsize);
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence result = isc_lex_create(mctx, strlen(keysecret), &lex);
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence result = isc_lex_openbuffer(lex, &secretsrc);
8f79820c6930ee5ef6b4a54f36d2559400bdf47dAndreas Gustafsson check_result(result, "isc_lex_openbuffer");
618a5e4923c3d064c1cc0f1866e27e8ddca90700Andreas Gustafsson result = isc_base64_tobuffer(lex, &secretbuf, -1);
618a5e4923c3d064c1cc0f1866e27e8ddca90700Andreas Gustafsson printf (";; Couldn't create key %s: %s\n",
8f79820c6930ee5ef6b4a54f36d2559400bdf47dAndreas Gustafsson secretsize = isc_buffer_usedlength(&secretbuf);
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence result = dns_name_fromtext(&keyname, namebuf,
1f1d36a87b65186d9f89aac7f456ab1fd2a39ef6Andreas Gustafsson printf (";; Couldn't create key %s: %s\n",
1f1d36a87b65186d9f89aac7f456ab1fd2a39ef6Andreas Gustafsson result = dns_tsigkey_create(&keyname, dns_tsig_hmacmd5_name,
8f79820c6930ee5ef6b4a54f36d2559400bdf47dAndreas Gustafsson printf (";; Couldn't create key %s: %s\n",
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * Warning: This is not particularly good randomness. We'll
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * just use random() now for getting id values, but doing so
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson * does NOT insure that id's cann't be guessed.
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson check_result(result, "isc_net_probeipv4");
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson result = isc_taskmgr_create (mctx, 1, 0, &taskmgr);
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson check_result(result, "isc_taskmgr_create");
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson result = isc_task_create (taskmgr, 0, &global_task);
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson result = isc_timermgr_create (mctx, &timermgr);
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson result = isc_socketmgr_create (mctx, &socketmgr);
8f79820c6930ee5ef6b4a54f36d2559400bdf47dAndreas Gustafsson check_result(result, "isc_socketmgr_create");
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = isc_entropy_create (mctx, &entp);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson check_result(result, "isc_entropy_create");
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrenceadd_opt (dns_message_t *msg, isc_uint16_t udpsize) {
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson result = dns_message_gettemprdataset(msg, &rdataset);
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson check_result (result, "dns_message_gettemprdataset");
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews result = dns_message_gettemprdatalist(msg, &rdatalist);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews check_result (result, "dns_message_gettemprdatalist");
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews result = dns_message_gettemprdata(msg, &rdata);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews check_result (result, "dns_message_gettemprdata");
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson dns_rdatalist_tordataset(rdatalist, rdataset);
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafssonadd_type(dns_message_t *message, dns_name_t *name, dns_rdataclass_t rdclass,
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafsson result = dns_message_gettemprdataset(message, &rdataset);
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafsson check_result(result, "dns_message_gettemprdataset()");
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson dns_rdataset_makequestion(rdataset, rdclass, rdtype);
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafsson ISC_LIST_APPEND(name->list, rdataset, link);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence debug("check_next_lookup(%lx)", (long int)lookup);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence debug ("Lookup %s pending", lookup->pending?"is":"is not");
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafssonfollowup_lookup(dns_message_t *msg, dig_query_t *query,
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafsson result = dns_message_firstname (msg,section);
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence (query->lookup->trace || query->lookup->ns_search_only))
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews followup_lookup (msg, query, DNS_SECTION_AUTHORITY);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews debug ("Following up %s", query->lookup->textname);
86a292d45977f1d8400df04b04bf659d9a5d68a1Andreas Gustafsson rdataset = ISC_LIST_NEXT(rdataset, link)) {
86a292d45977f1d8400df04b04bf659d9a5d68a1Andreas Gustafsson loopresult = dns_rdataset_first(rdataset);
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence "isc_buffer_allocate");
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence "dns_rdata_totext");
ce3c351d815569455892c30dc78d8c2e85ec1076Andreas Gustafsson /* Initialize lookup if we've not yet */
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence "failure in %s:%d",
f3083bc781333f6314a44cb19fe31fe17e59f26fDavid Lawrence result = dns_message_nextname (msg, section);
951c247f2923f667c5c97355b31dc564bd540bfeDavid Lawrence if ((lookup == NULL) && (section == DNS_SECTION_ANSWER) &&
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson (query->lookup->trace || query->lookup->ns_search_only))
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrencenext_origin(dns_message_t *msg, dig_query_t *query) {
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence debug ("Following up %s", query->lookup->textname);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence if (query->lookup->origin == NULL) { /*Then we just did rootorg;
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence there's nothing left. */
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence debug ("Made it to the root whith nowhere to go.");
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence lookup = requeue_lookup(query->lookup, ISC_TRUE);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence lookup->origin = ISC_LIST_NEXT(query->lookup->origin, link);
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence isc_buffer_init(&lookup->rdatabuf, lookup->rdatastore,
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafsson result = dns_message_gettemprdata(lookup->sendmsg, &rdata);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson check_result(result, "dns_message_gettemprdata");
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = dns_rdata_fromstruct(rdata, dns_rdataclass_in,
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson check_result(result, "isc_rdata_fromstruct");
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist);
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson check_result(result, "dns_message_gettemprdatalist");
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = dns_message_gettemprdataset(lookup->sendmsg, &rdataset);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews check_result(result, "dns_message_gettemprdataset");
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson ISC_LIST_APPEND(rdatalist->rdata, rdata, link);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence dns_rdatalist_tordataset(rdatalist, rdataset);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = dns_message_gettempname(lookup->sendmsg, &soaname);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson check_result(result, "dns_message_gettempname");
9b0e18da3d5c2290f90b285d122d368173f17c63Andreas Gustafsson ISC_LIST_APPEND(soaname->list, rdataset, link);
7618f0551eb745354ee695907e568b0be1f2c8f5Andreas Gustafsson dns_message_addname(lookup->sendmsg, soaname, DNS_SECTION_AUTHORITY);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson debug("setup_lookup(%lx)",(long int)lookup);
f991461dc144794d80ff8d85e430fd8a6e6113f3David Lawrence debug("Setting up for looking up %s @%lx->%lx",
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER,
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews result = dns_message_gettempname(lookup->sendmsg, &lookup->name);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews check_result(result, "dns_message_gettempname");
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews isc_buffer_init(&lookup->namebuf, lookup->namespace, BUFSIZE);
ce3c351d815569455892c30dc78d8c2e85ec1076Andreas Gustafsson isc_buffer_init(&lookup->onamebuf, lookup->onamespace, BUFSIZE);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews if ((count_dots(lookup->textname) >= ndots) || lookup->defname)
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews debug ("lookup->origin = %lx", (long int)lookup->origin);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews debug ("Trying origin %s", lookup->origin->origin);
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews result = dns_message_gettempname(lookup->sendmsg,
3a34b87c878990c6303358efd22265c2c5980c65Mark Andrews check_result(result, "dns_message_gettempname");
ed8daea26475309e1ac8ed8556b7d4ec8ae4432cDavid Lawrence isc_buffer_init(&b, lookup->origin->origin, len);
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence result = dns_name_fromtext(lookup->oname, &b, dns_rootname,
03609d0b8f6e458d6bd4b460f4eb3f7270f487efDavid Lawrence fatal("Aborting: %s is not a legal name syntax. (%s)",
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson fatal("Aborting: %s is not a legal name syntax. (%s)",
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson lookup->textname, dns_result_totext(result));
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence dns_message_puttempname(lookup->sendmsg, &lookup->oname);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson result = dns_name_fromtext(lookup->name, &b,
ed04318ef686581fc9a20965a5be02abfb4f1bd5Andreas Gustafsson res2 = dns_name_totext(dns_rootname, ISC_FALSE, &b);
ed04318ef686581fc9a20965a5be02abfb4f1bd5Andreas Gustafsson fatal("Aborting: %s/%.*s is not a legal name syntax. "
a928d619170d61da40c3bff29800ff73709140daAndreas Gustafsson (char *)r.base, dns_result_totext(result));
ed04318ef686581fc9a20965a5be02abfb4f1bd5Andreas Gustafsson dns_name_totext(lookup->name, ISC_FALSE, &b);
f951f076f3d321c52b824a866caff28ce4f8e06cAndreas Gustafsson trying((int)r.length, (char *)r.base, lookup);
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington debug ("This is a relative name (which is wrong).");
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington lookup->sendmsg->id = (unsigned short)(random() & 0xFFFF);
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington lookup->sendmsg->opcode = dns_opcode_query;
c20ffa38dee7efa0dc01822d4bac5e41729b9b61Brian Wellington * If this is a trace request, completely disallow recursion, since
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews * it's meaningless for traces.
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews if (lookup->recurse && !lookup->trace && !lookup->ns_search_only) {
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews dns_message_addname(lookup->sendmsg, lookup->name,
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews result = dns_rdatatype_fromtext(&rdtype, (isc_textregion_t *)&tr);
e90994e3f358bdc6fe03005da08567c807a14c1dMark Andrews check_result(result, "dns_rdatatype_fromtext");
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews * Force TCP mode if we're doing an xfr.
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews result = dns_rdataclass_fromtext(&rdclass, (isc_textregion_t *)&tr);
6c8abf481df85a67c3f32f5f107b554d3ff5a3edMark Andrews check_result(result, "dns_rdataclass_fromtext");
DNS_SECTION_QUESTION, 0);
ISC_TRUE);
sockcount--;
sendcount++;
#ifdef TWIDDLE
if (twiddle) {
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) {
#ifdef TWIDDLE
if (twiddle) {
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);
isc_buffer_t b;
isc_region_t r;
#ifdef NEVER
&name);
goto NEXT_RDATA;
&soa,
mctx);
goto XFR_DONE;
goto NEXT_RDATA;
goto NEXT_RDATA;
isc_buffer_usedregion(&b, &r);
goto NEXT_RDATA;
goto XFR_DONE;
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) &&
&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)
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--;
link);
link);
ptr = q;
if (l->use_my_server_list) {
while (s != NULL) {
ptr = s;
ptr = l;
while (s != NULL) {
ptr = s;
while (o != NULL) {
ptr = o;
if (is_dst_up) {
if (isc_mem_debugging)
if (_exitcode != 0)