From dc235a59431db02e1a04d85de49af9e278510ac8 Mon Sep 17 00:00:00 2001 From: erwin Date: Wed, 24 Jul 2013 07:12:55 +0000 Subject: Vendor import of Bind 9.8.5-P1 Approved by: delphij (mentor) Sponsored by: DK Hostmaster A/S --- bin/dig/dig.1 | 21 ++++++++---- bin/dig/dig.c | 27 ++++++++++++---- bin/dig/dig.docbook | 41 ++++++++++++++---------- bin/dig/dig.html | 64 ++++++++++++++++++++---------------- bin/dig/dighost.c | 82 +++++++++++++++++++++++++++++------------------ bin/dig/host.c | 18 ++++++++--- bin/dig/include/dig/dig.h | 4 ++- 7 files changed, 162 insertions(+), 95 deletions(-) (limited to 'bin/dig') diff --git a/bin/dig/dig.1 b/bin/dig/dig.1 index 6e3bfb6..6d8688e 100644 --- a/bin/dig/dig.1 +++ b/bin/dig/dig.1 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004-2010, 2013 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -57,7 +57,9 @@ allows multiple lookups to be issued from the command line. Unless it is told to query a specific name server, \fBdig\fR will try each of the servers listed in -\fI/etc/resolv.conf\fR. +\fI/etc/resolv.conf\fR. If no usable server addreses are found, +\fBdig\fR +will send the query to the local host. .PP When no command line arguments or options are given, \fBdig\fR @@ -95,13 +97,20 @@ is the name or IP address of the name server to query. This can be an IPv4 addre \fIserver\fR argument is a hostname, \fBdig\fR -resolves that name before querying that name server. If no +resolves that name before querying that name server. +.sp +If no \fIserver\fR argument is provided, \fBdig\fR consults -\fI/etc/resolv.conf\fR -and queries the name servers listed there. The reply from the name server that responds is displayed. +\fI/etc/resolv.conf\fR; if an address is found there, it queries the name server at that address. If either of the +\fB\-4\fR +or +\fB\-6\fR +options are in use, then only addresses for the corresponding transport will be tried. If no usable addresses are found, +\fBdig\fR +will send the query to the local host. The reply from the name server that responds is displayed. .RE .PP \fBname\fR @@ -567,7 +576,7 @@ RFC1035. .PP There are probably too many query options. .SH "COPYRIGHT" -Copyright \(co 2004\-2010 Internet Systems Consortium, Inc. ("ISC") +Copyright \(co 2004\-2010, 2013 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000\-2003 Internet Software Consortium. .br diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 5e5ec0f..ce9ccde 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -186,7 +186,7 @@ help(void) { " +domain=### (Set default domainname)\n" " +bufsize=### (Set EDNS0 Max UDP packet size)\n" " +ndots=### (Set NDOTS value)\n" -" +edns=### (Set EDNS version)\n" +" +[no]edns[=###] (Set EDNS version) [0]\n" " +[no]search (Set whether to use searchlist)\n" " +[no]showsearch (Search with intermediate results)\n" " +[no]defname (Ditto)\n" @@ -240,6 +240,8 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) { isc_uint64_t diff; isc_time_t now; time_t tnow; + struct tm tmnow; + char time_str[100]; char fromtext[ISC_SOCKADDR_FORMATSIZE]; isc_sockaddr_format(from, fromtext, sizeof(fromtext)); @@ -251,7 +253,10 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) { printf(";; Query time: %ld msec\n", (long int)diff/1000); printf(";; SERVER: %s(%s)\n", fromtext, query->servname); time(&tnow); - printf(";; WHEN: %s", ctime(&tnow)); + tmnow = *localtime(&tnow); + if (strftime(time_str, sizeof(time_str), + "%a %b %d %H:%M:%S %Z %Y", &tmnow) > 0U) + printf(";; WHEN: %s\n", time_str); if (query->lookup->doing_xfr) { printf(";; XFR size: %u records (messages %u, " "bytes %" ISC_PRINT_QUADFORMAT "u)\n", @@ -259,7 +264,6 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) { query->byte_count); } else { printf(";; MSG SIZE rcvd: %u\n", bytes); - } if (key != NULL) { if (!validated) @@ -276,7 +280,7 @@ received(int bytes, isc_sockaddr_t *from, dig_query_t *query) { "from %s(%s) in %d ms\n\n", query->lookup->doing_xfr ? query->byte_count : (isc_uint64_t)bytes, - fromtext, query->servname, + fromtext, query->userarg, (int)diff/1000); } } @@ -525,6 +529,13 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { printf(";; WARNING: recursion requested " "but not available\n"); } + if (msg != query->lookup->sendmsg && + query->lookup->edns != -1 && msg->opt == NULL && + (msg->rcode == dns_rcode_formerr || + msg->rcode == dns_rcode_notimp)) + printf("\n;; WARNING: EDNS query returned status " + "%s - retry with '+noedns'\n", + rcode_totext(msg->rcode)); if (msg != query->lookup->sendmsg && extrabytes != 0U) printf(";; WARNING: Messages has %u extra byte%s at " "end\n", extrabytes, extrabytes != 0 ? "s" : ""); @@ -855,8 +866,10 @@ plus_option(char *option, isc_boolean_t is_batchfile, lookup->edns = -1; break; } - if (value == NULL) - goto need_value; + if (value == NULL) { + lookup->edns = 0; + break; + } result = parse_uint(&num, value, 255, "edns"); if (result != ISC_R_SUCCESS) fatal("Couldn't parse edns"); diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook index d64d038..1285c43 100644 --- a/bin/dig/dig.docbook +++ b/bin/dig/dig.docbook @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []>