Fix bug in handling of batch files.
Changes to conform to standard coding style. Internally reorder batch line options to properly handle @ options in batch files.
This commit is contained in:
169
bin/dig/dig.c
169
bin/dig/dig.c
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <errno.h>
|
||||
@@ -70,7 +71,6 @@ extern isc_task_t *task;
|
||||
extern isc_timermgr_t *timermgr;
|
||||
extern isc_socketmgr_t *socketmgr;
|
||||
extern dns_messageid_t id;
|
||||
extern dns_name_t rootorg;
|
||||
extern char *rootspace[BUFSIZE];
|
||||
extern isc_buffer_t rootbuf;
|
||||
extern int sendcount;
|
||||
@@ -158,7 +158,7 @@ show_usage() {
|
||||
" +[no]comments (Control display of comment lines)\n"
|
||||
" +[no]question (Control display of question)\n"
|
||||
" +[no]answer (Control display of answer)\n"
|
||||
" +[no]autority (Control display of authority)\n"
|
||||
" +[no]authority (Control display of authority)\n"
|
||||
" +[no]additional (Control display of additional)\n"
|
||||
, stderr);
|
||||
}
|
||||
@@ -169,12 +169,12 @@ check_next_lookup(dig_lookup_t *lookup) {
|
||||
dig_query_t *query;
|
||||
isc_boolean_t still_working=ISC_FALSE;
|
||||
|
||||
debug("In check_next_lookup",stderr);
|
||||
debug("In check_next_lookup", stderr);
|
||||
for (query = ISC_LIST_HEAD(lookup->q);
|
||||
query != NULL;
|
||||
query = ISC_LIST_NEXT(query, link)) {
|
||||
if (query->working) {
|
||||
debug("Still have a worker.",stderr);
|
||||
debug("Still have a worker.", stderr);
|
||||
still_working=ISC_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ check_next_lookup(dig_lookup_t *lookup) {
|
||||
lookup->retries, lookup->textname);
|
||||
if ((next == NULL)&&((lookup->retries <= 1)
|
||||
||tcp_mode)) {
|
||||
debug("Shutting Down.",stderr);
|
||||
debug("Shutting Down.", stderr);
|
||||
isc_app_shutdown();
|
||||
return;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ received(int bytes, int frmsize, char *frm, dig_query_t *query) {
|
||||
printf(";; Received %u bytes from %.*s\n",
|
||||
bytes, frmsize, frm);
|
||||
time (&tnow);
|
||||
printf(";; When: %s\n",ctime(&tnow));
|
||||
printf(";; When: %s\n", ctime(&tnow));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,10 +442,46 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||
}
|
||||
|
||||
/*
|
||||
** 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. There is a portability issue here.
|
||||
*/
|
||||
* Reorder an argument list so that server names all come at the end.
|
||||
* This is a bit of a hack, to allow batch-mode processing to properly
|
||||
* handle the server options.
|
||||
*/
|
||||
static void
|
||||
reorder_args(int argc, char *argv[]) {
|
||||
int i, j;
|
||||
char *ptr;
|
||||
int end;
|
||||
|
||||
debug ("reorder_args()");
|
||||
end = argc-1;
|
||||
while (argv[end][0] == '@') {
|
||||
end--;
|
||||
if (end == 0)
|
||||
return;
|
||||
}
|
||||
debug ("arg[end]=%s",argv[end]);
|
||||
for (i=1; i<end-1; i++) {
|
||||
if (argv[i][0]=='@') {
|
||||
debug ("Arg[%d]=%s", i, argv[i]);
|
||||
ptr=argv[i];
|
||||
for (j=i+1; j<end; j++) {
|
||||
debug ("Moving %s to %d", argv[j], j-1);
|
||||
argv[j-1]=argv[j];
|
||||
}
|
||||
debug ("Moving %s to end, %d", ptr, end-1);
|
||||
argv[end-1]=ptr;
|
||||
end--;
|
||||
if (end < 1)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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. There is a portability issue here.
|
||||
*/
|
||||
void
|
||||
parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
isc_boolean_t have_host = ISC_FALSE;
|
||||
@@ -455,110 +491,120 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
char batchline[MXNAME];
|
||||
FILE *fp = NULL;
|
||||
int bargc;
|
||||
char *bargv[8];
|
||||
int i,n;
|
||||
char *bargv[16];
|
||||
int i, n;
|
||||
int adrs[4];
|
||||
|
||||
for (argc--, argv++; argc > 0; argc--, argv++) {
|
||||
debug ("Main parsing %s", argv[0]);
|
||||
if ((strncmp(argv[0],"@",1) == 0)
|
||||
&& (!is_batchfile)) {
|
||||
if (strncmp(argv[0], "@", 1) == 0) {
|
||||
srv=isc_mem_allocate(mctx, sizeof(struct dig_server));
|
||||
if (srv == NULL)
|
||||
fatal("Memory allocation failure.");
|
||||
strncpy(srv->servername,&argv[0][1],MXNAME-1);
|
||||
ISC_LIST_APPEND(server_list, srv, link);
|
||||
} else if ((strcmp(argv[0],"+vc") == 0)
|
||||
strncpy(srv->servername, &argv[0][1], MXNAME-1);
|
||||
if ((is_batchfile) || (!have_host)) {
|
||||
if (!lookup->use_my_server_list) {
|
||||
ISC_LIST_INIT (lookup->
|
||||
my_server_list);
|
||||
lookup->use_my_server_list =
|
||||
ISC_TRUE;
|
||||
}
|
||||
ISC_LIST_APPEND(lookup->my_server_list,
|
||||
srv, link);
|
||||
} else {
|
||||
ISC_LIST_APPEND(server_list, srv, link);
|
||||
}
|
||||
} else if ((strcmp(argv[0], "+vc") == 0)
|
||||
&& (!is_batchfile)) {
|
||||
tcp_mode = ISC_TRUE;
|
||||
} else if ((strcmp(argv[0],"+novc") == 0)
|
||||
} else if ((strcmp(argv[0], "+novc") == 0)
|
||||
&& (!is_batchfile)) {
|
||||
tcp_mode = ISC_FALSE;
|
||||
} else if ((strcmp(argv[0],"+tcp") == 0)
|
||||
} else if ((strcmp(argv[0], "+tcp") == 0)
|
||||
&& (!is_batchfile)) {
|
||||
tcp_mode = ISC_TRUE;
|
||||
} else if ((strcmp(argv[0],"+notcp") == 0)
|
||||
} else if ((strcmp(argv[0], "+notcp") == 0)
|
||||
&& (!is_batchfile)) {
|
||||
tcp_mode = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+domain=",8) == 0) {
|
||||
} else if (strncmp(argv[0], "+domain=", 8) == 0) {
|
||||
strncpy (fixeddomain, &argv[0][8], MXNAME);
|
||||
} else if (strncmp(argv[0],"+sea",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+sea", 4) == 0) {
|
||||
usesearch = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+nosea",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+nosea", 6) == 0) {
|
||||
usesearch = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+time=",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+time=", 6) == 0) {
|
||||
timeout = atoi(&argv[0][6]);
|
||||
if (timeout <= 0)
|
||||
timeout = 1;
|
||||
} else if (strncmp(argv[0],"+tries=",7) == 0) {
|
||||
} else if (strncmp(argv[0], "+tries=", 7) == 0) {
|
||||
tries = atoi(&argv[0][7]);
|
||||
if (tries <= 0)
|
||||
tries = 1;
|
||||
} else if (strncmp(argv[0],"+ndots=",7) == 0) {
|
||||
} else if (strncmp(argv[0], "+ndots=", 7) == 0) {
|
||||
ndots = atoi(&argv[0][7]);
|
||||
if (timeout <= 0)
|
||||
timeout = 1;
|
||||
} else if (strncmp(argv[0],"+rec",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+rec", 4) == 0) {
|
||||
recurse = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+norec",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+norec", 6) == 0) {
|
||||
recurse = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+ns",3) == 0) {
|
||||
} else if (strncmp(argv[0], "+ns", 3) == 0) {
|
||||
ns_search_only = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+nons",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+nons", 6) == 0) {
|
||||
ns_search_only = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+det",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+det", 4) == 0) {
|
||||
show_details = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+nodet",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+nodet", 6) == 0) {
|
||||
show_details = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+com",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+com", 4) == 0) {
|
||||
comments = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+nocom",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+nocom", 6) == 0) {
|
||||
comments = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+que",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+que", 4) == 0) {
|
||||
section_question = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+noque",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+noque", 6) == 0) {
|
||||
section_question = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+ans",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+ans", 4) == 0) {
|
||||
section_answer = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+noans",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+noans", 6) == 0) {
|
||||
section_answer = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+add",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+add", 4) == 0) {
|
||||
section_additional = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+noadd",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+noadd", 6) == 0) {
|
||||
section_additional = ISC_FALSE;
|
||||
} else if (strncmp(argv[0],"+aut",4) == 0) {
|
||||
} else if (strncmp(argv[0], "+aut", 4) == 0) {
|
||||
section_authority = ISC_TRUE;
|
||||
} else if (strncmp(argv[0],"+noaut",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+noaut", 6) == 0) {
|
||||
section_authority = ISC_FALSE;
|
||||
#ifdef TWIDDLE
|
||||
} else if (strncmp(argv[0],"+twiddle",6) == 0) {
|
||||
} else if (strncmp(argv[0], "+twiddle", 6) == 0) {
|
||||
twiddle = ISC_TRUE;
|
||||
#endif
|
||||
} else if (strncmp(argv[0],"-c",2) == 0) {
|
||||
} else if (strncmp(argv[0], "-c", 2) == 0) {
|
||||
if (have_host) {
|
||||
if (argv[0][2]!=0) {
|
||||
strncpy(lookup->rctext,&argv[0][2],
|
||||
strncpy(lookup->rctext, &argv[0][2],
|
||||
MXRD);
|
||||
} else {
|
||||
strncpy(lookup->rctext,argv[1],
|
||||
strncpy(lookup->rctext, argv[1],
|
||||
MXRD);
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
}
|
||||
} else if (strncmp(argv[0],"-t",2) == 0) {
|
||||
} else if (strncmp(argv[0], "-t", 2) == 0) {
|
||||
if (have_host) {
|
||||
if (argv[0][2]!=0) {
|
||||
strncpy(lookup->rttext,&argv[0][2],
|
||||
strncpy(lookup->rttext, &argv[0][2],
|
||||
MXRD);
|
||||
} else {
|
||||
strncpy(lookup->rttext,argv[1],
|
||||
strncpy(lookup->rttext, argv[1],
|
||||
MXRD);
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
}
|
||||
} else if (strncmp(argv[0],"-f",2) == 0) {
|
||||
} else if (strncmp(argv[0], "-f", 2) == 0) {
|
||||
if (argv[0][2]!=0) {
|
||||
batchname=&argv[0][2];
|
||||
} else {
|
||||
@@ -566,7 +612,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
} else if (strncmp(argv[0],"-p",2) == 0) {
|
||||
} else if (strncmp(argv[0], "-p", 2) == 0) {
|
||||
if (argv[0][2]!=0) {
|
||||
port=atoi(&argv[0][2]);
|
||||
} else {
|
||||
@@ -574,11 +620,11 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
} else if (strncmp(argv[0],"-h",2) == 0) {
|
||||
} else if (strncmp(argv[0], "-h", 2) == 0) {
|
||||
show_usage();
|
||||
exit (0);
|
||||
} else if (strncmp(argv[0],"-x",2) == 0) {
|
||||
n = sscanf(argv[1],"%d.%d.%d.%d", &adrs[0], &adrs[1],
|
||||
} else if (strncmp(argv[0], "-x", 2) == 0) {
|
||||
n = sscanf(argv[1], "%d.%d.%d.%d", &adrs[0], &adrs[1],
|
||||
&adrs[2], &adrs[3]);
|
||||
if (n == 0)
|
||||
show_usage();
|
||||
@@ -594,7 +640,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
strncat(lookup->textname, batchline, MXNAME);
|
||||
}
|
||||
strncat(lookup->textname, "in-addr.arpa.", MXNAME);
|
||||
debug("Looking up %s",lookup->textname);
|
||||
debug("Looking up %s", lookup->textname);
|
||||
strcpy(lookup->rttext, "ptr");
|
||||
strcpy(lookup->rctext, "in");
|
||||
lookup->namespace[0]=0;
|
||||
@@ -626,11 +672,11 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
if (have_host) {
|
||||
ENSURE(lookup != NULL);
|
||||
if (isclass(argv[0])) {
|
||||
strncpy(lookup->rctext,argv[0],
|
||||
strncpy(lookup->rctext, argv[0],
|
||||
MXRD);
|
||||
continue;
|
||||
} else if (istype(argv[0])) {
|
||||
strncpy(lookup->rttext,argv[0], MXRD);
|
||||
strncpy(lookup->rttext, argv[0], MXRD);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -639,7 +685,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
if (lookup == NULL)
|
||||
fatal("Memory allocation failure.");
|
||||
lookup->pending = ISC_FALSE;
|
||||
strncpy(lookup->textname,argv[0], MXNAME-1);
|
||||
strncpy(lookup->textname, argv[0], MXNAME-1);
|
||||
lookup->rttext[0]=0;
|
||||
lookup->rctext[0]=0;
|
||||
lookup->namespace[0]=0;
|
||||
@@ -678,13 +724,14 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
debug ("Batch line %s", batchline);
|
||||
bargc=1;
|
||||
bargv[bargc]=strtok(batchline, " \t\r\n");
|
||||
while (bargv[bargc] != NULL) {
|
||||
while ((bargv[bargc] != NULL) &&
|
||||
(bargc < 14 )) {
|
||||
bargc++;
|
||||
bargv[bargc]=strtok(NULL, " \t\r\n");
|
||||
}
|
||||
bargc--;
|
||||
bargv[0]="dig";
|
||||
debug("Batch parsing %d:%s",bargc,bargv[1]);
|
||||
reorder_args(bargc+1, (char**)bargv);
|
||||
parse_args(ISC_TRUE, bargc+1, (char**)bargv);
|
||||
}
|
||||
}
|
||||
@@ -715,7 +762,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
ISC_LIST_INIT(lookup->q);
|
||||
lookup->origin = NULL;
|
||||
ISC_LIST_INIT(lookup->my_server_list);
|
||||
strcpy(lookup->textname,".");
|
||||
strcpy(lookup->textname, ".");
|
||||
strcpy(lookup->rttext, "NS");
|
||||
lookup->rctext[0]=0;
|
||||
ISC_LIST_APPEND(lookup_list, lookup, link);
|
||||
|
||||
@@ -72,7 +72,6 @@ isc_task_t *task = NULL;
|
||||
isc_timermgr_t *timermgr = NULL;
|
||||
isc_socketmgr_t *socketmgr = NULL;
|
||||
dns_messageid_t id;
|
||||
dns_name_t rootorg;
|
||||
char *rootspace[BUFSIZE];
|
||||
isc_buffer_t rootbuf;
|
||||
int sendcount = 0;
|
||||
@@ -128,7 +127,7 @@ fatal(char *format, ...) {
|
||||
free_lists();
|
||||
if (mctx != NULL) {
|
||||
#ifdef MEMDEBUG
|
||||
isc_mem_stats(mctx,stderr);
|
||||
isc_mem_stats(mctx, stderr);
|
||||
#endif
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
@@ -164,8 +163,9 @@ check_result(isc_result_t result, char *msg) {
|
||||
isc_boolean_t
|
||||
isclass(char *text) {
|
||||
/* Tests if a field is a class, without needing isc libs
|
||||
initialized. This list will have to be manually kept in
|
||||
sync with what the libs support. */
|
||||
* initialized. This list will have to be manually kept in
|
||||
* sync with what the libs support.
|
||||
*/
|
||||
const char *classlist[] = {"in", "hs", "any"};
|
||||
const int numclasses = 3;
|
||||
int i;
|
||||
@@ -180,8 +180,9 @@ isclass(char *text) {
|
||||
isc_boolean_t
|
||||
istype(char *text) {
|
||||
/* Tests if a field is a type, without needing isc libs
|
||||
initialized. This list will have to be manually kept in
|
||||
sync with what the libs support. */
|
||||
* initialized. This list will have to be manually kept in
|
||||
* sync with what the libs support.
|
||||
*/
|
||||
const char *typelist[] = {"a", "ns", "md", "mf", "cname",
|
||||
"soa", "mb", "mg", "mr", "null",
|
||||
"wks", "ptr", "hinfo", "minfo",
|
||||
@@ -213,7 +214,7 @@ twiddlebuf(isc_buffer_t buf) {
|
||||
|
||||
hex_dump(&buf);
|
||||
tw=TWIDDLE;
|
||||
printf ("Twiddling %d bits: ",tw);
|
||||
printf ("Twiddling %d bits: ", tw);
|
||||
for (i=0;i<tw;i++) {
|
||||
isc_buffer_usedregion (&buf, &r);
|
||||
len = r.length;
|
||||
@@ -221,7 +222,7 @@ twiddlebuf(isc_buffer_t buf) {
|
||||
pos = pos%len;
|
||||
bit = (int)random()%8;
|
||||
bitfield = 1 << bit;
|
||||
printf ("%d@%03x ",bit, pos);
|
||||
printf ("%d@%03x ", bit, pos);
|
||||
r.base[pos] ^= bitfield;
|
||||
}
|
||||
puts ("");
|
||||
@@ -275,7 +276,7 @@ setup_system(void) {
|
||||
(server_list,
|
||||
srv, link);
|
||||
}
|
||||
} else if (strcasecmp(ptr,"options") == 0) {
|
||||
} else if (strcasecmp(ptr, "options") == 0) {
|
||||
ptr = strtok(NULL, " \t\r\n");
|
||||
if (ptr != NULL) {
|
||||
if ((strncasecmp(ptr, "ndots:",
|
||||
@@ -288,7 +289,7 @@ setup_system(void) {
|
||||
ndots);
|
||||
}
|
||||
}
|
||||
} else if ((strcasecmp(ptr,"search") == 0)
|
||||
} else if ((strcasecmp(ptr, "search") == 0)
|
||||
&& usesearch){
|
||||
while ((ptr = strtok(NULL, " \t\r\n"))
|
||||
!= NULL) {
|
||||
@@ -308,7 +309,7 @@ setup_system(void) {
|
||||
search,
|
||||
link);
|
||||
}
|
||||
} else if ((strcasecmp(ptr,"domain") == 0) &&
|
||||
} else if ((strcasecmp(ptr, "domain") == 0) &&
|
||||
(fixeddomain[0] == 0 )){
|
||||
while ((ptr = strtok(NULL, " \t\r\n"))
|
||||
!= NULL) {
|
||||
@@ -385,10 +386,6 @@ setup_libs(void) {
|
||||
check_result(result, "isc_socketmgr_create");
|
||||
isc_buffer_init(&b, ".", 1);
|
||||
isc_buffer_add(&b, 1);
|
||||
dns_name_init(&rootorg, NULL);
|
||||
isc_buffer_init(&rootbuf, rootspace, BUFSIZE);
|
||||
result = dns_name_fromtext(&rootorg, &b, NULL, ISC_FALSE, &rootbuf);
|
||||
check_result(result, "dns_name_fromtext");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -515,8 +512,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query) {
|
||||
if (srv == NULL)
|
||||
fatal("Memory allocation "
|
||||
"failure.");
|
||||
strncpy(srv->servername, (char *)r.base,
|
||||
len);
|
||||
strncpy(srv->servername,
|
||||
(char *)r.base, len);
|
||||
srv->servername[len]=0;
|
||||
ISC_LIST_APPEND
|
||||
(lookup->my_server_list,
|
||||
@@ -525,7 +522,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query) {
|
||||
}
|
||||
debug ("Before insertion, init@%ld "
|
||||
"-> %ld, new@%ld "
|
||||
"-> %ld",(long int)query->lookup,
|
||||
"-> %ld", (long int)query->lookup,
|
||||
(long int)query->lookup->link.next,
|
||||
(long int)lookup, (long int)lookup->
|
||||
link.next);
|
||||
@@ -534,7 +531,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query) {
|
||||
link);
|
||||
debug ("After insertion, init -> "
|
||||
"%ld, new = %ld, "
|
||||
"new -> %ld",(long int)query->
|
||||
"new -> %ld", (long int)query->
|
||||
lookup->link.next,
|
||||
(long int)lookup, (long int)lookup->
|
||||
link.next);
|
||||
@@ -585,7 +582,7 @@ next_origin(dns_message_t *msg, dig_query_t *query) {
|
||||
lookup->recurse = query->lookup->recurse;
|
||||
lookup->ns_search_only = query->lookup->ns_search_only;
|
||||
lookup->use_my_server_list = query->lookup->use_my_server_list;
|
||||
lookup->origin = ISC_LIST_NEXT(query->lookup->origin,link);
|
||||
lookup->origin = ISC_LIST_NEXT(query->lookup->origin, link);
|
||||
lookup->retries = tries;
|
||||
lookup->comments = query->lookup->comments;
|
||||
lookup->section_question = query->lookup->section_question;
|
||||
@@ -611,7 +608,7 @@ next_origin(dns_message_t *msg, dig_query_t *query) {
|
||||
|
||||
debug ("Before insertion, init@%ld "
|
||||
"-> %ld, new@%ld "
|
||||
"-> %ld",(long int)query->lookup,
|
||||
"-> %ld", (long int)query->lookup,
|
||||
(long int)query->lookup->link.next,
|
||||
(long int)lookup, (long int)lookup->
|
||||
link.next);
|
||||
@@ -620,7 +617,7 @@ next_origin(dns_message_t *msg, dig_query_t *query) {
|
||||
link);
|
||||
debug ("After insertion, init -> "
|
||||
"%ld, new = %ld, "
|
||||
"new -> %ld",(long int)query->
|
||||
"new -> %ld", (long int)query->
|
||||
lookup->link.next,
|
||||
(long int)lookup, (long int)lookup->
|
||||
link.next);
|
||||
@@ -661,7 +658,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
if (count_dots(lookup->textname) >= ndots)
|
||||
lookup->origin = NULL; /* Force root lookup */
|
||||
if (lookup->origin != NULL) {
|
||||
debug ("Trying origin %s",lookup->origin->origin);
|
||||
debug ("Trying origin %s", lookup->origin->origin);
|
||||
result = dns_message_gettempname(lookup->sendmsg,
|
||||
&lookup->oname);
|
||||
check_result(result, "dns_message_gettempname");
|
||||
@@ -669,7 +666,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
len=strlen(lookup->origin->origin);
|
||||
isc_buffer_init(&b, lookup->origin->origin, len);
|
||||
isc_buffer_add(&b, len);
|
||||
result = dns_name_fromtext(lookup->oname, &b, &rootorg,
|
||||
result = dns_name_fromtext(lookup->oname, &b, dns_rootname,
|
||||
ISC_FALSE, &lookup->onamebuf);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_message_puttempname(lookup->sendmsg,
|
||||
@@ -699,13 +696,13 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
len = strlen (lookup->textname);
|
||||
isc_buffer_init(&b, lookup->textname, len);
|
||||
isc_buffer_add(&b, len);
|
||||
result = dns_name_fromtext(lookup->name, &b, &rootorg,
|
||||
result = dns_name_fromtext(lookup->name, &b, dns_rootname,
|
||||
ISC_FALSE, &lookup->namebuf);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_message_puttempname(lookup->sendmsg,
|
||||
&lookup->name);
|
||||
isc_buffer_init(&b, store, MXNAME);
|
||||
res2 = dns_name_totext(&rootorg, ISC_FALSE, &b);
|
||||
res2 = dns_name_totext(dns_rootname, ISC_FALSE, &b);
|
||||
check_result (res2, "dns_name_totext");
|
||||
isc_buffer_usedregion (&b, &r);
|
||||
fatal("Aborting: %s/%.*s is not a legal name syntax. "
|
||||
@@ -1408,7 +1405,7 @@ free_lists(void) {
|
||||
o = ISC_LIST_NEXT(o, link);
|
||||
isc_mem_free(mctx, ptr);
|
||||
}
|
||||
dns_name_invalidate(&rootorg);
|
||||
dns_name_invalidate(dns_rootname);
|
||||
if (socketmgr != NULL)
|
||||
isc_socketmgr_destroy(&socketmgr);
|
||||
if (timermgr != NULL)
|
||||
@@ -1433,7 +1430,7 @@ main(int argc, char **argv) {
|
||||
dig_lookup_t *lookup = NULL;
|
||||
#ifdef TWIDDLE
|
||||
FILE *fp;
|
||||
int i,p;
|
||||
int i, p;
|
||||
#endif
|
||||
|
||||
ISC_LIST_INIT(lookup_list);
|
||||
@@ -1441,7 +1438,7 @@ main(int argc, char **argv) {
|
||||
ISC_LIST_INIT(search_list);
|
||||
|
||||
#ifdef TWIDDLE
|
||||
fp = fopen("/dev/urandom","r");
|
||||
fp = fopen("/dev/urandom", "r");
|
||||
if (fp!=NULL) {
|
||||
fread (&i, sizeof(int), 1, fp);
|
||||
srandom(i);
|
||||
|
||||
@@ -187,7 +187,7 @@ check_next_lookup (dig_lookup_t *lookup) {
|
||||
lookup->retries, lookup->textname);
|
||||
if ((next == NULL)&&((lookup->retries <= 1)
|
||||
||tcp_mode)) {
|
||||
debug("Shutting Down.",stderr);
|
||||
debug("Shutting Down.", stderr);
|
||||
isc_app_shutdown();
|
||||
return;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ show_usage() {
|
||||
" -T enables TCP/IP mode\n"
|
||||
" -v enables verbose output\n"
|
||||
" -w specifies to wait forever for a reply\n"
|
||||
" -W specifies how long to wait for a reply\n",stderr);
|
||||
" -W specifies how long to wait for a reply\n", stderr);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ say_message(dns_name_t *name, char *msg, dns_rdata_t *rdata,
|
||||
printf ( "%.*s %s %.*s", (int)r.length, (char *)r.base,
|
||||
msg, (int)r2.length, (char *)r2.base);
|
||||
if (query->lookup->identify) {
|
||||
printf (" on server %s",query->servname);
|
||||
printf (" on server %s", query->servname);
|
||||
}
|
||||
printf ("\n");
|
||||
isc_buffer_free(&b);
|
||||
@@ -533,7 +533,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
|
||||
UNUSED(is_batchfile);
|
||||
|
||||
while ((c = isc_commandline_parse(argc, argv,"lvwrdt:c:aTCN:R:W:"))
|
||||
while ((c = isc_commandline_parse(argc, argv, "lvwrdt:c:aTCN:R:W:"))
|
||||
!= EOF) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
@@ -561,7 +561,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
break;
|
||||
case 'w':
|
||||
/* XXXMWS This should be a system-indep.
|
||||
thing! */
|
||||
* thing! */
|
||||
timeout = 32767;
|
||||
break;
|
||||
case 'W':
|
||||
@@ -602,8 +602,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
if (srv == NULL)
|
||||
fatal ("Memory allocation failure.");
|
||||
strncpy(srv->servername,
|
||||
argv[isc_commandline_index+1],MXNAME-1);
|
||||
debug("Server is %s",srv->servername);
|
||||
argv[isc_commandline_index+1], MXNAME-1);
|
||||
debug("Server is %s", srv->servername);
|
||||
ISC_LIST_APPEND(server_list, srv, link);
|
||||
}
|
||||
|
||||
@@ -619,7 +619,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
|
||||
lookup->pending = ISC_FALSE;
|
||||
strncpy (lookup->textname, hostname, MXNAME);
|
||||
strncpy (lookup->rttext, querytype, 32);
|
||||
strncpy (lookup->rctext,queryclass, 32);
|
||||
strncpy (lookup->rctext, queryclass, 32);
|
||||
lookup->namespace[0]=0;
|
||||
lookup->sendspace[0]=0;
|
||||
lookup->sendmsg=NULL;
|
||||
|
||||
Reference in New Issue
Block a user