Pull up following revision(s) (requested by christos in ticket #598): netbsd-6
authorriz <riz@NetBSD.org>
Tue, 09 Oct 2012 23:58:08 +0000
branchnetbsd-6
changeset 256208 544e030e0687
parent 256207 056b2f1d9a21
child 256209 d5d9e595c838
Pull up following revision(s) (requested by christos in ticket #598): external/bsd/bind/dist/version: revision 1.4 external/bsd/bind/dist/CHANGES: revision 1.7 external/bsd/bind/dist/bin/named/query.c: revision 1.9 Apply P4: 3383. [security] A certain combination of records in the RBT could cause named to hang while populating the additional section of a response. [RT #31090]
external/bsd/bind/dist/CHANGES
external/bsd/bind/dist/bin/named/query.c
external/bsd/bind/dist/version
--- a/external/bsd/bind/dist/CHANGES	Tue Oct 09 23:54:57 2012 +0000
+++ b/external/bsd/bind/dist/CHANGES	Tue Oct 09 23:58:08 2012 +0000
@@ -1,3 +1,9 @@
+	--- 9.9.1-P4 released ---
+
+3383.	[security]	A certain combination of records in the RBT could
+                        cause named to hang while populating the additional
+                        section of a response. [RT #31090]
+
 	--- 9.9.1-P3 released ---
 
 3364.	[security]	Named could die on specially crafted record.
--- a/external/bsd/bind/dist/bin/named/query.c	Tue Oct 09 23:54:57 2012 +0000
+++ b/external/bsd/bind/dist/bin/named/query.c	Tue Oct 09 23:58:08 2012 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: query.c,v 1.7.2.1 2012/06/05 21:15:20 bouyer Exp $	*/
+/*	$NetBSD: query.c,v 1.7.2.2 2012/10/09 23:58:09 riz Exp $	*/
 
 /*
  * Copyright (C) 2004-2012  Internet Systems Consortium, Inc. ("ISC")
@@ -1121,13 +1121,6 @@
 		mname = NULL;
 	}
 
-	/*
-	 * If the dns_name_t we're looking up is already in the message,
-	 * we don't want to trigger the caller's name replacement logic.
-	 */
-	if (name == mname)
-		mname = NULL;
-
 	if (mnamep != NULL)
 		*mnamep = mname;
 
@@ -1332,6 +1325,7 @@
 	if (dns_rdataset_isassociated(rdataset) &&
 	    !query_isduplicate(client, fname, type, &mname)) {
 		if (mname != NULL) {
+			INSIST(mname != fname);
 			query_releasename(client, &fname);
 			fname = mname;
 		} else
@@ -1401,11 +1395,13 @@
 #endif
 			if (!query_isduplicate(client, fname,
 					       dns_rdatatype_a, &mname)) {
-				if (mname != NULL) {
-					query_releasename(client, &fname);
-					fname = mname;
-				} else
-					need_addname = ISC_TRUE;
+				if (mname != fname) {
+					if (mname != NULL) {
+						query_releasename(client, &fname);
+						fname = mname;
+					} else
+						need_addname = ISC_TRUE;
+				}
 				ISC_LIST_APPEND(fname->list, rdataset, link);
 				added_something = ISC_TRUE;
 				if (sigrdataset != NULL &&
@@ -1458,11 +1454,13 @@
 #endif
 			if (!query_isduplicate(client, fname,
 					       dns_rdatatype_aaaa, &mname)) {
-				if (mname != NULL) {
-					query_releasename(client, &fname);
-					fname = mname;
-				} else
-					need_addname = ISC_TRUE;
+				if (mname != fname) {
+					if (mname != NULL) {
+						query_releasename(client, &fname);
+						fname = mname;
+					} else
+						need_addname = ISC_TRUE;
+				}
 				ISC_LIST_APPEND(fname->list, rdataset, link);
 				added_something = ISC_TRUE;
 				if (sigrdataset != NULL &&
@@ -1993,22 +1991,24 @@
 		    crdataset->type == dns_rdatatype_aaaa) {
 			if (!query_isduplicate(client, fname, crdataset->type,
 					       &mname)) {
-				if (mname != NULL) {
-					/*
-					 * A different type of this name is
-					 * already stored in the additional
-					 * section.  We'll reuse the name.
-					 * Note that this should happen at most
-					 * once.  Otherwise, fname->link could
-					 * leak below.
-					 */
-					INSIST(mname0 == NULL);
-
-					query_releasename(client, &fname);
-					fname = mname;
-					mname0 = mname;
-				} else
-					need_addname = ISC_TRUE;
+				if (mname != fname) {
+					if (mname != NULL) {
+						/*
+						 * A different type of this name is
+						 * already stored in the additional
+						 * section.  We'll reuse the name.
+						 * Note that this should happen at most
+						 * once.  Otherwise, fname->link could
+						 * leak below.
+						 */
+						INSIST(mname0 == NULL);
+
+						query_releasename(client, &fname);
+						fname = mname;
+						mname0 = mname;
+					} else
+						need_addname = ISC_TRUE;
+				}
 				ISC_LIST_UNLINK(cfname.list, crdataset, link);
 				ISC_LIST_APPEND(fname->list, crdataset, link);
 				added_something = ISC_TRUE;
--- a/external/bsd/bind/dist/version	Tue Oct 09 23:54:57 2012 +0000
+++ b/external/bsd/bind/dist/version	Tue Oct 09 23:58:08 2012 +0000
@@ -7,4 +7,4 @@
 MINORVER=9
 PATCHVER=1
 RELEASETYPE=-P
-RELEASEVER=3
+RELEASEVER=4