diff -up bind-9.7.3/bin/dig/dig.c.rh674334 bind-9.7.3/bin/dig/dig.c --- bind-9.7.3/bin/dig/dig.c.rh674334 2010-05-13 02:42:26.000000000 +0200 +++ bind-9.7.3/bin/dig/dig.c 2011-02-18 13:37:45.830518968 +0100 @@ -44,8 +44,6 @@ #include #include -#include - #include #define ADD_STRING(b, s) { \ @@ -1429,30 +1427,6 @@ preparse_args(int argc, char **argv) { } static void -getaddresses(dig_lookup_t *lookup, const char *host) { - isc_result_t result; - isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES]; - isc_netaddr_t netaddr; - int count, i; - dig_server_t *srv; - char tmp[ISC_NETADDR_FORMATSIZE]; - - result = bind9_getaddresses(host, 0, sockaddrs, - DIG_MAX_ADDRESSES, &count); - if (result != ISC_R_SUCCESS) - fatal("couldn't get address for '%s': %s", - host, isc_result_totext(result)); - - for (i = 0; i < count; i++) { - isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]); - isc_netaddr_format(&netaddr, tmp, sizeof(tmp)); - srv = make_server(tmp, host); - ISC_LIST_APPEND(lookup->my_server_list, srv, link); - } - addresscount = count; -} - -static void parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, int argc, char **argv) { isc_result_t result; @@ -1546,7 +1520,7 @@ parse_args(isc_boolean_t is_batchfile, i if (strncmp(rv[0], "%", 1) == 0) break; if (strncmp(rv[0], "@", 1) == 0) { - getaddresses(lookup, &rv[0][1]); + addresscount = getaddresses(lookup, &rv[0][1]); } else if (rv[0][0] == '+') { plus_option(&rv[0][1], is_batchfile, lookup); diff -up bind-9.7.3/bin/dig/dighost.c.rh674334 bind-9.7.3/bin/dig/dighost.c --- bind-9.7.3/bin/dig/dighost.c.rh674334 2011-02-18 13:37:45.820518990 +0100 +++ bind-9.7.3/bin/dig/dighost.c 2011-02-18 13:37:45.830518968 +0100 @@ -1808,8 +1808,7 @@ followup_lookup(dns_message_t *msg, dig_ dns_rdata_freestruct(&ns); /* Initialize lookup if we've not yet */ - debug("found NS %d %s", numLookups, namestr); - numLookups++; + debug("found NS %s", namestr); if (!success) { success = ISC_TRUE; lookup_counter++; @@ -1831,9 +1830,8 @@ followup_lookup(dns_message_t *msg, dig_ domain = dns_fixedname_name(&lookup->fdomain); dns_name_copy(name, domain, NULL); } - srv = make_server(namestr, namestr); - debug("adding server %s", srv->servername); - ISC_LIST_APPEND(lookup->my_server_list, srv, link); + debug("adding server %s", namestr); + numLookups += getaddresses(lookup, namestr); dns_rdata_reset(&rdata); } } @@ -3608,6 +3606,31 @@ get_address(char *host, in_port_t port, return (ISC_R_SUCCESS); } +int +getaddresses(dig_lookup_t *lookup, const char *host) { + isc_result_t result; + isc_sockaddr_t sockaddrs[DIG_MAX_ADDRESSES]; + isc_netaddr_t netaddr; + int count, i; + dig_server_t *srv; + char tmp[ISC_NETADDR_FORMATSIZE]; + + result = bind9_getaddresses(host, 0, sockaddrs, + DIG_MAX_ADDRESSES, &count); + if (result != ISC_R_SUCCESS) + fatal("couldn't get address for '%s': %s", + host, isc_result_totext(result)); + + for (i = 0; i < count; i++) { + isc_netaddr_fromsockaddr(&netaddr, &sockaddrs[i]); + isc_netaddr_format(&netaddr, tmp, sizeof(tmp)); + srv = make_server(tmp, host); + ISC_LIST_APPEND(lookup->my_server_list, srv, link); + } + + return count; +} + /*% * Initiate either a TCP or UDP lookup */ diff -up bind-9.7.3/bin/dig/include/dig/dig.h.rh674334 bind-9.7.3/bin/dig/include/dig/dig.h --- bind-9.7.3/bin/dig/include/dig/dig.h.rh674334 2011-02-18 13:37:45.820518990 +0100 +++ bind-9.7.3/bin/dig/include/dig/dig.h 2011-02-18 13:37:45.830518968 +0100 @@ -289,6 +289,9 @@ extern int idnoptions; isc_result_t get_address(char *host, in_port_t port, isc_sockaddr_t *sockaddr); +int +getaddresses(dig_lookup_t *lookup, const char *host); + isc_result_t get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int, isc_boolean_t strict);