summaryrefslogtreecommitdiffstats
path: root/bin/dig
diff options
context:
space:
mode:
authorerwin <erwin@FreeBSD.org>2013-07-24 07:12:55 +0000
committererwin <erwin@FreeBSD.org>2013-07-24 07:12:55 +0000
commitdc235a59431db02e1a04d85de49af9e278510ac8 (patch)
treee392027bf54f7a1fd2a6f3a16ecb4487844b44e9 /bin/dig
parent9ef4e0591273b7d40b98ef46084442638150b2fc (diff)
downloadFreeBSD-src-dc235a59431db02e1a04d85de49af9e278510ac8.zip
FreeBSD-src-dc235a59431db02e1a04d85de49af9e278510ac8.tar.gz
Vendor import of Bind 9.8.5-P1
Approved by: delphij (mentor) Sponsored by: DK Hostmaster A/S
Diffstat (limited to 'bin/dig')
-rw-r--r--bin/dig/dig.121
-rw-r--r--bin/dig/dig.c27
-rw-r--r--bin/dig/dig.docbook41
-rw-r--r--bin/dig/dig.html64
-rw-r--r--bin/dig/dighost.c82
-rw-r--r--bin/dig/host.c18
-rw-r--r--bin/dig/include/dig/dig.h4
7 files changed, 162 insertions, 95 deletions
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"
[<!ENTITY mdash "&#8212;">]>
<!--
- - 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
@@ -45,6 +45,7 @@
<year>2008</year>
<year>2009</year>
<year>2010</year>
+ <year>2013</year>
<holder>Internet Systems Consortium, Inc. ("ISC")</holder>
</copyright>
<copyright>
@@ -116,9 +117,10 @@
<para>
Unless it is told to query a specific name server,
- <command>dig</command> will try each of the servers listed
- in
- <filename>/etc/resolv.conf</filename>.
+ <command>dig</command> will try each of the servers listed in
+ <filename>/etc/resolv.conf</filename>. If no usable server addreses
+ are found, <command>dig</command> will send the query to the local
+ host.
</para>
<para>
@@ -157,20 +159,25 @@
<term><constant>server</constant></term>
<listitem>
<para>
- is the name or IP address of the name server to query. This can
- be an IPv4
- address in dotted-decimal notation or an IPv6
+ is the name or IP address of the name server to query. This
+ can be an IPv4 address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
- <parameter>server</parameter> argument is a
- hostname,
- <command>dig</command> resolves that name before
- querying that name
- server. If no <parameter>server</parameter>
- argument is provided,
- <command>dig</command> consults <filename>/etc/resolv.conf</filename>
- and queries the name servers listed there. The reply from the
- name
- server that responds is displayed.
+ <parameter>server</parameter> argument is a hostname,
+ <command>dig</command> resolves that name before querying
+ that name server.
+ </para>
+ <para>
+ If no <parameter>server</parameter> argument is
+ provided, <command>dig</command> consults
+ <filename>/etc/resolv.conf</filename>; if an
+ address is found there, it queries the name server at
+ that address. If either of the <option>-4</option> or
+ <option>-6</option> options are in use, then
+ only addresses for the corresponding transport
+ will be tried. If no usable addresses are found,
+ <command>dig</command> will send the query to the
+ local host. The reply from the name server that
+ responds is displayed.
</para>
</listitem>
</varlistentry>
diff --git a/bin/dig/dig.html b/bin/dig/dig.html
index ceef3fa..a1cd5cf 100644
--- a/bin/dig/dig.html
+++ b/bin/dig/dig.html
@@ -1,5 +1,5 @@
<!--
- - 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
@@ -34,7 +34,7 @@
<div class="cmdsynopsis"><p><code class="command">dig</code> [global-queryopt...] [query...]</p></div>
</div>
<div class="refsect1" lang="en">
-<a name="id2543524"></a><h2>DESCRIPTION</h2>
+<a name="id2543527"></a><h2>DESCRIPTION</h2>
<p><span><strong class="command">dig</strong></span>
(domain information groper) is a flexible tool
for interrogating DNS name servers. It performs DNS lookups and
@@ -57,9 +57,10 @@
</p>
<p>
Unless it is told to query a specific name server,
- <span><strong class="command">dig</strong></span> will try each of the servers listed
- in
- <code class="filename">/etc/resolv.conf</code>.
+ <span><strong class="command">dig</strong></span> will try each of the servers listed in
+ <code class="filename">/etc/resolv.conf</code>. If no usable server addreses
+ are found, <span><strong class="command">dig</strong></span> will send the query to the local
+ host.
</p>
<p>
When no command line arguments or options are given,
@@ -80,7 +81,7 @@
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2543597"></a><h2>SIMPLE USAGE</h2>
+<a name="id2543606"></a><h2>SIMPLE USAGE</h2>
<p>
A typical invocation of <span><strong class="command">dig</strong></span> looks like:
</p>
@@ -91,22 +92,29 @@
</p>
<div class="variablelist"><dl>
<dt><span class="term"><code class="constant">server</code></span></dt>
-<dd><p>
- is the name or IP address of the name server to query. This can
- be an IPv4
- address in dotted-decimal notation or an IPv6
+<dd>
+<p>
+ is the name or IP address of the name server to query. This
+ can be an IPv4 address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
- <em class="parameter"><code>server</code></em> argument is a
- hostname,
- <span><strong class="command">dig</strong></span> resolves that name before
- querying that name
- server. If no <em class="parameter"><code>server</code></em>
- argument is provided,
- <span><strong class="command">dig</strong></span> consults <code class="filename">/etc/resolv.conf</code>
- and queries the name servers listed there. The reply from the
- name
- server that responds is displayed.
- </p></dd>
+ <em class="parameter"><code>server</code></em> argument is a hostname,
+ <span><strong class="command">dig</strong></span> resolves that name before querying
+ that name server.
+ </p>
+<p>
+ If no <em class="parameter"><code>server</code></em> argument is
+ provided, <span><strong class="command">dig</strong></span> consults
+ <code class="filename">/etc/resolv.conf</code>; if an
+ address is found there, it queries the name server at
+ that address. If either of the <code class="option">-4</code> or
+ <code class="option">-6</code> options are in use, then
+ only addresses for the corresponding transport
+ will be tried. If no usable addresses are found,
+ <span><strong class="command">dig</strong></span> will send the query to the
+ local host. The reply from the name server that
+ responds is displayed.
+ </p>
+</dd>
<dt><span class="term"><code class="constant">name</code></span></dt>
<dd><p>
is the name of the resource record that is to be looked up.
@@ -126,7 +134,7 @@
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2543688"></a><h2>OPTIONS</h2>
+<a name="id2543709"></a><h2>OPTIONS</h2>
<p>
The <code class="option">-b</code> option sets the source IP address of the query
to <em class="parameter"><code>address</code></em>. This must be a valid
@@ -230,7 +238,7 @@
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2544037"></a><h2>QUERY OPTIONS</h2>
+<a name="id2544058"></a><h2>QUERY OPTIONS</h2>
<p><span><strong class="command">dig</strong></span>
provides a number of query options which affect
the way in which lookups are made and the results displayed. Some of
@@ -561,7 +569,7 @@
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2545186"></a><h2>MULTIPLE QUERIES</h2>
+<a name="id2545207"></a><h2>MULTIPLE QUERIES</h2>
<p>
The BIND 9 implementation of <span><strong class="command">dig </strong></span>
supports
@@ -607,7 +615,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2545248"></a><h2>IDN SUPPORT</h2>
+<a name="id2545337"></a><h2>IDN SUPPORT</h2>
<p>
If <span><strong class="command">dig</strong></span> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
@@ -621,14 +629,14 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2545338"></a><h2>FILES</h2>
+<a name="id2545360"></a><h2>FILES</h2>
<p><code class="filename">/etc/resolv.conf</code>
</p>
<p><code class="filename">${HOME}/.digrc</code>
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2545355"></a><h2>SEE ALSO</h2>
+<a name="id2545377"></a><h2>SEE ALSO</h2>
<p><span class="citerefentry"><span class="refentrytitle">host</span>(1)</span>,
<span class="citerefentry"><span class="refentrytitle">named</span>(8)</span>,
<span class="citerefentry"><span class="refentrytitle">dnssec-keygen</span>(8)</span>,
@@ -636,7 +644,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
</p>
</div>
<div class="refsect1" lang="en">
-<a name="id2545393"></a><h2>BUGS</h2>
+<a name="id2545414"></a><h2>BUGS</h2>
<p>
There are probably too many query options.
</p>
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 9695de0..8ea7d8e 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -794,6 +794,7 @@ make_empty_lookup(void) {
dns_fixedname_init(&looknew->fdomain);
ISC_LINK_INIT(looknew, link);
ISC_LIST_INIT(looknew->q);
+ ISC_LIST_INIT(looknew->connecting);
ISC_LIST_INIT(looknew->my_server_list);
return (looknew);
}
@@ -815,11 +816,11 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew = make_empty_lookup();
INSIST(looknew != NULL);
- strncpy(looknew->textname, lookold->textname, MXNAME);
+ strlcpy(looknew->textname, lookold->textname, MXNAME);
#if DIG_SIGCHASE_TD
- strncpy(looknew->textnamesigchase, lookold->textnamesigchase, MXNAME);
+ strlcpy(looknew->textnamesigchase, lookold->textnamesigchase, MXNAME);
#endif
- strncpy(looknew->cmdline, lookold->cmdline, MXNAME);
+ strlcpy(looknew->cmdline, lookold->cmdline, MXNAME);
looknew->textname[MXNAME-1] = 0;
looknew->rdtype = lookold->rdtype;
looknew->qrdtype = lookold->qrdtype;
@@ -998,7 +999,7 @@ parse_hmac(const char *hmac) {
len = strlen(hmac);
if (len >= (int) sizeof(buf))
fatal("unknown key type '%.*s'", len, hmac);
- strncpy(buf, hmac, sizeof(buf));
+ strlcpy(buf, hmac, sizeof(buf));
digestbits = 0;
@@ -1080,8 +1081,8 @@ read_confkey(void) {
secretstr = cfg_obj_asstring(secretobj);
algorithm = cfg_obj_asstring(algorithmobj);
- strncpy(keynametext, keyname, sizeof(keynametext));
- strncpy(keysecret, secretstr, sizeof(keysecret));
+ strlcpy(keynametext, keyname, sizeof(keynametext));
+ strlcpy(keysecret, secretstr, sizeof(keysecret));
parse_hmac(algorithm);
setup_text_key();
@@ -1164,7 +1165,7 @@ make_searchlist_entry(char *domain) {
if (search == NULL)
fatal("memory allocation failure in %s:%d",
__FILE__, __LINE__);
- strncpy(search->origin, domain, MXNAME);
+ strlcpy(search->origin, domain, MXNAME);
search->origin[MXNAME-1] = 0;
ISC_LINK_INIT(search, link);
return (search);
@@ -1473,7 +1474,10 @@ clear_query(dig_query_t *query) {
if (lookup->current_query == query)
lookup->current_query = NULL;
- ISC_LIST_UNLINK(lookup->q, query, link);
+ if (ISC_LINK_LINKED(query, link))
+ ISC_LIST_UNLINK(lookup->q, query, link);
+ if (ISC_LINK_LINKED(query, clink))
+ ISC_LIST_UNLINK(lookup->connecting, query, clink);
if (ISC_LINK_LINKED(&query->recvbuf, link))
ISC_LIST_DEQUEUE(query->recvlist, &query->recvbuf,
link);
@@ -1481,6 +1485,7 @@ clear_query(dig_query_t *query) {
ISC_LIST_DEQUEUE(query->lengthlist, &query->lengthbuf,
link);
INSIST(query->recvspace != NULL);
+
if (query->sock != NULL) {
isc_socket_detach(&query->sock);
sockcount--;
@@ -1508,13 +1513,22 @@ try_clear_lookup(dig_lookup_t *lookup) {
debug("try_clear_lookup(%p)", lookup);
- if (ISC_LIST_HEAD(lookup->q) != NULL) {
+ if (ISC_LIST_HEAD(lookup->q) != NULL ||
+ ISC_LIST_HEAD(lookup->connecting) != NULL)
+ {
if (debugging) {
q = ISC_LIST_HEAD(lookup->q);
while (q != NULL) {
debug("query to %s still pending", q->servname);
q = ISC_LIST_NEXT(q, link);
}
+
+ q = ISC_LIST_HEAD(lookup->connecting);
+ while (q != NULL) {
+ debug("query to %s still connecting",
+ q->servname);
+ q = ISC_LIST_NEXT(q, clink);
+ }
}
return (ISC_FALSE);
}
@@ -1642,7 +1656,7 @@ start_lookup(void) {
= current_lookup->rdclassset;
current_lookup->rdclass = dns_rdataclass_in;
- strncpy(current_lookup->textnamesigchase,
+ strlcpy(current_lookup->textnamesigchase,
current_lookup->textname, MXNAME);
current_lookup->trace_root_sigchase = ISC_TRUE;
@@ -1654,7 +1668,7 @@ start_lookup(void) {
check_result(result, "dns_name_totext");
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
- strncpy(current_lookup->textname, (char*)r.base,
+ strlcpy(current_lookup->textname, (char*)r.base,
MXNAME);
isc_buffer_free(&b);
@@ -2290,7 +2304,6 @@ setup_lookup(dig_lookup_t *lookup) {
query->rr_count = 0;
query->msg_count = 0;
query->byte_count = 0;
- ISC_LINK_INIT(query, link);
ISC_LIST_INIT(query->recvlist);
ISC_LIST_INIT(query->lengthlist);
query->sock = NULL;
@@ -2303,6 +2316,7 @@ setup_lookup(dig_lookup_t *lookup) {
isc_buffer_init(&query->slbuf, query->slspace, 2);
query->sendbuf = lookup->renderbuf;
+ ISC_LINK_INIT(query, clink);
ISC_LINK_INIT(query, link);
ISC_LIST_ENQUEUE(lookup->q, query, link);
}
@@ -2424,6 +2438,7 @@ static void
force_timeout(dig_lookup_t *l, dig_query_t *query) {
isc_event_t *event;
+ debug("force_timeout ()");
event = isc_event_allocate(mctx, query, ISC_TIMEREVENT_IDLE,
connect_timeout, l,
sizeof(isc_event_t));
@@ -2491,6 +2506,7 @@ send_tcp_connect(dig_query_t *query) {
send_tcp_connect(next);
return;
}
+
INSIST(query->sock == NULL);
result = isc_socket_create(socketmgr,
isc_sockaddr_pf(&query->sockaddr),
@@ -2521,6 +2537,9 @@ send_tcp_connect(dig_query_t *query) {
if (l->ns_search_only && !l->trace_root) {
debug("sending next, since searching");
next = ISC_LIST_NEXT(query, link);
+ if (ISC_LINK_LINKED(query, link))
+ ISC_LIST_DEQUEUE(l->q, query, link);
+ ISC_LIST_ENQUEUE(l->connecting, query, clink);
if (next != NULL)
send_tcp_connect(next);
}
@@ -2601,7 +2620,7 @@ send_udp(dig_query_t *query) {
static void
connect_timeout(isc_task_t *task, isc_event_t *event) {
dig_lookup_t *l = NULL;
- dig_query_t *query = NULL, *cq;
+ dig_query_t *query = NULL, *next, *cq;
UNUSED(task);
REQUIRE(event->ev_type == ISC_TIMEREVENT_IDLE);
@@ -2625,7 +2644,9 @@ connect_timeout(isc_task_t *task, isc_event_t *event) {
if (query->sock != NULL)
isc_socket_cancel(query->sock, NULL,
ISC_SOCKCANCEL_ALL);
- send_tcp_connect(ISC_LIST_NEXT(cq, link));
+ next = ISC_LIST_NEXT(cq, link);
+ if (next != NULL)
+ send_tcp_connect(next);
}
UNLOCK_LOOKUP;
return;
@@ -2868,9 +2889,8 @@ connect_done(isc_task_t *task, isc_event_t *event) {
if (next != NULL) {
bringup_timer(next, TCP_TIMEOUT);
send_tcp_connect(next);
- } else {
+ } else
check_next_lookup(l);
- }
UNLOCK_LOOKUP;
return;
}
@@ -3427,6 +3447,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (n == 0)
docancel = ISC_TRUE;
l->trace_root = ISC_FALSE;
+ usesearch = ISC_FALSE;
} else
#ifdef DIG_SIGCHASE
if (!do_sigchase)
@@ -3603,15 +3624,19 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp) {
*/
void
do_lookup(dig_lookup_t *lookup) {
+ dig_query_t *query;
REQUIRE(lookup != NULL);
debug("do_lookup()");
lookup->pending = ISC_TRUE;
- if (lookup->tcp_mode)
- send_tcp_connect(ISC_LIST_HEAD(lookup->q));
- else
- send_udp(ISC_LIST_HEAD(lookup->q));
+ query = ISC_LIST_HEAD(lookup->q);
+ if (query != NULL) {
+ if (lookup->tcp_mode)
+ send_tcp_connect(query);
+ else
+ send_udp(query);
+ }
}
/*%
@@ -4083,7 +4108,7 @@ sigchase_scanname(dns_rdatatype_t type, dns_rdatatype_t covers,
check_result(result, "dns_name_totext");
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
- strcpy(lookup->textname, (char*)r.base);
+ strlcpy(lookup->textname, (char*)r.base, sizeof(lookup->textname));
isc_buffer_free(&b);
if (type == dns_rdatatype_rrsig)
@@ -4208,7 +4233,7 @@ opentmpkey(isc_mem_t *mctx, const char *file, char **tempp, FILE **fp) {
return (ISC_R_NOMEMORY);
memset(tempnamekey, 0, tempnamekeylen);
- strncpy(tempnamekey, tempname, tempnamelen);
+ strlcpy(tempnamekey, tempname, tempnamelen);
strcat(tempnamekey ,".key");
@@ -4342,7 +4367,7 @@ prepare_lookup(dns_name_t *name)
lookup->new_search = ISC_TRUE;
lookup->trace_root_sigchase = ISC_FALSE;
- strncpy(lookup->textname, lookup->textnamesigchase, MXNAME);
+ strlcpy(lookup->textname, lookup->textnamesigchase, MXNAME);
lookup->rdtype = lookup->rdtype_sigchase;
lookup->rdtypeset = ISC_TRUE;
@@ -4401,7 +4426,7 @@ prepare_lookup(dns_name_t *name)
dns_rdata_totext(&aaaa, &ns.name, b);
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
- strncpy(namestr, (char*)r.base,
+ strlcpy(namestr, (char*)r.base,
DNS_NAME_FORMATSIZE);
isc_buffer_free(&b);
dns_rdata_reset(&aaaa);
@@ -4430,7 +4455,7 @@ prepare_lookup(dns_name_t *name)
dns_rdata_totext(&a, &ns.name, b);
isc_buffer_usedregion(b, &r);
r.base[r.length] = '\0';
- strncpy(namestr, (char*)r.base,
+ strlcpy(namestr, (char*)r.base,
DNS_NAME_FORMATSIZE);
isc_buffer_free(&b);
dns_rdata_reset(&a);
@@ -4609,7 +4634,6 @@ contains_trusted_key(dns_name_t *name, dns_rdataset_t *rdataset,
{
isc_result_t result;
dns_rdata_t rdata = DNS_RDATA_INIT;
- dst_key_t *trustedKey = NULL;
dst_key_t *dnsseckey = NULL;
int i;
@@ -4653,10 +4677,6 @@ contains_trusted_key(dns_name_t *name, dns_rdataset_t *rdataset,
dst_key_free(&dnsseckey);
} while (dns_rdataset_next(rdataset) == ISC_R_SUCCESS);
- if (trustedKey != NULL)
- dst_key_free(&trustedKey);
- trustedKey = NULL;
-
return (ISC_R_NOTFOUND);
}
diff --git a/bin/dig/host.c b/bin/dig/host.c
index 82eea05..6b37f5f 100644
--- a/bin/dig/host.c
+++ b/bin/dig/host.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007, 2009-2011 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009-2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -446,10 +446,18 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
if (msg->rcode != 0) {
char namestr[DNS_NAME_FORMATSIZE];
dns_name_format(query->lookup->name, namestr, sizeof(namestr));
- printf("Host %s not found: %d(%s)\n",
- (msg->rcode != dns_rcode_nxdomain) ? namestr :
- query->lookup->textname, msg->rcode,
- rcode_totext(msg->rcode));
+
+ if (query->lookup->identify_previous_line)
+ printf("Nameserver %s:\n\t%s not found: %d(%s)\n",
+ query->servname,
+ (msg->rcode != dns_rcode_nxdomain) ? namestr :
+ query->lookup->textname, msg->rcode,
+ rcode_totext(msg->rcode));
+ else
+ printf("Host %s not found: %d(%s)\n",
+ (msg->rcode != dns_rcode_nxdomain) ? namestr :
+ query->lookup->textname, msg->rcode,
+ rcode_totext(msg->rcode));
return (ISC_R_SUCCESS);
}
diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h
index 6c186de..e039745 100644
--- a/bin/dig/include/dig/dig.h
+++ b/bin/dig/include/dig/dig.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2009, 2011 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -168,6 +168,7 @@ isc_boolean_t sigchase;
dns_name_t *oname;
ISC_LINK(dig_lookup_t) link;
ISC_LIST(dig_query_t) q;
+ ISC_LIST(dig_query_t) connecting;
dig_query_t *current_query;
dig_serverlist_t my_server_list;
dig_searchlist_t *origin;
@@ -214,6 +215,7 @@ struct dig_query {
slspace[4];
isc_socket_t *sock;
ISC_LINK(dig_query_t) link;
+ ISC_LINK(dig_query_t) clink;
isc_sockaddr_t sockaddr;
isc_time_t time_sent;
isc_uint64_t byte_count;
OpenPOWER on IntegriCloud