mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
More searchlist/domain handling fixes. Dig/host/nslookup no longer
have the notion that there can be both a search list and a default domain at the same time. The resolv.conf "domain" directive is now used only if there is no "search" directive, and is treated exacly like a one-element searchlist. The "+domain" option of dig and the "set domain" command of nslookup are now merely ways of overriding the resolv.conf search list. Parents of the name given in the "domain" directive are still not searched; this is considered a feature and is consistent with lwres, but different from the BIND 8 resolver. The "+defname" option to "dig" is now deprecated and treated as a synonym for "+search"
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
.\" $Id: dig.1,v 1.7 2001/01/09 21:47:10 bwelling Exp $
|
||||
.\" $Id: dig.1,v 1.8 2001/01/18 05:12:38 gson Exp $
|
||||
|
||||
.Dd Jun 30, 2000
|
||||
.Dt DIG 1
|
||||
@@ -259,23 +259,27 @@ Ignore truncation in UDP responses instead of
|
||||
retrying with TCP. By default, TCP retries are
|
||||
performed.
|
||||
.It +domain=somename
|
||||
Set the default domain to
|
||||
Set the search list to contain the single domain
|
||||
.Ar somename ,
|
||||
as if specified in a
|
||||
.Dv domain
|
||||
directive in
|
||||
.Pa /etc/resolv.conf .
|
||||
.Pa /etc/resolv.conf ,
|
||||
and enable search list processing as if the
|
||||
.Ar +search
|
||||
option were given.
|
||||
.It +[no]search
|
||||
Use [do not use] the search list in
|
||||
Use [do not use] the search list defined by the
|
||||
searchlist
|
||||
or
|
||||
domain
|
||||
directive in
|
||||
.Pa resolv.conf
|
||||
(if any).
|
||||
The search list is not used by default.
|
||||
.It +[no]defname
|
||||
Use [do not use] the default domain name, if any, in
|
||||
.Pa resolv.conf
|
||||
The default is not to append that name to
|
||||
.Ar name
|
||||
when making queries.
|
||||
Deprecated, treated as a synonym for
|
||||
.Ar +[no]search
|
||||
.It +[no]aaonly
|
||||
This option does nothing.
|
||||
It is provided for compatibilty with old versions of
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dig.c,v 1.133 2001/01/09 21:39:14 bwelling Exp $ */
|
||||
/* $Id: dig.c,v 1.134 2001/01/18 05:12:39 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
@@ -64,7 +64,6 @@ extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int tries;
|
||||
extern int lookup_counter;
|
||||
extern char fixeddomain[MXNAME];
|
||||
extern int exitcode;
|
||||
extern isc_sockaddr_t bind_address;
|
||||
extern char keynametext[MXNAME];
|
||||
@@ -83,6 +82,8 @@ char *batchname = NULL;
|
||||
FILE *batchfp = NULL;
|
||||
char *argv0;
|
||||
|
||||
char domainopt[DNS_NAME_MAXTEXT];
|
||||
|
||||
isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
|
||||
nibble = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE;
|
||||
|
||||
@@ -156,7 +157,7 @@ show_usage(void) {
|
||||
" +domain=### (Set default domainname)\n"
|
||||
" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
|
||||
" +[no]search (Set whether to use searchlist)\n"
|
||||
" +[no]defname (Set whether to use default domain)\n"
|
||||
" +[no]defname (Ditto)\n"
|
||||
" +[no]recursive (Recursive mode)\n"
|
||||
" +[no]ignore (Don't revert to TCP for TC responses.)"
|
||||
"\n"
|
||||
@@ -595,7 +596,7 @@ parse_int(char *arg, const char *desc, isc_uint32_t max) {
|
||||
/*
|
||||
* We're not using isc_commandline_parse() here since the command line
|
||||
* syntax of dig is quite a bit different from that which can be described
|
||||
* that routine.
|
||||
* by that routine.
|
||||
* XXX doc options
|
||||
*/
|
||||
|
||||
@@ -696,7 +697,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
|
||||
case 'd':
|
||||
switch (cmd[1]) {
|
||||
case 'e': /* defname */
|
||||
lookup->defname = state;
|
||||
usesearch = state;
|
||||
break;
|
||||
case 'n': /* dnssec */
|
||||
lookup->dnssec = state;
|
||||
@@ -706,8 +707,8 @@ plus_option(char *option, isc_boolean_t is_batchfile,
|
||||
goto need_value;
|
||||
if (!state)
|
||||
goto invalid_option;
|
||||
strncpy(fixeddomain, value, sizeof(fixeddomain));
|
||||
fixeddomain[sizeof(fixeddomain)-1]=0;
|
||||
strncpy(domainopt, value, sizeof(domainopt));
|
||||
domainopt[sizeof(domainopt)-1] = '\0';
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
@@ -1369,6 +1370,10 @@ main(int argc, char **argv) {
|
||||
setup_libs();
|
||||
parse_args(ISC_FALSE, ISC_FALSE, argc, argv);
|
||||
setup_system();
|
||||
if (domainopt[0] != '\0') {
|
||||
set_search_domain(domainopt);
|
||||
usesearch = ISC_TRUE;
|
||||
}
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback, NULL);
|
||||
check_result(result, "isc_app_onrun");
|
||||
isc_app_run();
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dighost.c,v 1.184 2001/01/17 00:48:18 bwelling Exp $ */
|
||||
/* $Id: dighost.c,v 1.185 2001/01/18 05:12:41 gson Exp $ */
|
||||
|
||||
/*
|
||||
* Notice to programmers: Do not use this code as an example of how to
|
||||
@@ -82,9 +82,7 @@ isc_boolean_t
|
||||
cancel_now = ISC_FALSE,
|
||||
usesearch = ISC_FALSE,
|
||||
qr = ISC_FALSE,
|
||||
is_dst_up = ISC_FALSE,
|
||||
have_domain = ISC_FALSE;
|
||||
|
||||
is_dst_up = ISC_FALSE;
|
||||
in_port_t port = 53;
|
||||
unsigned int timeout = 0;
|
||||
isc_mem_t *mctx = NULL;
|
||||
@@ -101,8 +99,7 @@ int sockcount = 0;
|
||||
int ndots = -1;
|
||||
int tries = 2;
|
||||
int lookup_counter = 0;
|
||||
char fixeddomain[MXNAME] = "";
|
||||
dig_searchlist_t *fixedsearch = NULL;
|
||||
|
||||
/*
|
||||
* Exit Codes:
|
||||
* 0 Everything went well, including things like NXDOMAIN
|
||||
@@ -355,7 +352,6 @@ make_empty_lookup(void) {
|
||||
looknew->current_query = NULL;
|
||||
looknew->doing_xfr = ISC_FALSE;
|
||||
looknew->ixfr_serial = ISC_FALSE;
|
||||
looknew->defname = ISC_FALSE;
|
||||
looknew->trace = ISC_FALSE;
|
||||
looknew->trace_root = ISC_FALSE;
|
||||
looknew->identify = ISC_FALSE;
|
||||
@@ -417,7 +413,6 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
|
||||
looknew->rdclassset = lookold->rdclassset;
|
||||
looknew->doing_xfr = lookold->doing_xfr;
|
||||
looknew->ixfr_serial = lookold->ixfr_serial;
|
||||
looknew->defname = lookold->defname;
|
||||
looknew->trace = lookold->trace;
|
||||
looknew->trace_root = lookold->trace_root;
|
||||
looknew->identify = lookold->identify;
|
||||
@@ -585,6 +580,19 @@ setup_file_key(void) {
|
||||
isc_mem_free(mctx, secretstore);
|
||||
}
|
||||
|
||||
static dig_searchlist_t *
|
||||
make_searchlist_entry(char *domain) {
|
||||
dig_searchlist_t *search;
|
||||
search = isc_mem_allocate(mctx, sizeof(*search));
|
||||
if (search == NULL)
|
||||
fatal("Memory allocation failure in %s:%d",
|
||||
__FILE__, __LINE__);
|
||||
strncpy(search->origin, domain, MXNAME);
|
||||
search->origin[MXNAME-1] = 0;
|
||||
ISC_LINK_INIT(search, link);
|
||||
return (search);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the system as a whole, reading key information and resolv.conf
|
||||
* settings.
|
||||
@@ -605,84 +613,61 @@ setup_system(void) {
|
||||
get_servers = ISC_TF(server_list.head == NULL);
|
||||
fp = fopen(RESOLVCONF, "r");
|
||||
/* XXX Use lwres resolv.conf reader */
|
||||
if (fp != NULL) {
|
||||
while (fgets(rcinput, MXNAME, fp) != 0) {
|
||||
input = rcinput;
|
||||
ptr = next_token(&input, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
if (get_servers &&
|
||||
strcasecmp(ptr, "nameserver") == 0) {
|
||||
debug("got a nameserver line");
|
||||
ptr = next_token(&input, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
srv = make_server(ptr);
|
||||
ISC_LIST_APPEND
|
||||
(server_list,
|
||||
srv, link);
|
||||
}
|
||||
} else if (strcasecmp(ptr, "options") == 0) {
|
||||
ptr = next_token(&input, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
if((strncasecmp(ptr, "ndots:",
|
||||
6) == 0) &&
|
||||
(ndots == -1)) {
|
||||
ndots = atoi(
|
||||
&ptr[6]);
|
||||
debug("ndots is "
|
||||
"%d.",
|
||||
ndots);
|
||||
}
|
||||
}
|
||||
} else if (strcasecmp(ptr, "search") == 0){
|
||||
while ((ptr = next_token(&input, " \t\r\n"))
|
||||
!= NULL) {
|
||||
debug("adding search %s",
|
||||
ptr);
|
||||
search = isc_mem_allocate(
|
||||
mctx, sizeof(*search));
|
||||
if (search == NULL)
|
||||
fatal("Memory "
|
||||
"allocation "
|
||||
"failure in %s:"
|
||||
"%d", __FILE__,
|
||||
__LINE__);
|
||||
strncpy(search->
|
||||
origin,
|
||||
ptr,
|
||||
MXNAME);
|
||||
search->origin[MXNAME-1] = 0;
|
||||
ISC_LIST_INITANDAPPEND
|
||||
(search_list,
|
||||
search,
|
||||
link);
|
||||
}
|
||||
} else if ((strcasecmp(ptr, "domain") == 0) &&
|
||||
(fixeddomain[0] == 0 )){
|
||||
have_domain = ISC_TRUE;
|
||||
while ((ptr = next_token(&input, " \t\r\n"))
|
||||
!= NULL) {
|
||||
domain = isc_mem_allocate(
|
||||
mctx, sizeof(*domain));
|
||||
if (domain == NULL)
|
||||
fatal("Memory "
|
||||
"allocation "
|
||||
"failure in %s:"
|
||||
"%d", __FILE__,
|
||||
__LINE__);
|
||||
strncpy(domain->
|
||||
origin,
|
||||
ptr,
|
||||
MXNAME - 1);
|
||||
domain->origin[MXNAME-1] = 0;
|
||||
if (fp == NULL)
|
||||
goto no_file;
|
||||
|
||||
while (fgets(rcinput, MXNAME, fp) != 0) {
|
||||
input = rcinput;
|
||||
ptr = next_token(&input, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
if (get_servers &&
|
||||
strcasecmp(ptr, "nameserver") == 0) {
|
||||
debug("got a nameserver line");
|
||||
ptr = next_token(&input, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
srv = make_server(ptr);
|
||||
ISC_LIST_APPEND(server_list, srv, link);
|
||||
}
|
||||
} else if (strcasecmp(ptr, "options") == 0) {
|
||||
ptr = next_token(&input, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
if((strncasecmp(ptr, "ndots:",
|
||||
6) == 0) &&
|
||||
(ndots == -1)) {
|
||||
ndots = atoi(
|
||||
&ptr[6]);
|
||||
debug("ndots is %d.",
|
||||
ndots);
|
||||
}
|
||||
}
|
||||
} else if (strcasecmp(ptr, "search") == 0){
|
||||
while ((ptr = next_token(&input, " \t\r\n"))
|
||||
!= NULL) {
|
||||
debug("adding search %s", ptr);
|
||||
search = make_searchlist_entry(ptr);
|
||||
ISC_LIST_INITANDAPPEND(search_list,
|
||||
search, link);
|
||||
}
|
||||
} else if (strcasecmp(ptr, "domain") == 0) {
|
||||
while ((ptr = next_token(&input, " \t\r\n"))
|
||||
!= NULL) {
|
||||
if (domain != NULL)
|
||||
isc_mem_free(mctx, domain);
|
||||
domain = make_searchlist_entry(ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
fclose(fp);
|
||||
no_file:
|
||||
|
||||
if (domain != NULL)
|
||||
if (ISC_LIST_EMPTY(search_list) && domain != NULL) {
|
||||
ISC_LIST_INITANDAPPEND(search_list, domain, link);
|
||||
domain = NULL;
|
||||
}
|
||||
if (domain != NULL)
|
||||
isc_mem_free(mctx, domain);
|
||||
|
||||
if (ndots == -1)
|
||||
ndots = 1;
|
||||
|
||||
@@ -697,6 +682,27 @@ setup_system(void) {
|
||||
setup_text_key();
|
||||
}
|
||||
|
||||
static void
|
||||
clear_searchlist(void) {
|
||||
dig_searchlist_t *search;
|
||||
while ((search = ISC_LIST_HEAD(search_list)) != NULL) {
|
||||
ISC_LIST_UNLINK(search_list, search, link);
|
||||
isc_mem_free(mctx, search);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Override the search list derived from resolv.conf by 'domain'.
|
||||
*/
|
||||
void
|
||||
set_search_domain(char *domain) {
|
||||
dig_searchlist_t *search;
|
||||
|
||||
clear_searchlist();
|
||||
search = make_searchlist_entry(domain);
|
||||
ISC_LIST_APPEND(search_list, search, link);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the ISC and DNS libraries for use by the system.
|
||||
*/
|
||||
@@ -1078,7 +1084,6 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
|
||||
(query->lookup,
|
||||
ISC_FALSE);
|
||||
lookup->doing_xfr = ISC_FALSE;
|
||||
lookup->defname = ISC_FALSE;
|
||||
if (section ==
|
||||
DNS_SECTION_ANSWER) {
|
||||
lookup->trace =
|
||||
@@ -1119,8 +1124,10 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
|
||||
}
|
||||
|
||||
/*
|
||||
* Create and queue a new lookup using the next origin from the origin
|
||||
* Create and queue a new lookup using the next origin from the search
|
||||
* list, read in setup_system().
|
||||
*
|
||||
* Return ISC_TRUE iff there was another searchlist entry.
|
||||
*/
|
||||
static isc_boolean_t
|
||||
next_origin(dns_message_t *msg, dig_query_t *query) {
|
||||
@@ -1133,16 +1140,6 @@ next_origin(dns_message_t *msg, dig_query_t *query) {
|
||||
debug("next_origin()");
|
||||
debug("following up %s", query->lookup->textname);
|
||||
|
||||
if (fixedsearch == query->lookup->origin) {
|
||||
/*
|
||||
* This is a fixed domain search; there is no next entry.
|
||||
* While we're here, clear out the fixedsearch alloc.
|
||||
*/
|
||||
isc_mem_free(mctx, fixedsearch);
|
||||
fixedsearch = NULL;
|
||||
query->lookup->origin = NULL;
|
||||
return (ISC_FALSE);
|
||||
}
|
||||
if (!usesearch)
|
||||
/*
|
||||
* We're not using a search list, so don't even think
|
||||
@@ -1156,7 +1153,6 @@ next_origin(dns_message_t *msg, dig_query_t *query) {
|
||||
return (ISC_FALSE);
|
||||
cancel_lookup(query->lookup);
|
||||
lookup = requeue_lookup(query->lookup, ISC_TRUE);
|
||||
lookup->defname = ISC_FALSE;
|
||||
lookup->origin = ISC_LIST_NEXT(query->lookup->origin, link);
|
||||
return (ISC_TRUE);
|
||||
}
|
||||
@@ -1278,26 +1274,10 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
* is TRUE or we got a domain line in the resolv.conf file.
|
||||
*/
|
||||
/* XXX New search here? */
|
||||
if ((count_dots(lookup->textname) >= ndots) ||
|
||||
(!lookup->defname && !usesearch))
|
||||
if ((count_dots(lookup->textname) >= ndots) || !usesearch)
|
||||
lookup->origin = NULL; /* Force abs lookup */
|
||||
else if (lookup->origin == NULL && lookup->new_search &&
|
||||
(usesearch || have_domain)) {
|
||||
if (fixeddomain[0] != 0) {
|
||||
debug("using fixed domain %s", fixeddomain);
|
||||
if (fixedsearch != NULL)
|
||||
isc_mem_free(mctx, fixedsearch);
|
||||
fixedsearch = isc_mem_allocate(mctx,
|
||||
sizeof(*fixedsearch));
|
||||
if (fixedsearch == NULL)
|
||||
fatal("Memory allocation failure in %s:%d",
|
||||
__FILE__, __LINE__);
|
||||
strncpy(fixedsearch->origin, fixeddomain,
|
||||
sizeof(fixedsearch->origin));
|
||||
fixedsearch->origin[sizeof(fixedsearch->origin)-1] = 0;
|
||||
lookup->origin = fixedsearch;
|
||||
} else
|
||||
lookup->origin = ISC_LIST_HEAD(search_list);
|
||||
else if (lookup->origin == NULL && lookup->new_search && usesearch) {
|
||||
lookup->origin = ISC_LIST_HEAD(search_list);
|
||||
}
|
||||
if (lookup->origin != NULL) {
|
||||
debug("trying origin %s", lookup->origin->origin);
|
||||
@@ -2734,7 +2714,6 @@ void
|
||||
destroy_libs(void) {
|
||||
void *ptr;
|
||||
dig_server_t *s;
|
||||
dig_searchlist_t *o;
|
||||
|
||||
debug("destroy_libs()");
|
||||
if (global_task != NULL) {
|
||||
@@ -2760,11 +2739,6 @@ destroy_libs(void) {
|
||||
|
||||
free_now = ISC_TRUE;
|
||||
|
||||
if (fixedsearch != NULL) {
|
||||
debug("freeing fixed search");
|
||||
isc_mem_free(mctx, fixedsearch);
|
||||
fixedsearch = NULL;
|
||||
}
|
||||
s = ISC_LIST_HEAD(server_list);
|
||||
while (s != NULL) {
|
||||
debug("freeing global server %p", s);
|
||||
@@ -2772,13 +2746,7 @@ destroy_libs(void) {
|
||||
s = ISC_LIST_NEXT(s, link);
|
||||
isc_mem_free(mctx, ptr);
|
||||
}
|
||||
o = ISC_LIST_HEAD(search_list);
|
||||
while (o != NULL) {
|
||||
debug("freeing search %p", o);
|
||||
ptr = o;
|
||||
o = ISC_LIST_NEXT(o, link);
|
||||
isc_mem_free(mctx, ptr);
|
||||
}
|
||||
clear_searchlist();
|
||||
if (commctx != NULL) {
|
||||
debug("freeing commctx");
|
||||
isc_mempool_destroy(&commctx);
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: host.c,v 1.61 2001/01/09 21:39:17 bwelling Exp $ */
|
||||
/* $Id: host.c,v 1.62 2001/01/18 05:12:42 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
@@ -45,13 +45,12 @@ extern ISC_LIST(dig_lookup_t) lookup_list;
|
||||
extern ISC_LIST(dig_server_t) server_list;
|
||||
extern ISC_LIST(dig_searchlist_t) search_list;
|
||||
|
||||
extern isc_boolean_t usesearch;
|
||||
extern isc_boolean_t debugging;
|
||||
extern unsigned int timeout;
|
||||
extern isc_mem_t *mctx;
|
||||
extern int ndots;
|
||||
extern int tries;
|
||||
extern isc_boolean_t usesearch;
|
||||
extern int lookup_counter;
|
||||
extern char *progname;
|
||||
extern isc_task_t *global_task;
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dig.h,v 1.61 2001/01/09 21:39:19 bwelling Exp $ */
|
||||
/* $Id: dig.h,v 1.62 2001/01/18 05:12:44 gson Exp $ */
|
||||
|
||||
#ifndef DIG_H
|
||||
#define DIG_H
|
||||
@@ -91,7 +91,6 @@ struct dig_lookup {
|
||||
cdflag,
|
||||
trace,
|
||||
trace_root,
|
||||
defname,
|
||||
tcp_mode,
|
||||
nibble,
|
||||
comments,
|
||||
@@ -240,6 +239,9 @@ cancel_all(void);
|
||||
void
|
||||
destroy_libs(void);
|
||||
|
||||
void
|
||||
set_search_domain(char *domain);
|
||||
|
||||
/*
|
||||
* Routines needed in dig.c and host.c.
|
||||
*/
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: nslookup.c,v 1.77 2001/01/17 02:21:51 bwelling Exp $ */
|
||||
/* $Id: nslookup.c,v 1.78 2001/01/18 05:12:43 gson Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -61,7 +61,6 @@ extern int sendcount;
|
||||
extern int ndots;
|
||||
extern int tries;
|
||||
extern int lookup_counter;
|
||||
extern char fixeddomain[MXNAME];
|
||||
extern int exitcode;
|
||||
extern isc_taskmgr_t *taskmgr;
|
||||
extern isc_task_t *global_task;
|
||||
@@ -78,12 +77,14 @@ isc_boolean_t identify = ISC_FALSE,
|
||||
comments = ISC_TRUE, section_question = ISC_TRUE,
|
||||
section_answer = ISC_TRUE, section_authority = ISC_TRUE,
|
||||
section_additional = ISC_TRUE, recurse = ISC_TRUE,
|
||||
defname = ISC_TRUE, aaonly = ISC_FALSE;
|
||||
aaonly = ISC_FALSE;
|
||||
isc_boolean_t busy = ISC_FALSE, in_use = ISC_FALSE;
|
||||
char defclass[MXRD] = "IN";
|
||||
char deftype[MXRD] = "A";
|
||||
isc_event_t *global_event = NULL;
|
||||
|
||||
char domainopt[DNS_NAME_MAXTEXT];
|
||||
|
||||
static const char *rcodetext[] = {
|
||||
"NOERROR",
|
||||
"FORMERR",
|
||||
@@ -484,25 +485,26 @@ show_settings(isc_boolean_t full, isc_boolean_t serv_only) {
|
||||
}
|
||||
if (serv_only)
|
||||
return;
|
||||
printf("\n\tSet options:\n");
|
||||
printf("\t %s\t\t\t%s\t\t%s\n",
|
||||
tcpmode?"vc":"novc", short_form?"nodebug":"debug",
|
||||
debugging?"d2":"nod2");
|
||||
printf("\t %s\t\t%s\t%s\n",
|
||||
defname?"defname":"nodefname",
|
||||
usesearch?"search ":"nosearch",
|
||||
recurse?"recurse":"norecurse");
|
||||
printf("\t timeout = %d\t\tretry = %d\tport = %d\n",
|
||||
timeout, tries, port);
|
||||
printf("\t querytype = %-8s\tclass = %s\n", deftype, defclass);
|
||||
if (fixeddomain[0] != 0)
|
||||
printf("\t domain = %s\n", fixeddomain);
|
||||
else if (!ISC_LIST_EMPTY(search_list)) {
|
||||
listent = ISC_LIST_HEAD(search_list);
|
||||
printf("\t domain = %s\n", listent->origin);
|
||||
} else
|
||||
printf("\t domain =\n");
|
||||
|
||||
printf("\nSet options:\n");
|
||||
printf(" %s\t\t\t%s\t\t%s\n",
|
||||
tcpmode ? "vc" : "novc",
|
||||
short_form ? "nodebug" : "debug",
|
||||
debugging ? "d2" : "nod2");
|
||||
printf(" %s\t\t%s\n",
|
||||
usesearch ? "search" : "nosearch",
|
||||
recurse ? "recurse" : "norecurse");
|
||||
printf(" timeout = %d\t\tretry = %d\tport = %d\n",
|
||||
timeout, tries, port);
|
||||
printf(" querytype = %-8s\tclass = %s\n", deftype, defclass);
|
||||
printf(" srchlist = ");
|
||||
for (listent = ISC_LIST_HEAD(search_list);
|
||||
listent != NULL;
|
||||
listent = ISC_LIST_NEXT(listent, link)) {
|
||||
printf("%s", listent->origin);
|
||||
if (ISC_LIST_NEXT(listent, link) != NULL)
|
||||
printf("/");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
@@ -572,10 +574,12 @@ setoption(char *opt) {
|
||||
if (testtype(&opt[3]))
|
||||
safecpy(deftype, &opt[3], MXRD);
|
||||
} else if (strncasecmp(opt, "domain=", 7) == 0) {
|
||||
safecpy(fixeddomain, &opt[7], MXNAME);
|
||||
safecpy(domainopt, &opt[7], MXNAME);
|
||||
set_search_domain(domainopt);
|
||||
usesearch = ISC_TRUE;
|
||||
} else if (strncasecmp(opt, "do=", 3) == 0) {
|
||||
safecpy(fixeddomain, &opt[3], MXNAME);
|
||||
safecpy(domainopt, &opt[3], MXNAME);
|
||||
set_search_domain(domainopt);
|
||||
usesearch = ISC_TRUE;
|
||||
} else if (strncasecmp(opt, "port=", 5) == 0) {
|
||||
port = atoi(&opt[5]);
|
||||
@@ -594,9 +598,9 @@ setoption(char *opt) {
|
||||
} else if (strncasecmp(opt, "ret=", 4) == 0) {
|
||||
tries = atoi(&opt[4]);
|
||||
} else if (strncasecmp(opt, "def", 3) == 0) {
|
||||
defname = ISC_TRUE;
|
||||
usesearch = ISC_TRUE;
|
||||
} else if (strncasecmp(opt, "nodef", 5) == 0) {
|
||||
defname = ISC_FALSE;
|
||||
usesearch = ISC_FALSE;
|
||||
} else if (strncasecmp(opt, "vc", 3) == 0) {
|
||||
tcpmode = ISC_TRUE;
|
||||
} else if (strncasecmp(opt, "novc", 5) == 0) {
|
||||
@@ -873,7 +877,8 @@ main(int argc, char **argv) {
|
||||
"the `-sil[ent]' option to prevent this message from appearing.\n", stderr);
|
||||
}
|
||||
setup_system();
|
||||
|
||||
if (domainopt[0] != '\0')
|
||||
set_search_domain(domainopt);
|
||||
if (in_use)
|
||||
result = isc_app_onrun(mctx, global_task, onrun_callback,
|
||||
NULL);
|
||||
|
Reference in New Issue
Block a user