rpms/bind/FC-4 bind-9.3.1-bz187286_fix_host_cname.patch, NONE, 1.1 bind.spec, 1.74, 1.75

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Mar 30 23:54:39 UTC 2006


Author: jvdias

Update of /cvs/dist/rpms/bind/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv4816

Modified Files:
	bind.spec 
Added Files:
	bind-9.3.1-bz187286_fix_host_cname.patch 
Log Message:
fix bug 187286: prevent host(1) generating redundant "is an alias for" messages

bind-9.3.1-bz187286_fix_host_cname.patch:
 host.c |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 65 insertions(+), 1 deletion(-)

--- NEW FILE bind-9.3.1-bz187286_fix_host_cname.patch ---
--- bind-9.3.1/bin/dig/host.c.bz187286_fix_host_cname	2006-03-30 18:16:37.000000000 -0500
+++ bind-9.3.1/bin/dig/host.c	2006-03-30 18:19:03.000000000 -0500
@@ -37,6 +37,7 @@
 #include <dns/rdataclass.h>
 #include <dns/rdataset.h>
 #include <dns/rdatatype.h>
+#include <dns/rdatastruct.h>
 
 #include <dig/dig.h>
 
@@ -343,6 +344,60 @@
 }
 
 static isc_result_t
+get_cname( dig_query_t *query, dns_message_t *msg, char *cnamestr, int cnamestrlen )
+{
+    /*  check for a cname result in msg answer section; if present, copy it into cnamestr 
+     *  Jason Vas Dias<jvdias at redhat.com>, Red Hat, Inc. fix for bugzilla 187286 (RT #15702)
+     */
+	isc_result_t result;
+	dns_name_t   *aname;
+	dns_rdataset_t *rdataset;
+	dns_rdata_t  rdata = DNS_RDATA_INIT;
+
+	*cnamestr = '\0';
+			
+	result = dns_message_firstname(msg, DNS_SECTION_ANSWER);
+	if (result != ISC_R_SUCCESS)
+	    return ISC_R_FAILURE;
+
+	do
+	{
+		aname = NULL;
+		dns_message_currentname(msg, DNS_SECTION_ANSWER, &aname);
+		if (   aname 
+		    &&(dns_name_equal(query->lookup->name, aname) == ISC_TRUE)
+		   )
+		{
+			for (rdataset = ISC_LIST_HEAD(aname->list);
+			     rdataset != NULL;
+			     rdataset = ISC_LIST_NEXT(rdataset, link)) 
+			{
+				isc_result_t loopresult = dns_rdataset_first(rdataset);
+				while (loopresult == ISC_R_SUCCESS) 
+				{
+					dns_rdataset_current(rdataset, &rdata);
+					if ( rdata.type == dns_rdatatype_cname )
+					{
+						dns_rdata_cname_t cname;
+						if ( dns_rdata_tostruct( &rdata, &cname, NULL ) 
+						     == ISC_R_SUCCESS
+						   )
+						{
+							dns_name_format(&(cname.cname), cnamestr, cnamestrlen );
+							return ( ISC_R_SUCCESS );
+						}
+					}
+					dns_rdata_reset(&rdata);
+					loopresult = dns_rdataset_next(rdataset);
+				}
+			}
+		}
+	} while ( dns_message_nextname(msg, DNS_SECTION_ANSWER) == ISC_R_SUCCESS );
+
+	return ( ISC_R_FAILURE );
+}
+
+static isc_result_t
 printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner,
 	   const char *set_name, isc_boolean_t headers)
 {
@@ -408,7 +463,16 @@
 
 		/* Add AAAA and MX lookups. */
 
-		dns_name_format(query->lookup->name, namestr, sizeof(namestr));
+		if ( ! ISC_LIST_EMPTY( msg->sections[DNS_SECTION_ANSWER] ) )
+		{ 
+			/* check for CNAME answer ; if present, then use canonical name for
+			 * AAAA and MX lookups.
+			 */		
+			if ( get_cname( query, msg, namestr, sizeof(namestr) ) != ISC_R_SUCCESS )
+				dns_name_format(query->lookup->name, namestr, sizeof(namestr));			
+		} else	/* use same name for AAAA and MX lookups */			
+			dns_name_format(query->lookup->name, namestr, sizeof(namestr));
+
 		lookup = clone_lookup(query->lookup, ISC_FALSE);
 		if (lookup != NULL) {
 			strncpy(lookup->textname, namestr,


Index: bind.spec
===================================================================
RCS file: /cvs/dist/rpms/bind/FC-4/bind.spec,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- bind.spec	20 Mar 2006 21:52:25 -0000	1.74
+++ bind.spec	30 Mar 2006 23:54:37 -0000	1.75
@@ -9,7 +9,7 @@
 Name: bind
 License: BSD-like
 Version: 9.3.1
-Release: 18.FC4
+Release: 20.FC4
 Epoch:   24
 Url: http://www.isc.org/products/BIND/
 Buildroot: %{_tmppath}/%{name}-root
@@ -60,6 +60,8 @@
 Patch24: bind-9.3.1-t_no_default_lookups.patch
 Patch25: bind-9.3.1-fix_dbus.patch
 Patch26: bind-9.3.1-dbus_archdep_libdir_sdb.patch
+Patch27: bind-9.3.1-bz187286_fix_host_cname.patch
+#
 Requires(pre,preun): shadow-utils
 Requires(post,preun): chkconfig
 Requires(post): textutils, fileutils, sed, grep
@@ -235,6 +237,7 @@
 %patch23 -p1 -b .dbus_archdep_libdir
 %endif
 %patch24 -p1 -b .-t_no_default_lookups
+%patch27 -p1 -b .bz187286_fix_host_cname
 
 %build
 libtoolize --copy --force; aclocal; autoconf
@@ -742,6 +745,9 @@
 :;
 
 %changelog
+* Thu Mar 30 2006 Jason Vas Dias <jvdias at redhat.com> - 24:9.3.1-20
+- fix bug 187286: prevent host(1) generating redundant 'is alias for' messages
+
 * Tue Mar 07 2006 Jason Vas Dias <jvdias at redhat.com> - 24:9.3.1-16
 - fix bug 179816: fix builds for all combinations of WITH_DBUS=0/1 SDB=0/1 LIBBIND=0/1                  
 - fix bug 177595: handle case where $ROOTDIR is a link in initscript 




More information about the fedora-cvs-commits mailing list