diff -up bind-9.3.6-P1/bin/dig/dig.c.rh570851 bind-9.3.6-P1/bin/dig/dig.c --- bind-9.3.6-P1/bin/dig/dig.c.rh570851 2010-10-18 13:54:59.602786692 +0200 +++ bind-9.3.6-P1/bin/dig/dig.c 2010-10-18 13:56:04.082759804 +0200 @@ -63,7 +63,7 @@ static int addresscount = 0; static char domainopt[DNS_NAME_MAXTEXT]; -static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE, +static isc_boolean_t printcmd = ISC_TRUE, ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE; @@ -963,6 +963,7 @@ plus_option(char *option, isc_boolean_t break; case 'i': /* tries */ FULLCHECK("tries"); + tries_set = ISC_TRUE; if (value == NULL) goto need_value; if (!state) @@ -1623,6 +1624,8 @@ int main(int argc, char **argv) { isc_result_t result; + short_form = ISC_FALSE; + ISC_LIST_INIT(lookup_list); ISC_LIST_INIT(server_list); ISC_LIST_INIT(search_list); diff -up bind-9.3.6-P1/bin/dig/dighost.c.rh570851 bind-9.3.6-P1/bin/dig/dighost.c --- bind-9.3.6-P1/bin/dig/dighost.c.rh570851 2010-10-18 13:48:30.662948876 +0200 +++ bind-9.3.6-P1/bin/dig/dighost.c 2010-10-18 13:48:30.682948868 +0200 @@ -102,7 +102,9 @@ isc_boolean_t cancel_now = ISC_FALSE, usesearch = ISC_FALSE, qr = ISC_FALSE, - is_dst_up = ISC_FALSE; + is_dst_up = ISC_FALSE, + tries_set = ISC_FALSE, + short_form = ISC_TRUE; in_port_t port = 53; unsigned int timeout = 0; isc_mem_t *mctx = NULL; @@ -981,6 +983,23 @@ setup_system(void) { debug("ndots is %d.", ndots); } + if (lwconf->resdebug) { + short_form = ISC_FALSE; + debug("verbose is on"); + } + + if (!tries_set && lwconf->attempts) { + tries = lwconf->attempts + 1; + if (tries < 2) + tries = 2; + debug("tries is %d.", tries); + } + + if (timeout == 0 && lwconf->timeout) { + timeout = lwconf->timeout; + debug("timeout is %d.", timeout); + } + copy_server_list(lwconf, &server_list); /* If we don't find a nameserver fall back to localhost */ diff -up bind-9.3.6-P1/bin/dig/host.c.rh570851 bind-9.3.6-P1/bin/dig/host.c --- bind-9.3.6-P1/bin/dig/host.c.rh570851 2010-10-18 13:48:30.622948894 +0200 +++ bind-9.3.6-P1/bin/dig/host.c 2010-10-18 13:48:30.682948868 +0200 @@ -41,7 +41,7 @@ #include <dig/dig.h> -static isc_boolean_t short_form = ISC_TRUE, listed_server = ISC_FALSE; +static isc_boolean_t listed_server = ISC_FALSE; static isc_boolean_t default_lookups = ISC_TRUE; static int seen_error = -1; static isc_boolean_t list_addresses = ISC_TRUE; @@ -679,6 +679,7 @@ parse_args(isc_boolean_t is_batchfile, i tries = atoi(isc_commandline_argument) + 1; if (tries < 2) tries = 2; + tries_set = ISC_TRUE; break; case 'T': lookup->tcp_mode = ISC_TRUE; diff -up bind-9.3.6-P1/bin/dig/include/dig/dig.h.rh570851 bind-9.3.6-P1/bin/dig/include/dig/dig.h --- bind-9.3.6-P1/bin/dig/include/dig/dig.h.rh570851 2007-08-28 09:19:07.000000000 +0200 +++ bind-9.3.6-P1/bin/dig/include/dig/dig.h 2010-10-18 13:48:30.682948868 +0200 @@ -260,7 +260,8 @@ extern isc_boolean_t debugging, memdebug extern char *progname; extern int tries; extern int fatalexit; - +extern isc_boolean_t tries_set; +extern isc_boolean_t short_form; /* * Routines in dighost.c. */ diff -up bind-9.3.6-P1/bin/dig/nslookup.c.rh570851 bind-9.3.6-P1/bin/dig/nslookup.c --- bind-9.3.6-P1/bin/dig/nslookup.c.rh570851 2010-10-18 13:48:30.622948894 +0200 +++ bind-9.3.6-P1/bin/dig/nslookup.c 2010-10-18 13:56:24.112751452 +0200 @@ -44,8 +44,7 @@ #include <dig/dig.h> -static isc_boolean_t short_form = ISC_TRUE, - tcpmode = ISC_FALSE, +static isc_boolean_t tcpmode = ISC_FALSE, identify = ISC_FALSE, stats = ISC_TRUE, comments = ISC_TRUE, section_question = ISC_TRUE, section_answer = ISC_TRUE, section_authority = ISC_TRUE, @@ -555,8 +554,10 @@ static void set_tries(const char *value) { isc_uint32_t n; isc_result_t result = parse_uint(&n, value, INT_MAX, "tries"); - if (result == ISC_R_SUCCESS) + if (result == ISC_R_SUCCESS) { + tries_set = ISC_TRUE; tries = n; + } } static void diff -up bind-9.3.6-P1/lib/lwres/include/lwres/lwres.h.rh570851 bind-9.3.6-P1/lib/lwres/include/lwres/lwres.h --- bind-9.3.6-P1/lib/lwres/include/lwres/lwres.h.rh570851 2007-08-28 09:19:18.000000000 +0200 +++ bind-9.3.6-P1/lib/lwres/include/lwres/lwres.h 2010-10-18 13:48:30.682948868 +0200 @@ -240,6 +240,8 @@ typedef struct { lwres_uint8_t resdebug; /* non-zero if 'options debug' set */ lwres_uint8_t ndots; /* set to n in 'options ndots:n' */ lwres_uint8_t no_tld_query; /* non-zero if 'options no_tld_query' */ + lwres_int32_t attempts; /* set to n in 'options attempts:n' */ + lwres_int32_t timeout; /* set to n in 'options timeout:n' */ } lwres_conf_t; #define LWRES_ADDRTYPE_V4 0x00000001U /* ipv4 */ diff -up bind-9.3.6-P1/lib/lwres/lwconfig.c.rh570851 bind-9.3.6-P1/lib/lwres/lwconfig.c --- bind-9.3.6-P1/lib/lwres/lwconfig.c.rh570851 2006-10-04 01:50:50.000000000 +0200 +++ bind-9.3.6-P1/lib/lwres/lwconfig.c 2010-10-18 13:48:30.682948868 +0200 @@ -219,6 +219,8 @@ lwres_conf_init(lwres_context_t *ctx) { confdata->resdebug = 0; confdata->ndots = 1; confdata->no_tld_query = 0; + confdata->attempts = 0; + confdata->timeout = 0; for (i = 0; i < LWRES_CONFMAXNAMESERVERS; i++) lwres_resetaddr(&confdata->nameservers[i]); @@ -270,6 +272,8 @@ lwres_conf_clear(lwres_context_t *ctx) { confdata->resdebug = 0; confdata->ndots = 1; confdata->no_tld_query = 0; + confdata->attempts = 0; + confdata->timeout = 0; } static lwres_result_t @@ -508,6 +512,8 @@ static lwres_result_t lwres_conf_parseoption(lwres_context_t *ctx, FILE *fp) { int delim; long ndots; + long attempts; + long timeout; char *p; char word[LWRES_CONFMAXLINELEN]; lwres_conf_t *confdata; @@ -524,6 +530,8 @@ lwres_conf_parseoption(lwres_context_t * confdata->resdebug = 1; } else if (strcmp("no_tld_query", word) == 0) { confdata->no_tld_query = 1; + } else if (strcmp("debug", word) == 0) { + confdata->resdebug = 1; } else if (strncmp("ndots:", word, 6) == 0) { ndots = strtol(word + 6, &p, 10); if (*p != '\0') /* Bad string. */ @@ -531,6 +539,18 @@ lwres_conf_parseoption(lwres_context_t * if (ndots < 0 || ndots > 0xff) /* Out of range. */ return (LWRES_R_FAILURE); confdata->ndots = (lwres_uint8_t)ndots; + } else if (strncmp("timeout:", word, 8) == 0) { + timeout = strtol(word + 8, &p, 10); + if (*p != '\0') /* Bad string. */ + return (LWRES_R_FAILURE); + confdata->timeout = (lwres_int32_t)timeout; + } else if (strncmp("attempts:", word, 9) == 0) { + attempts = strtol(word + 9, &p, 10); + if (*p != '\0') /* Bad string. */ + return (LWRES_R_FAILURE); + if (attempts < 0) /* Out of range. */ + return (LWRES_R_FAILURE); + confdata->attempts = (lwres_int32_t)attempts; } if (delim == EOF || delim == '\n') @@ -692,6 +712,12 @@ lwres_conf_print(lwres_context_t *ctx, F if (confdata->no_tld_query) fprintf(fp, "options no_tld_query\n"); + if (confdata->attempts) + fprintf(fp, "options attempts:%d\n", confdata->attempts); + + if (confdata->timeout) + fprintf(fp, "options timeout:%d\n", confdata->timeout); + return (LWRES_R_SUCCESS); }