summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorInternet Software Consortium, Inc <@isc.org>2007-09-07 14:08:32 -0600
committerLaMont Jones <lamont@debian.org>2007-09-07 14:08:32 -0600
commitaf91fbe8793cebfe38435d4773d7c30d811cd620 (patch)
tree2f836182b0a1cb95028bdcbe4b1dddb06bb9e707 /bin
parentff3d77a7770d533059f1ed7203490c7862ffe749 (diff)
downloadbind9-af91fbe8793cebfe38435d4773d7c30d811cd620.tar.gz
9.0.0
Diffstat (limited to 'bin')
-rw-r--r--bin/dig/dig.c10
-rw-r--r--bin/dig/dighost.c32
-rw-r--r--bin/dig/host.c20
-rw-r--r--bin/dig/nslookup.c93
-rw-r--r--bin/named/omapiconf.c6
-rw-r--r--bin/nsupdate/nsupdate.c3
6 files changed, 128 insertions, 36 deletions
diff --git a/bin/dig/dig.c b/bin/dig/dig.c
index d8618499..e29ee14b 100644
--- a/bin/dig/dig.c
+++ b/bin/dig/dig.c
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-/* $Id: dig.c,v 1.51.2.7 2000/09/12 23:07:03 explorer Exp $ */
+/* $Id: dig.c,v 1.51.2.8 2000/09/15 22:56:11 gson Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -46,7 +46,7 @@ extern ISC_LIST(dig_searchlist_t) search_list;
extern isc_boolean_t have_ipv6, show_details, specified_source,
- usesearch, qr;
+ usesearch, qr, ignore;
extern in_port_t port;
extern unsigned int timeout;
extern isc_mem_t *mctx;
@@ -159,6 +159,8 @@ show_usage(void) {
" +[no]search (Set whether to use searchlist)\n"
" +[no]defname (Set whether to use default domaon)\n"
" +[no]recursive (Recursive mode)\n"
+" +[no]ignore (Don't revert to TCP for TC responses.)"
+"\n"
" +[no]aaonly (Set AA flag in query)\n"
" +[no]adflag (Set AD flag in query)\n"
" +[no]cdflag (Set CD flag in query)\n"
@@ -827,6 +829,10 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
}
} else if (strncmp(rv[0], "+nosho", 6) == 0) {
short_form = ISC_FALSE;
+ } else if (strncmp(rv[0], "+i", 2) == 0) {
+ ignore = ISC_TRUE;
+ } else if (strncmp(rv[0], "+noi", 4) == 0) {
+ ignore = ISC_FALSE;
} else if (strncmp(rv[0], "+id", 3) == 0) {
if (have_host)
lookup->identify = ISC_TRUE;
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 59a82eff..f6aea0ba 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-/* $Id: dighost.c,v 1.58.2.10 2000/08/18 20:00:11 gson Exp $ */
+/* $Id: dighost.c,v 1.58.2.11 2000/09/15 22:56:12 gson Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
@@ -74,7 +74,8 @@ isc_boolean_t
show_details = ISC_FALSE,
usesearch = ISC_FALSE,
qr = ISC_FALSE,
- is_dst_up = ISC_FALSE;
+ is_dst_up = ISC_FALSE,
+ ignore = ISC_FALSE;
in_port_t port = 53;
unsigned int timeout = 0;
@@ -1467,6 +1468,14 @@ connect_done(isc_task_t *task, isc_event_t *event) {
query->waiting_connect = ISC_FALSE;
+ if (sevent->result == ISC_R_CANCELED) {
+ debug("in cancel handler");
+ query->working = ISC_FALSE;
+ query->waiting_connect = ISC_FALSE;
+ isc_event_free(&event);
+ check_next_lookup(query->lookup);
+ return;
+ }
if (sevent->result != ISC_R_SUCCESS) {
debug("buffer allocate connect_timeout");
result = isc_buffer_allocate(mctx, &b, 256);
@@ -1760,16 +1769,23 @@ recv_done(isc_task_t *task, isc_event_t *event) {
hex_dump(b);
query->working = ISC_FALSE;
query->waiting_connect = ISC_FALSE;
- if (!query->lookup->tcp_mode) {
- printf(";; Retrying in TCP mode.\n");
- n = requeue_lookup(query->lookup, ISC_TRUE);
- n->tcp_mode = ISC_TRUE;
- }
dns_message_destroy(&msg);
isc_event_free(&event);
- result_bool = cancel_lookup(query->lookup);
+ cancel_lookup(query->lookup);
return;
}
+ if (((msg->flags & DNS_MESSAGEFLAG_TC) != 0)
+ && !query->lookup->tcp_mode && !ignore) {
+ printf(";; Truncated, retrying in TCP mode.\n");
+ n = requeue_lookup(query->lookup, ISC_TRUE);
+ n->tcp_mode = ISC_TRUE;
+ query->working = ISC_FALSE;
+ query->waiting_connect = ISC_FALSE;
+ dns_message_destroy(&msg);
+ isc_event_free(&event);
+ cancel_lookup(query->lookup);
+ return;
+ }
if (key != NULL) {
debug("querysig 2 is %p", query->lookup->querysig);
debug("before verify");
diff --git a/bin/dig/host.c b/bin/dig/host.c
index 0dfe7f36..4f51277c 100644
--- a/bin/dig/host.c
+++ b/bin/dig/host.c
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-/* $Id: host.c,v 1.29.2.5 2000/08/22 17:42:45 bwelling Exp $ */
+/* $Id: host.c,v 1.29.2.6 2000/09/15 22:56:14 gson Exp $ */
#include <config.h>
#include <stdlib.h>
@@ -62,7 +62,8 @@ isc_boolean_t
short_form = ISC_TRUE,
filter = ISC_FALSE,
showallsoa = ISC_FALSE,
- tcpmode = ISC_FALSE;
+ tcpmode = ISC_FALSE,
+ listed_server = ISC_FALSE;
static const char *opcodetext[] = {
"QUERY",
@@ -507,6 +508,20 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
ISC_TF(!short_form), query);
if (result != ISC_R_SUCCESS)
return (result);
+ } else {
+ if ((short_form) && (listed_server)) {
+ printf("Using domain server:\n");
+ printf("Name: %s\n", query->servname);
+ result = isc_buffer_allocate(mctx, &b, MXNAME);
+ check_result(result, "isc_buffer_allocate");
+ result = isc_sockaddr_totext(&query->sockaddr, b);
+ check_result(result, "isc_sockaddr_totext");
+ printf("Address: %.*s\n",
+ (int)isc_buffer_usedlength(b),
+ (char*)isc_buffer_base(b));
+ isc_buffer_free(&b);
+ printf("Aliases: \n\n");
+ }
}
if (! ISC_LIST_EMPTY(msg->sections[DNS_SECTION_AUTHORITY]) &&
!short_form) {
@@ -626,6 +641,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
argv[isc_commandline_index+1], MXNAME-1);
debug("server is %s", srv->servername);
ISC_LIST_APPEND(server_list, srv, link);
+ listed_server = ISC_TRUE;
}
lookup = isc_mem_allocate(mctx, sizeof(struct dig_lookup));
diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c
index 4de83274..f00fc3a0 100644
--- a/bin/dig/nslookup.c
+++ b/bin/dig/nslookup.c
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-/* $Id: nslookup.c,v 1.20.2.7 2000/09/05 21:58:09 gson Exp $ */
+/* $Id: nslookup.c,v 1.20.2.8 2000/09/15 22:56:15 gson Exp $ */
#include <config.h>
@@ -28,6 +28,7 @@ extern int h_errno;
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/rdatatype.h>
+#include <dns/rdataclass.h>
#include <isc/app.h>
#include <isc/buffer.h>
#include <isc/commandline.h>
@@ -496,6 +497,16 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
debug ("printmessage()");
+ debug ("continuing on with rcode != 0");
+ result = isc_buffer_allocate(mctx, &b, MXNAME);
+ check_result(result, "isc_buffer_allocate");
+ printf("Server:\t\t%s\n", query->servname);
+ result = isc_sockaddr_totext(&query->sockaddr, b);
+ check_result(result, "isc_sockaddr_totext");
+ printf("Address:\t%.*s\n", (int)isc_buffer_usedlength(b),
+ (char*)isc_buffer_base(b));
+ isc_buffer_free(&b);
+ puts("");
if (msg->rcode != 0) {
result = isc_buffer_allocate(mctx, &b, MXNAME);
check_result(result, "isc_buffer_allocate");
@@ -510,16 +521,6 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
debug ("returning with rcode == 0");
return (ISC_R_SUCCESS);
}
- debug ("continuing on with rcode != 0");
- result = isc_buffer_allocate(mctx, &b, MXNAME);
- check_result(result, "isc_buffer_allocate");
- printf("Server:\t\t%s\n", query->servname);
- result = isc_sockaddr_totext(&query->sockaddr, b);
- check_result(result, "isc_sockaddr_totext");
- printf("Address:\t%.*s\n", (int)isc_buffer_usedlength(b),
- (char*)isc_buffer_base(b));
- isc_buffer_free(&b);
- puts("");
if (!short_form){
puts ("------------");
/* detailheader(query, msg);*/
@@ -585,6 +586,41 @@ show_settings(isc_boolean_t full) {
}
+static isc_boolean_t
+testtype(char *typetext) {
+ isc_result_t result;
+ isc_textregion_t tr;
+ dns_rdatatype_t rdtype;
+
+ tr.base = typetext;
+ tr.length = strlen(typetext);
+ result = dns_rdatatype_fromtext(&rdtype, &tr);
+ if (result == ISC_R_SUCCESS)
+ return (ISC_TRUE);
+ else {
+ printf("unknown query type: %s\n", typetext);
+ return (ISC_FALSE);
+ }
+}
+
+static isc_boolean_t
+testclass(char *typetext) {
+ isc_result_t result;
+ isc_textregion_t tr;
+ dns_rdataclass_t rdclass;
+
+ tr.base = typetext;
+ tr.length = strlen(typetext);
+ result = dns_rdataclass_fromtext(&rdclass, &tr);
+ if (result == ISC_R_SUCCESS)
+ return (ISC_TRUE);
+ else {
+ printf("unknown query class: %s\n", typetext);
+ return (ISC_FALSE);
+ }
+}
+
+
static void
setoption(char *opt) {
dig_server_t *srv;
@@ -592,19 +628,26 @@ setoption(char *opt) {
if (strncasecmp(opt,"all",4) == 0) {
show_settings(ISC_TRUE);
} else if (strncasecmp(opt, "class=", 6) == 0) {
- strncpy(defclass, &opt[6], MXRD);
+ if (testclass(&opt[6]))
+ strncpy(defclass, &opt[6], MXRD);
} else if (strncasecmp(opt, "cl=", 3) == 0) {
- strncpy(defclass, &opt[3], MXRD);
+ if (testclass(&opt[3]))
+ strncpy(defclass, &opt[3], MXRD);
} else if (strncasecmp(opt, "type=", 5) == 0) {
- strncpy(deftype, &opt[5], MXRD);
+ if (testtype(&opt[5]))
+ strncpy(deftype, &opt[5], MXRD);
} else if (strncasecmp(opt, "ty=", 3) == 0) {
- strncpy(deftype, &opt[3], MXRD);
+ if (testtype(&opt[3]))
+ strncpy(deftype, &opt[3], MXRD);
} else if (strncasecmp(opt, "querytype=", 10) == 0) {
- strncpy(deftype, &opt[10], MXRD);
+ if (testtype(&opt[10]))
+ strncpy(deftype, &opt[10], MXRD);
} else if (strncasecmp(opt, "query=", 6) == 0) {
- strncpy(deftype, &opt[6], MXRD);
+ if (testtype(&opt[6]))
+ strncpy(deftype, &opt[6], MXRD);
} else if (strncasecmp(opt, "qu=", 3) == 0) {
- strncpy(deftype, &opt[3], MXRD);
+ if (testtype(&opt[3]))
+ strncpy(deftype, &opt[3], MXRD);
#if 0
/* XXXMWS domain= doesn't work now. */
} else if (strncasecmp(opt, "domain=", 7) == 0) {
@@ -655,8 +698,18 @@ addlookup(char *opt) {
fatal("Memory allocation failure.");
lookup->pending = ISC_FALSE;
strncpy(lookup->textname, opt, MXNAME-1);
- strncpy (lookup->rttext, deftype, MXNAME);
- strncpy (lookup->rctext, defclass, MXNAME);
+ if (istype(deftype))
+ strncpy(lookup->rttext, deftype, MXNAME);
+ else {
+ strcpy(lookup->rttext, "a");
+ printf ("unknown query type: %s\n",deftype);
+ }
+ if (isclass(defclass))
+ strncpy(lookup->rctext, defclass, MXNAME);
+ else {
+ strcpy(lookup->rctext, "in");
+ printf ("unknown query class: %s\n",defclass);
+ }
lookup->namespace[0]=0;
lookup->sendspace = NULL;
lookup->sendmsg=NULL;
diff --git a/bin/named/omapiconf.c b/bin/named/omapiconf.c
index 61ee0933..a47a0888 100644
--- a/bin/named/omapiconf.c
+++ b/bin/named/omapiconf.c
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-/* $Id: omapiconf.c,v 1.4.2.5 2000/08/26 02:13:58 bwelling Exp $ */
+/* $Id: omapiconf.c,v 1.4.2.6 2000/09/15 16:24:12 gson Exp $ */
/*
* Principal Author: DCL
@@ -234,9 +234,9 @@ register_keys(dns_c_ctrl_t *control, dns_c_kdeflist_t *keydeflist,
if (result != ISC_R_SUCCESS)
isc_log_write(ns_g_lctx, ISC_LOGCATEGORY_GENERAL,
NS_LOGMODULE_OMAPI, ISC_LOG_WARNING,
- "couldn't find key %s for"
+ "couldn't find key %s for "
"use with command channel %s",
- keydef->keyid, socktext);
+ keyid->keyid, socktext);
else if (strcasecmp(keydef->algorithm, "hmac-md5") != 0) {
isc_log_write(ns_g_lctx, ISC_LOGCATEGORY_GENERAL,
NS_LOGMODULE_OMAPI, ISC_LOG_WARNING,
diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c
index d0fc8bad..9c603125 100644
--- a/bin/nsupdate/nsupdate.c
+++ b/bin/nsupdate/nsupdate.c
@@ -15,7 +15,7 @@
* SOFTWARE.
*/
-/* $Id: nsupdate.c,v 1.8.2.6 2000/08/15 01:14:51 gson Exp $ */
+/* $Id: nsupdate.c,v 1.8.2.7 2000/09/15 23:47:14 gson Exp $ */
#include <config.h>
@@ -1198,6 +1198,7 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
fatal("Couldn't talk to any default nameserver.");
ddebug("Destroying request [%lx]", request);
dns_request_destroy(&request);
+ dns_message_renderreset(soaquery);
sendrequest(&servers[ns_inuse], soaquery, &request);
isc_mem_put(mctx, reqinfo, sizeof(nsu_requestinfo_t));
return;