mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 16:50:00 -04:00
nslookup exit with error if unsuccessful
3335. [func] nslookup: return a nonzero exit code when unable to get an answer. [RT #29492]
This commit is contained in:
parent
5f873199f7
commit
78e4ced5b7
2 changed files with 11 additions and 1 deletions
3
CHANGES
3
CHANGES
|
|
@ -1,3 +1,6 @@
|
|||
3335. [func] nslookup: return a nonzero exit code when unable
|
||||
to get an answer. [RT #29492]
|
||||
|
||||
3334. [bug] Hold a zone table reference while performing a
|
||||
asyncronous load of a zone. [RT #28326]
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ static isc_boolean_t in_use = ISC_FALSE;
|
|||
static char defclass[MXRD] = "IN";
|
||||
static char deftype[MXRD] = "A";
|
||||
static isc_event_t *global_event = NULL;
|
||||
static int query_error = 1, print_error = 0;
|
||||
|
||||
static char domainopt[DNS_NAME_MAXTEXT];
|
||||
|
||||
|
|
@ -414,6 +415,9 @@ isc_result_t
|
|||
printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
||||
char servtext[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
/* I've we've gotten this far, we've reached a server. */
|
||||
query_error = 0;
|
||||
|
||||
debug("printmessage()");
|
||||
|
||||
isc_sockaddr_format(&query->sockaddr, servtext, sizeof(servtext));
|
||||
|
|
@ -441,6 +445,9 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
|
|||
(msg->rcode != dns_rcode_nxdomain) ? nametext :
|
||||
query->lookup->textname, rcode_totext(msg->rcode));
|
||||
debug("returning with rcode == 0");
|
||||
|
||||
/* the lookup failed */
|
||||
print_error |= 1;
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
@ -909,5 +916,5 @@ main(int argc, char **argv) {
|
|||
destroy_libs();
|
||||
isc_app_finish();
|
||||
|
||||
return (0);
|
||||
return (query_error | print_error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue