nslookup.c revision e32394a2ac3466a2235f79ee32c247a11be42a8d
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington * Copyright (C) 2000 Internet Software Consortium.
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * Permission to use, copy, modify, and distribute this software for any
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * purpose with or without fee is hereby granted, provided that the above
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff * copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
15a44745412679c30a6d022733925af70a38b715David Lawrence * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
15a44745412679c30a6d022733925af70a38b715David Lawrence * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
15a44745412679c30a6d022733925af70a38b715David Lawrence * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
15a44745412679c30a6d022733925af70a38b715David Lawrence * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15a44745412679c30a6d022733925af70a38b715David Lawrence * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15a44745412679c30a6d022733925af70a38b715David Lawrence * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
e61793f0865117ad87a19d6e245bea8f3b712d1bDanny Mayer/* $Id: nslookup.c,v 1.35 2000/08/15 18:44:05 gson Exp $ */
03a0fca86dd9db6a40743107ec9dea7c33e46a7aDavid Lawrenceextern ISC_LIST(dig_searchlist_t) search_list;
71811653336a000f6c61d26d4b2a0c0d2cec9c25Danny Mayerextern unsigned int timeout;
03a0fca86dd9db6a40743107ec9dea7c33e46a7aDavid Lawrenceisc_boolean_t short_form = ISC_TRUE, printcmd = ISC_TRUE,
03a0fca86dd9db6a40743107ec9dea7c33e46a7aDavid Lawrence tcpmode = ISC_FALSE, deprecation_msg = ISC_TRUE;
03a0fca86dd9db6a40743107ec9dea7c33e46a7aDavid Lawrence trace = ISC_FALSE, ns_search_only = ISC_FALSE,
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff comments = ISC_TRUE, section_question = ISC_TRUE,
01933e930208da3291de3722cb0d0787636b1e4fMichael Graff section_answer = ISC_TRUE, section_authority = ISC_TRUE,
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff section_additional = ISC_TRUE, recurse = ISC_TRUE,
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffisc_boolean_t busy = ISC_FALSE, in_use = ISC_FALSE;
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellingtonstatic const char *rcodetext[] = {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff "RESERVED11",
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff "RESERVED12",
8cd870e3f5e3db9808a4a0d6f98db3d1a5348e40Michael Graff "RESERVED13",
8cd870e3f5e3db9808a4a0d6f98db3d1a5348e40Michael Graff "RESERVED14",
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graff "RESERVED15",
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffstatic const char *rtypetext[] = {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Graffreceived(int bytes, int frmsize, char *frm, dig_query_t *query) {
64bed6c54393c2d213db83e9b171fb7c318cfc8eMichael Grafftrying(int frmsize, char *frm, dig_lookup_t *lookup) {
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrenceprintsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
3c0a81897768d0378813865278a49d285c95b8b8Brian Wellington result = dns_message_firstname(msg, section);
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellington result = isc_buffer_allocate(mctx, &b, MXNAME);
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellington check_result(result, "isc_buffer_allocate");
5b34d8267e8228b4615b9eae4e32d9ad1f308179Andreas Gustafsson for (rdataset = ISC_LIST_HEAD(name->list);
5b34d8267e8228b4615b9eae4e32d9ad1f308179Andreas Gustafsson rdataset = ISC_LIST_NEXT(rdataset, link)) {
5b34d8267e8228b4615b9eae4e32d9ad1f308179Andreas Gustafsson loopresult = dns_rdataset_first(rdataset);
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellington "dns_name_totext");
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellington "dns_rdata_totext");
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graff "dns_name_totext");
7dbf5a0b64237aa3052f04f4c8f7d56be8ec5d79Michael Graff "dns_rdata_totext");
7bee275ebe250b5e1705a997e2ee3e685d146fbdAndreas Gustafsson ((char *)isc_buffer_used(b))[0]=0;
7bee275ebe250b5e1705a997e2ee3e685d146fbdAndreas Gustafsson "dns_name_totext");
7bee275ebe250b5e1705a997e2ee3e685d146fbdAndreas Gustafsson "dns_rdata_totext");
8f80322fb58bac39c84bb76cb2bc82406bd6a9ecBrian Wellington result = dns_message_nextname(msg, section);
01933e930208da3291de3722cb0d0787636b1e4fMichael Graffdetailsection(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers,
b91bbaf50cf6d0c2cad7323720495165595e413bMichael Graff result = isc_buffer_allocate(mctx, &b, MXNAME);
7bee275ebe250b5e1705a997e2ee3e685d146fbdAndreas Gustafsson for (rdataset = ISC_LIST_HEAD(name->list);
isc_buffer_clear(b);
(int)isc_buffer_usedlength(b),
(char*)isc_buffer_base(b));
case dns_rdatatype_soa:
isc_buffer_clear(b);
NULL,
((char *)isc_buffer_used(b))[0]=0;
ptr);
ptr);
ptr);
ptr);
ptr);
ptr);
ptr);
isc_buffer_clear(b);
isc_buffer_clear(b);
NULL, b);
(int)isc_buffer_usedlength(b),
(char*)isc_buffer_base(b));
isc_buffer_free (&b);
return (result);
isc_buffer_free(&b);
return (ISC_R_SUCCESS);
isc_region_t r;
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
return (ISC_R_SUCCESS);
(char*)isc_buffer_base(b));
isc_buffer_free(&b);
if (!short_form){
return (ISC_R_SUCCESS);
(char*)isc_buffer_base(b));
isc_buffer_free(&b);
if (!full)
static isc_boolean_t
static isc_boolean_t
static dig_lookup_t*
return (lookup);
flush_server_list(void) {
while (s != NULL) {
ps = s;
get_next_command(void) {
show_usage();
if (!have_lookup) {
flush_lookup_list(void) {
lookup_counter = 0;
while (l != NULL) {
q = ISC_LIST_HEAD(l->q);
while (q != NULL) {
link);
link);
qp = q;
while (s != NULL) {
sp = s;
lp = l;
setup_libs();
if (deprecation_msg) {
setup_system();
if (in_use) {
start_lookup();
while (busy) {
while (in_use) {
start_lookup();
while (busy) {
destroy_libs();
if (isc_mem_debugging != 0)