a2a915
From ba56e64560c5907e99186116623f2899b8520b68 Mon Sep 17 00:00:00 2001
a2a915
From: Petr Mensik <pemensik@redhat.com>
a2a915
Date: Wed, 2 Oct 2019 14:00:13 +0200
a2a915
Subject: [PATCH] Revert "3640.   [bug]           ndots was not being checked
a2a915
 when searching.  Only"
a2a915
a2a915
This reverts commit 8afea636ab0c07399aa3e2410b2cfbd41099df98.
a2a915
a2a915
Revert is only partial. Absolute names does not search. Name with dots
a2a915
tries first absolute, then relative with search appended.
a2a915
---
a2a915
 bin/dig/dighost.c        | 8 +++-----
a2a915
 bin/dig/nslookup.c       | 3 ++-
a2a915
 bin/dig/nslookup.docbook | 2 +-
a2a915
 3 files changed, 6 insertions(+), 7 deletions(-)
a2a915
a2a915
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
a2a915
index d46379ddc2..30b19b3121 100644
a2a915
--- a/bin/dig/dighost.c
a2a915
+++ b/bin/dig/dighost.c
a2a915
@@ -2273,14 +2273,12 @@ next_origin(dig_lookup_t *oldlookup) {
a2a915
 		return (ISC_FALSE);
a2a915
 
a2a915
 	/*
a2a915
-	 * Check for a absolute name or ndots being met.
a2a915
+	 * Check for a absolute name.
a2a915
 	 */
a2a915
 	name = dns_fixedname_initname(&fixed);
a2a915
 	result = dns_name_fromstring2(name, oldlookup->textname, NULL,
a2a915
 				      0, NULL);
a2a915
-	if (result == ISC_R_SUCCESS &&
a2a915
-	    (dns_name_isabsolute(name) ||
a2a915
-	     (int)dns_name_countlabels(name) > ndots))
a2a915
+	if (result == ISC_R_SUCCESS && dns_name_isabsolute(name))
a2a915
 		return (ISC_FALSE);
a2a915
 
a2a915
 	if (oldlookup->origin == NULL && !oldlookup->need_search)
a2a915
@@ -4215,7 +4213,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
a2a915
 	} else if (l->sendcookie && msg->opt != NULL)
a2a915
 		process_opt(l, msg);
a2a915
 	if (!l->doing_xfr || l->xfr_q == query) {
a2a915
-		if (msg->rcode == dns_rcode_nxdomain &&
a2a915
+		if (msg->rcode != dns_rcode_noerror &&
a2a915
 		    (l->origin != NULL || l->need_search)) {
a2a915
 			if (!next_origin(query->lookup) || showsearch) {
a2a915
 				dighost_printmessage(query, msg, ISC_TRUE);
a2a915
diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c
a2a915
index 89a615bf1c..5c8aa51a48 100644
a2a915
--- a/bin/dig/nslookup.c
a2a915
+++ b/bin/dig/nslookup.c
a2a915
@@ -472,7 +472,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
a2a915
 		dns_name_format(query->lookup->name,
a2a915
 				nametext, sizeof(nametext));
a2a915
 		printf("** server can't find %s: %s\n",
a2a915
-		       nametext, rcode_totext(msg->rcode));
a2a915
+		       (msg->rcode != dns_rcode_nxdomain) ? nametext :
a2a915
+		       query->lookup->textname, rcode_totext(msg->rcode));
a2a915
 		debug("returning with rcode == 0");
a2a915
 
a2a915
 		/* the lookup failed */
a2a915
diff --git a/bin/dig/nslookup.docbook b/bin/dig/nslookup.docbook
a2a915
index 86a09c658e..e3e8869e33 100644
a2a915
--- a/bin/dig/nslookup.docbook
a2a915
+++ b/bin/dig/nslookup.docbook
a2a915
@@ -412,7 +412,7 @@ nslookup -query=hinfo  -timeout=10
a2a915
                 <listitem>
a2a915
                   <para>
a2a915
 		    Set the number of dots (label separators) in a domain
a2a915
-		    that will disable searching.  Absolute names always
a2a915
+		    that will reverse order of searching.  Absolute names always
a2a915
 		    stop searching.
a2a915
                   </para>
a2a915
                 </listitem>
a2a915
-- 
a2a915
2.20.1
a2a915