about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--NEWS14
-rw-r--r--resolv/res_query.c7
-rw-r--r--resolv/res_send.c2
4 files changed, 24 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index cacf88bbc0..7aa7bd2ca7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-04-30  Siddhesh Poyarekar  <siddhesh@redhat.com>
+	    Atsushi Onoe  <atsushi@onoe.org>
+
+	[BZ #14308]
+	[BZ #12994]
+	[BZ #13651]
+	* resolv/res_query.c (__libc_res_nsearch): Return if at least
+	one response is valid.
+	* resolv/res_send.c (send_dg): Check for validity of other
+	response if the current response is a referral.
+
 2014-04-29  Steve Ellcey  <sellcey@mips.com>
 
 	* iconv/skeleton.c (ONE_DIRECTION): Set default value if not set.
diff --git a/NEWS b/NEWS
index c890a2618f..10d2626088 100644
--- a/NEWS
+++ b/NEWS
@@ -9,13 +9,13 @@ Version 2.20
 
 * The following bugs are resolved with this release:
 
-  6804, 13347, 14770, 15347, 15514, 15804, 15894, 16002, 16198, 16284,
-  16348, 16349, 16357, 16362, 16447, 16532, 16545, 16574, 16599, 16600,
-  16609, 16610, 16611, 16613, 16619, 16623, 16629, 16632, 16634, 16639,
-  16642, 16648, 16649, 16670, 16674, 16677, 16680, 16683, 16689, 16695,
-  16701, 16706, 16707, 16712, 16713, 16714, 16731, 16739, 16740, 16743,
-  16754, 16758, 16759, 16760, 16770, 16786, 16789, 16799, 16800, 16815,
-  16823, 16824, 16831, 16838, 16854.
+  6804, 12994, 13347, 13651, 14308, 14770, 15347, 15514, 15804, 15894,
+  16002, 16198, 16284, 16348, 16349, 16357, 16362, 16447, 16532, 16545,
+  16574, 16599, 16600, 16609, 16610, 16611, 16613, 16619, 16623, 16629,
+  16632, 16634, 16639, 16642, 16648, 16649, 16670, 16674, 16677, 16680,
+  16683, 16689, 16695, 16701, 16706, 16707, 16712, 16713, 16714, 16731,
+  16739, 16740, 16743, 16754, 16758, 16759, 16760, 16770, 16786, 16789,
+  16799, 16800, 16815, 16823, 16824, 16831, 16838, 16854.
 
 * Running the testsuite no longer terminates as soon as a test fails.
   Instead, a file tests.sum (xtests.sum from "make xcheck") is generated,
diff --git a/resolv/res_query.c b/resolv/res_query.c
index a9db837a01..4e6612c283 100644
--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -382,7 +382,9 @@ __libc_res_nsearch(res_state statp,
 					      answer, anslen, answerp,
 					      answerp2, nanswerp2, resplen2,
 					      answerp2_malloced);
-		if (ret > 0 || trailing_dot)
+		if (ret > 0 || trailing_dot
+		    /* If the second response is valid then we use that.  */
+		    || (ret == 0 && answerp2 != NULL && resplen2 > 0))
 			return (ret);
 		saved_herrno = h_errno;
 		tried_as_is++;
@@ -422,7 +424,8 @@ __libc_res_nsearch(res_state statp,
 						      answer, anslen, answerp,
 						      answerp2, nanswerp2,
 						      resplen2, answerp2_malloced);
-			if (ret > 0)
+			if (ret > 0 || (ret == 0 && answerp2 != NULL
+					&& resplen2 > 0))
 				return (ret);
 
 			if (answerp && *answerp != answer) {
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 60743dfa8c..3273d55ceb 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -1351,6 +1351,7 @@ send_dg(res_state statp,
 				(*thisresplenp > *thisanssizp)
 				? *thisanssizp : *thisresplenp);
 
+		next_ns:
 			if (recvresp1 || (buf2 != NULL && recvresp2)) {
 			  *resplen2 = 0;
 			  return resplen;
@@ -1368,7 +1369,6 @@ send_dg(res_state statp,
 			    goto wait;
 			  }
 
-		next_ns:
 			__res_iclose(statp, false);
 			/* don't retry if called from dig */
 			if (!statp->pfcode)