1 /* $NetBSD: host.c,v 1.11 2015/07/08 17:28:54 christos Exp $ */
4 * Copyright (C) 2004-2007, 2009-2015 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 2000-2003 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
31 #include <idn/result.h>
33 #include <idn/resconf.h>
38 #include <isc/commandline.h>
39 #include <isc/netaddr.h>
40 #include <isc/print.h>
41 #include <isc/string.h>
44 #include <isc/stdlib.h>
45 #include <isc/timer.h>
47 #include <dns/byaddr.h>
48 #include <dns/fixedname.h>
49 #include <dns/message.h>
51 #include <dns/rdata.h>
52 #include <dns/rdataclass.h>
53 #include <dns/rdataset.h>
54 #include <dns/rdatatype.h>
55 #include <dns/rdatastruct.h>
59 static isc_boolean_t short_form
= ISC_TRUE
, listed_server
= ISC_FALSE
;
60 static isc_boolean_t default_lookups
= ISC_TRUE
;
61 static int seen_error
= -1;
62 static isc_boolean_t list_addresses
= ISC_TRUE
;
63 static dns_rdatatype_t list_type
= dns_rdatatype_a
;
64 static isc_boolean_t printed_server
= ISC_FALSE
;
66 static const char *opcodetext
[] = {
85 static const char *rcodetext
[] = {
110 struct rtype rtypes
[] = {
111 { 1, "has address" },
112 { 2, "name server" },
113 { 5, "is an alias for" },
114 { 11, "has well known services" },
115 { 12, "domain name pointer" },
116 { 13, "host information" },
117 { 15, "mail is handled by" },
118 { 16, "descriptive text" },
119 { 19, "x25 address" },
120 { 20, "ISDN address" },
121 { 24, "has signature" },
123 { 28, "has IPv6 address" },
129 rcode_totext(dns_rcode_t rcode
)
131 static char buf
[sizeof("?65535")];
133 const char *consttext
;
137 if (rcode
>= (sizeof(rcodetext
)/sizeof(rcodetext
[0]))) {
138 snprintf(buf
, sizeof(buf
), "?%u", rcode
);
139 totext
.deconsttext
= buf
;
141 totext
.consttext
= rcodetext
[rcode
];
142 return totext
.deconsttext
;
145 ISC_PLATFORM_NORETURN_PRE
static void
146 show_usage(void) ISC_PLATFORM_NORETURN_POST
;
151 "Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]\n"
152 " [-R number] [-m flag] hostname [server]\n"
153 " -a is equivalent to -v -t ANY\n"
154 " -c specifies query class for non-IN data\n"
155 " -C compares SOA records on authoritative nameservers\n"
156 " -d is equivalent to -v\n"
157 " -l lists all hosts in a domain, using AXFR\n"
158 " -i IP6.INT reverse lookups\n"
159 " -N changes the number of dots allowed before root lookup is done\n"
160 " -r disables recursive processing\n"
161 " -R specifies number of retries for UDP packets\n"
162 " -s a SERVFAIL response should stop query\n"
163 " -t specifies the query type\n"
164 " -T enables TCP/IP mode\n"
165 " -v enables verbose output\n"
166 " -w specifies to wait forever for a reply\n"
167 " -W specifies how long to wait for a reply\n"
168 " -4 use IPv4 query transport only\n"
169 " -6 use IPv6 query transport only\n"
170 " -m set memory debugging flag (trace|record|usage)\n"
171 " -V print version number and exit\n", stderr
);
176 dighost_shutdown(void) {
181 received(int bytes
, isc_sockaddr_t
*from
, dig_query_t
*query
) {
186 char fromtext
[ISC_SOCKADDR_FORMATSIZE
];
187 isc_sockaddr_format(from
, fromtext
, sizeof(fromtext
));
189 diff
= (int) isc_time_microdiff(&now
, &query
->time_sent
);
190 printf("Received %u bytes from %s in %d ms\n",
191 bytes
, fromtext
, diff
/1000);
196 trying(char *frm
, dig_lookup_t
*lookup
) {
200 printf("Trying \"%s\"\n", frm
);
204 say_message(dns_name_t
*name
, const char *msg
, dns_rdata_t
*rdata
,
207 isc_buffer_t
*b
= NULL
;
208 char namestr
[DNS_NAME_FORMATSIZE
];
211 unsigned int bufsize
= BUFSIZ
;
213 dns_name_format(name
, namestr
, sizeof(namestr
));
215 result
= isc_buffer_allocate(mctx
, &b
, bufsize
);
216 check_result(result
, "isc_buffer_allocate");
217 result
= dns_rdata_totext(rdata
, NULL
, b
);
218 if (result
== ISC_R_NOSPACE
) {
223 check_result(result
, "dns_rdata_totext");
224 isc_buffer_usedregion(b
, &r
);
225 if (query
->lookup
->identify_previous_line
) {
226 printf("Nameserver %s:\n\t",
229 printf("%s %s %.*s", namestr
,
230 msg
, (int)r
.length
, (char *)r
.base
);
231 if (query
->lookup
->identify
) {
232 printf(" on server %s", query
->servname
);
238 /* Just for compatibility : not use in host program */
240 printrdataset(dns_name_t
*owner_name
, dns_rdataset_t
*rdataset
,
241 isc_buffer_t
*target
)
250 printsection(dns_message_t
*msg
, dns_section_t sectionid
,
251 const char *section_name
, isc_boolean_t headers
,
254 dns_name_t
*name
, *print_name
;
255 dns_rdataset_t
*rdataset
;
256 dns_rdata_t rdata
= DNS_RDATA_INIT
;
258 isc_result_t result
, loopresult
;
260 dns_name_t empty_name
;
263 isc_boolean_t no_rdata
;
265 if (sectionid
== DNS_SECTION_QUESTION
)
268 no_rdata
= ISC_FALSE
;
271 printf(";; %s SECTION:\n", section_name
);
273 dns_name_init(&empty_name
, NULL
);
275 result
= dns_message_firstname(msg
, sectionid
);
276 if (result
== ISC_R_NOMORE
)
277 return (ISC_R_SUCCESS
);
278 else if (result
!= ISC_R_SUCCESS
)
283 dns_message_currentname(msg
, sectionid
, &name
);
285 isc_buffer_init(&target
, tbuf
, sizeof(tbuf
));
289 for (rdataset
= ISC_LIST_HEAD(name
->list
);
291 rdataset
= ISC_LIST_NEXT(rdataset
, link
)) {
292 if (query
->lookup
->rdtype
== dns_rdatatype_axfr
&&
293 !((!list_addresses
&&
294 (list_type
== dns_rdatatype_any
||
295 rdataset
->type
== list_type
)) ||
297 (rdataset
->type
== dns_rdatatype_a
||
298 rdataset
->type
== dns_rdatatype_aaaa
||
299 rdataset
->type
== dns_rdatatype_ns
||
300 rdataset
->type
== dns_rdatatype_ptr
))))
303 result
= dns_rdataset_totext(rdataset
,
308 if (result
!= ISC_R_SUCCESS
)
312 print_name
= &empty_name
;
316 UNUSED(first
); /* Shut up compiler. */
319 loopresult
= dns_rdataset_first(rdataset
);
320 while (loopresult
== ISC_R_SUCCESS
) {
323 char typebuf
[DNS_RDATATYPE_FORMATSIZE
];
324 char typebuf2
[DNS_RDATATYPE_FORMATSIZE
326 dns_rdataset_current(rdataset
, &rdata
);
328 for (t
= rtypes
; t
->text
!= NULL
; t
++) {
329 if (t
->type
== rdata
.type
) {
335 dns_rdatatype_format(rdata
.type
,
338 snprintf(typebuf2
, sizeof(typebuf2
),
339 "has %s record", typebuf
);
342 say_message(print_name
, rtt
,
344 dns_rdata_reset(&rdata
);
346 dns_rdataset_next(rdataset
);
351 isc_buffer_usedregion(&target
, &r
);
353 printf(";%.*s", (int)r
.length
,
356 printf("%.*s", (int)r
.length
, (char *)r
.base
);
359 result
= dns_message_nextname(msg
, sectionid
);
360 if (result
== ISC_R_NOMORE
)
362 else if (result
!= ISC_R_SUCCESS
)
366 return (ISC_R_SUCCESS
);
370 printrdata(dns_message_t
*msg
, dns_rdataset_t
*rdataset
, dns_name_t
*owner
,
371 const char *set_name
, isc_boolean_t headers
)
380 printf(";; %s SECTION:\n", set_name
);
382 isc_buffer_init(&target
, tbuf
, sizeof(tbuf
));
384 result
= dns_rdataset_totext(rdataset
, owner
, ISC_FALSE
, ISC_FALSE
,
386 if (result
!= ISC_R_SUCCESS
)
388 isc_buffer_usedregion(&target
, &r
);
389 printf("%.*s", (int)r
.length
, (char *)r
.base
);
391 return (ISC_R_SUCCESS
);
395 chase_cnamechain(dns_message_t
*msg
, dns_name_t
*qname
) {
397 dns_rdataset_t
*rdataset
;
398 dns_rdata_cname_t cname
;
399 dns_rdata_t rdata
= DNS_RDATA_INIT
;
400 unsigned int i
= msg
->counts
[DNS_SECTION_ANSWER
];
404 result
= dns_message_findname(msg
, DNS_SECTION_ANSWER
, qname
,
405 dns_rdatatype_cname
, 0, NULL
,
407 if (result
!= ISC_R_SUCCESS
)
409 result
= dns_rdataset_first(rdataset
);
410 check_result(result
, "dns_rdataset_first");
411 dns_rdata_reset(&rdata
);
412 dns_rdataset_current(rdataset
, &rdata
);
413 result
= dns_rdata_tostruct(&rdata
, &cname
, NULL
);
414 check_result(result
, "dns_rdata_tostruct");
415 dns_name_copy(&cname
.cname
, qname
, NULL
);
416 dns_rdata_freestruct(&cname
);
421 printmessage(dig_query_t
*query
, dns_message_t
*msg
, isc_boolean_t headers
) {
422 isc_boolean_t did_flag
= ISC_FALSE
;
423 dns_rdataset_t
*opt
, *tsig
= NULL
;
424 dns_name_t
*tsigname
;
425 isc_result_t result
= ISC_R_SUCCESS
;
431 * We get called multiple times.
432 * Preserve any existing error status.
434 force_error
= (seen_error
== 1) ? 1 : 0;
436 if (listed_server
&& !printed_server
) {
437 char sockstr
[ISC_SOCKADDR_FORMATSIZE
];
439 printf("Using domain server:\n");
440 printf("Name: %s\n", query
->userarg
);
441 isc_sockaddr_format(&query
->sockaddr
, sockstr
,
443 printf("Address: %s\n", sockstr
);
444 printf("Aliases: \n\n");
445 printed_server
= ISC_TRUE
;
448 if (msg
->rcode
!= 0) {
449 char namestr
[DNS_NAME_FORMATSIZE
];
450 dns_name_format(query
->lookup
->name
, namestr
, sizeof(namestr
));
452 if (query
->lookup
->identify_previous_line
)
453 printf("Nameserver %s:\n\t%s not found: %d(%s)\n",
455 (msg
->rcode
!= dns_rcode_nxdomain
) ? namestr
:
456 query
->lookup
->textname
, msg
->rcode
,
457 rcode_totext(msg
->rcode
));
459 printf("Host %s not found: %d(%s)\n",
460 (msg
->rcode
!= dns_rcode_nxdomain
) ? namestr
:
461 query
->lookup
->textname
, msg
->rcode
,
462 rcode_totext(msg
->rcode
));
463 return (ISC_R_SUCCESS
);
466 if (default_lookups
&& query
->lookup
->rdtype
== dns_rdatatype_a
) {
467 char namestr
[DNS_NAME_FORMATSIZE
];
468 dig_lookup_t
*lookup
;
469 dns_fixedname_t fixed
;
472 /* Add AAAA and MX lookups. */
473 dns_fixedname_init(&fixed
);
474 name
= dns_fixedname_name(&fixed
);
475 dns_name_copy(query
->lookup
->name
, name
, NULL
);
476 chase_cnamechain(msg
, name
);
477 dns_name_format(name
, namestr
, sizeof(namestr
));
478 lookup
= clone_lookup(query
->lookup
, ISC_FALSE
);
479 if (lookup
!= NULL
) {
480 strncpy(lookup
->textname
, namestr
,
481 sizeof(lookup
->textname
));
482 lookup
->textname
[sizeof(lookup
->textname
)-1] = 0;
483 lookup
->rdtype
= dns_rdatatype_aaaa
;
484 lookup
->rdtypeset
= ISC_TRUE
;
485 lookup
->origin
= NULL
;
486 lookup
->retries
= tries
;
487 ISC_LIST_APPEND(lookup_list
, lookup
, link
);
489 lookup
= clone_lookup(query
->lookup
, ISC_FALSE
);
490 if (lookup
!= NULL
) {
491 strncpy(lookup
->textname
, namestr
,
492 sizeof(lookup
->textname
));
493 lookup
->textname
[sizeof(lookup
->textname
)-1] = 0;
494 lookup
->rdtype
= dns_rdatatype_mx
;
495 lookup
->rdtypeset
= ISC_TRUE
;
496 lookup
->origin
= NULL
;
497 lookup
->retries
= tries
;
498 ISC_LIST_APPEND(lookup_list
, lookup
, link
);
503 printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
504 opcodetext
[msg
->opcode
], rcode_totext(msg
->rcode
),
506 printf(";; flags: ");
507 if ((msg
->flags
& DNS_MESSAGEFLAG_QR
) != 0) {
511 if ((msg
->flags
& DNS_MESSAGEFLAG_AA
) != 0) {
512 printf("%saa", did_flag
? " " : "");
515 if ((msg
->flags
& DNS_MESSAGEFLAG_TC
) != 0) {
516 printf("%stc", did_flag
? " " : "");
519 if ((msg
->flags
& DNS_MESSAGEFLAG_RD
) != 0) {
520 printf("%srd", did_flag
? " " : "");
523 if ((msg
->flags
& DNS_MESSAGEFLAG_RA
) != 0) {
524 printf("%sra", did_flag
? " " : "");
527 if ((msg
->flags
& DNS_MESSAGEFLAG_AD
) != 0) {
528 printf("%sad", did_flag
? " " : "");
531 if ((msg
->flags
& DNS_MESSAGEFLAG_CD
) != 0) {
532 printf("%scd", did_flag
? " " : "");
536 printf("; QUERY: %u, ANSWER: %u, "
537 "AUTHORITY: %u, ADDITIONAL: %u\n",
538 msg
->counts
[DNS_SECTION_QUESTION
],
539 msg
->counts
[DNS_SECTION_ANSWER
],
540 msg
->counts
[DNS_SECTION_AUTHORITY
],
541 msg
->counts
[DNS_SECTION_ADDITIONAL
]);
542 opt
= dns_message_getopt(msg
);
544 printf(";; EDNS: version: %u, udp=%u\n",
545 (unsigned int)((opt
->ttl
& 0x00ff0000) >> 16),
546 (unsigned int)opt
->rdclass
);
548 tsig
= dns_message_gettsig(msg
, &tsigname
);
550 printf(";; PSEUDOSECTIONS: TSIG\n");
552 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_QUESTION
]) &&
555 result
= printsection(msg
, DNS_SECTION_QUESTION
, "QUESTION",
557 if (result
!= ISC_R_SUCCESS
)
560 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_ANSWER
])) {
563 result
= printsection(msg
, DNS_SECTION_ANSWER
, "ANSWER",
564 ISC_TF(!short_form
), query
);
565 if (result
!= ISC_R_SUCCESS
)
569 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_AUTHORITY
]) &&
572 result
= printsection(msg
, DNS_SECTION_AUTHORITY
, "AUTHORITY",
574 if (result
!= ISC_R_SUCCESS
)
577 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_ADDITIONAL
]) &&
580 result
= printsection(msg
, DNS_SECTION_ADDITIONAL
,
581 "ADDITIONAL", ISC_TRUE
, query
);
582 if (result
!= ISC_R_SUCCESS
)
585 if ((tsig
!= NULL
) && !short_form
) {
587 result
= printrdata(msg
, tsig
, tsigname
,
588 "PSEUDOSECTION TSIG", ISC_TRUE
);
589 if (result
!= ISC_R_SUCCESS
)
595 if (short_form
&& !default_lookups
&&
596 ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_ANSWER
])) {
597 char namestr
[DNS_NAME_FORMATSIZE
];
598 char typestr
[DNS_RDATATYPE_FORMATSIZE
];
599 dns_name_format(query
->lookup
->name
, namestr
, sizeof(namestr
));
600 dns_rdatatype_format(query
->lookup
->rdtype
, typestr
,
602 printf("%s has no %s record\n", namestr
, typestr
);
604 seen_error
= force_error
;
608 static const char * optstring
= "46ac:dilnm:rst:vVwCDN:R:TW:";
613 fputs("host " VERSION
"\n", stderr
);
617 pre_parse_args(int argc
, char **argv
) {
620 while ((c
= isc_commandline_parse(argc
, argv
, optstring
)) != -1) {
623 memdebugging
= ISC_TRUE
;
624 if (strcasecmp("trace", isc_commandline_argument
) == 0)
625 isc_mem_debugging
|= ISC_MEM_DEBUGTRACE
;
626 else if (!strcasecmp("record",
627 isc_commandline_argument
) == 0)
628 isc_mem_debugging
|= ISC_MEM_DEBUGRECORD
;
629 else if (strcasecmp("usage",
630 isc_commandline_argument
) == 0)
631 isc_mem_debugging
|= ISC_MEM_DEBUGUSAGE
;
654 debugtiming
= ISC_TRUE
;
655 debugging
= ISC_TRUE
;
665 isc_commandline_reset
= ISC_TRUE
;
666 isc_commandline_index
= 1;
670 parse_args(isc_boolean_t is_batchfile
, int argc
, char **argv
) {
671 char hostname
[MXNAME
];
672 dig_lookup_t
*lookup
;
676 isc_result_t result
= ISC_R_SUCCESS
;
677 dns_rdatatype_t rdtype
;
678 dns_rdataclass_t rdclass
;
679 isc_uint32_t serial
= 0;
681 UNUSED(is_batchfile
);
683 lookup
= make_empty_lookup();
685 lookup
->servfail_stops
= ISC_FALSE
;
686 lookup
->comments
= ISC_FALSE
;
688 while ((c
= isc_commandline_parse(argc
, argv
, optstring
)) != -1) {
691 lookup
->tcp_mode
= ISC_TRUE
;
692 lookup
->rdtype
= dns_rdatatype_axfr
;
693 lookup
->rdtypeset
= ISC_TRUE
;
698 short_form
= ISC_FALSE
;
701 lookup
->recurse
= ISC_FALSE
;
704 if (strncasecmp(isc_commandline_argument
,
706 rdtype
= dns_rdatatype_ixfr
;
707 /* XXXMPA add error checking */
708 serial
= strtoul(isc_commandline_argument
+ 5,
710 result
= ISC_R_SUCCESS
;
712 tr
.base
= isc_commandline_argument
;
713 tr
.length
= strlen(isc_commandline_argument
);
714 result
= dns_rdatatype_fromtext(&rdtype
,
715 (isc_textregion_t
*)&tr
);
718 if (result
!= ISC_R_SUCCESS
) {
720 fatal("invalid type: %s\n",
721 isc_commandline_argument
);
723 if (!lookup
->rdtypeset
||
724 lookup
->rdtype
!= dns_rdatatype_axfr
)
725 lookup
->rdtype
= rdtype
;
726 lookup
->rdtypeset
= ISC_TRUE
;
730 if (rdtype
== dns_rdatatype_axfr
) {
732 list_type
= dns_rdatatype_any
;
733 short_form
= ISC_FALSE
;
734 lookup
->tcp_mode
= ISC_TRUE
;
735 } else if (rdtype
== dns_rdatatype_ixfr
) {
736 lookup
->ixfr_serial
= serial
;
737 lookup
->tcp_mode
= ISC_TRUE
;
740 } else if (rdtype
== dns_rdatatype_a
||
741 rdtype
== dns_rdatatype_aaaa
||
742 rdtype
== dns_rdatatype_mx
) {
743 idnoptions
= IDN_ASCCHECK
;
748 list_addresses
= ISC_FALSE
;
749 default_lookups
= ISC_FALSE
;
752 tr
.base
= isc_commandline_argument
;
753 tr
.length
= strlen(isc_commandline_argument
);
754 result
= dns_rdataclass_fromtext(&rdclass
,
755 (isc_textregion_t
*)&tr
);
757 if (result
!= ISC_R_SUCCESS
) {
759 fatal("invalid class: %s\n",
760 isc_commandline_argument
);
762 lookup
->rdclass
= rdclass
;
763 lookup
->rdclassset
= ISC_TRUE
;
765 default_lookups
= ISC_FALSE
;
768 if (!lookup
->rdtypeset
||
769 lookup
->rdtype
!= dns_rdatatype_axfr
)
770 lookup
->rdtype
= dns_rdatatype_any
;
774 list_type
= dns_rdatatype_any
;
775 list_addresses
= ISC_FALSE
;
776 lookup
->rdtypeset
= ISC_TRUE
;
777 short_form
= ISC_FALSE
;
778 default_lookups
= ISC_FALSE
;
781 lookup
->ip6_int
= ISC_TRUE
;
787 /* Handled by pre_parse_args(). */
791 * The timer routines are coded such that
792 * timeout==MAXINT doesn't enable the timer
797 timeout
= atoi(isc_commandline_argument
);
802 tries
= atoi(isc_commandline_argument
) + 1;
807 lookup
->tcp_mode
= ISC_TRUE
;
810 debug("showing all SOAs");
811 lookup
->rdtype
= dns_rdatatype_ns
;
812 lookup
->rdtypeset
= ISC_TRUE
;
813 lookup
->rdclass
= dns_rdataclass_in
;
814 lookup
->rdclassset
= ISC_TRUE
;
815 lookup
->ns_search_only
= ISC_TRUE
;
816 lookup
->trace_root
= ISC_TRUE
;
817 lookup
->identify_previous_line
= ISC_TRUE
;
818 default_lookups
= ISC_FALSE
;
821 debug("setting NDOTS to %s",
822 isc_commandline_argument
);
823 ndots
= atoi(isc_commandline_argument
);
826 /* Handled by pre_parse_args(). */
830 isc_net_disableipv6();
831 have_ipv6
= ISC_FALSE
;
833 fatal("can't find IPv4 networking");
837 isc_net_disableipv4();
838 have_ipv4
= ISC_FALSE
;
840 fatal("can't find IPv6 networking");
843 lookup
->servfail_stops
= ISC_TRUE
;
848 lookup
->retries
= tries
;
850 if (isc_commandline_index
>= argc
)
853 strlcpy(hostname
, argv
[isc_commandline_index
], sizeof(hostname
));
855 if (argc
> isc_commandline_index
+ 1) {
856 set_nameserver(argv
[isc_commandline_index
+1]);
857 debug("server is %s", argv
[isc_commandline_index
+1]);
858 listed_server
= ISC_TRUE
;
862 lookup
->pending
= ISC_FALSE
;
863 if (get_reverse(store
, sizeof(store
), hostname
,
864 lookup
->ip6_int
, ISC_TRUE
) == ISC_R_SUCCESS
) {
865 strncpy(lookup
->textname
, store
, sizeof(lookup
->textname
));
866 lookup
->textname
[sizeof(lookup
->textname
)-1] = 0;
867 lookup
->rdtype
= dns_rdatatype_ptr
;
868 lookup
->rdtypeset
= ISC_TRUE
;
869 default_lookups
= ISC_FALSE
;
871 strncpy(lookup
->textname
, hostname
, sizeof(lookup
->textname
));
872 lookup
->textname
[sizeof(lookup
->textname
)-1]=0;
873 usesearch
= ISC_TRUE
;
875 lookup
->new_search
= ISC_TRUE
;
876 ISC_LIST_APPEND(lookup_list
, lookup
, link
);
880 main(int argc
, char **argv
) {
885 ISC_LIST_INIT(lookup_list
);
886 ISC_LIST_INIT(server_list
);
887 ISC_LIST_INIT(search_list
);
891 idnoptions
= IDN_ASCCHECK
;
896 pre_parse_args(argc
, argv
);
897 result
= isc_app_start();
898 check_result(result
, "isc_app_start");
900 parse_args(ISC_FALSE
, argc
, argv
);
902 result
= isc_app_onrun(mctx
, global_task
, onrun_callback
, NULL
);
903 check_result(result
, "isc_app_onrun");
908 return ((seen_error
== 0) ? 0 : 1);