From 38b84a1fcfdbda4d1d0fdca409004ae83be2ace8 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 13 Jan 2011 00:55:49 +0000 Subject: [PATCH] 3007. [bug] Named failed to preserve the case of domain names in rdata which is no compressable when writing master files. [RT #22863] --- CHANGES | 4 ++++ lib/dns/rdata.c | 7 ++++++- lib/dns/rdata/generic/hip_55.c | 8 ++------ lib/dns/rdata/generic/ipseckey_45.c | 8 ++------ lib/dns/rdata/generic/nsec_47.c | 10 ++++------ lib/dns/rdata/generic/rrsig_46.c | 8 ++------ 6 files changed, 20 insertions(+), 25 deletions(-) diff --git a/CHANGES b/CHANGES index ecad770db8..40cc370f86 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3007. [bug] Named failed to preserve the case of domain names in + rdata which is no compressable when writing master + files. [RT #22863] + 3006. [func] Allow dynamically generated TSIG keys to be preserved across restarts of named. Initially this is for TSIG keys generated using GSSAPI. [RT #22639] diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index be5fc64ba4..1dc8331678 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdata.c,v 1.207 2010/11/17 23:47:08 tbox Exp $ */ +/* $Id: rdata.c,v 1.208 2011/01/13 00:55:49 marka Exp $ */ /*! \file */ @@ -1150,6 +1150,11 @@ name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target) { if (l1 == l2) goto return_false; + /* Master files should be case preserving. */ + dns_name_getlabelsequence(name, l1 - l2, l2, target); + if (!dns_name_caseequal(origin, target)) + goto return_false; + dns_name_getlabelsequence(name, 0, l1 - l2, target); return (ISC_TRUE); diff --git a/lib/dns/rdata/generic/hip_55.c b/lib/dns/rdata/generic/hip_55.c index cc7ded316a..784c157243 100644 --- a/lib/dns/rdata/generic/hip_55.c +++ b/lib/dns/rdata/generic/hip_55.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hip_55.c,v 1.6 2009/12/04 22:06:37 tbox Exp $ */ +/* $Id: hip_55.c,v 1.7 2011/01/13 00:55:49 marka Exp $ */ /* reviewed: TBC */ @@ -122,8 +122,6 @@ static inline isc_result_t totext_hip(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; - dns_name_t prefix; - isc_boolean_t sub; size_t length, key_len, hit_len; unsigned char algorithm; char buf[sizeof("225 ")]; @@ -175,12 +173,10 @@ totext_hip(ARGS_TOTEXT) { * Rendezvous Servers. */ dns_name_init(&name, NULL); - dns_name_init(&prefix, NULL); while (region.length > 0) { dns_name_fromregion(&name, ®ion); - sub = name_prefix(&name, tctx->origin, &prefix); - RETERR(dns_name_totext(&prefix, sub, target)); + RETERR(dns_name_totext(&name, ISC_FALSE, target)); isc_region_consume(®ion, name.length); if (region.length > 0) RETERR(str_totext(tctx->linebreak, target)); diff --git a/lib/dns/rdata/generic/ipseckey_45.c b/lib/dns/rdata/generic/ipseckey_45.c index 072f13d6f2..4e21e2b558 100644 --- a/lib/dns/rdata/generic/ipseckey_45.c +++ b/lib/dns/rdata/generic/ipseckey_45.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipseckey_45.c,v 1.9 2009/12/04 22:06:37 tbox Exp $ */ +/* $Id: ipseckey_45.c,v 1.10 2011/01/13 00:55:49 marka Exp $ */ #ifndef RDATA_GENERIC_IPSECKEY_45_C #define RDATA_GENERIC_IPSECKEY_45_C @@ -120,8 +120,6 @@ static inline isc_result_t totext_ipseckey(ARGS_TOTEXT) { isc_region_t region; dns_name_t name; - dns_name_t prefix; - isc_boolean_t sub; char buf[sizeof("255 ")]; unsigned short num; unsigned short gateway; @@ -130,7 +128,6 @@ totext_ipseckey(ARGS_TOTEXT) { REQUIRE(rdata->length >= 3); dns_name_init(&name, NULL); - dns_name_init(&prefix, NULL); if (rdata->data[1] > 3U) return (ISC_R_NOTIMPLEMENTED); @@ -183,8 +180,7 @@ totext_ipseckey(ARGS_TOTEXT) { case 3: dns_name_fromregion(&name, ®ion); - sub = name_prefix(&name, tctx->origin, &prefix); - RETERR(dns_name_totext(&prefix, sub, target)); + RETERR(dns_name_totext(&name, ISC_FALSE, target)); isc_region_consume(®ion, name_length(&name)); break; } diff --git a/lib/dns/rdata/generic/nsec_47.c b/lib/dns/rdata/generic/nsec_47.c index ee9fb37c6c..45436f0c16 100644 --- a/lib/dns/rdata/generic/nsec_47.c +++ b/lib/dns/rdata/generic/nsec_47.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec_47.c,v 1.13 2009/12/04 22:06:37 tbox Exp $ */ +/* $Id: nsec_47.c,v 1.14 2011/01/13 00:55:49 marka Exp $ */ /* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */ @@ -88,20 +88,18 @@ totext_nsec(ARGS_TOTEXT) { isc_region_t sr; unsigned int i, j, k; dns_name_t name; - dns_name_t prefix; - isc_boolean_t sub; unsigned int window, len; REQUIRE(rdata->type == 47); REQUIRE(rdata->length != 0); + UNUSED(tctx); + dns_name_init(&name, NULL); - dns_name_init(&prefix, NULL); dns_rdata_toregion(rdata, &sr); dns_name_fromregion(&name, &sr); isc_region_consume(&sr, name_length(&name)); - sub = name_prefix(&name, tctx->origin, &prefix); - RETERR(dns_name_totext(&prefix, sub, target)); + RETERR(dns_name_totext(&name, ISC_FALSE, target)); for (i = 0; i < sr.length; i += len) { diff --git a/lib/dns/rdata/generic/rrsig_46.c b/lib/dns/rdata/generic/rrsig_46.c index 078cd4cb13..d43ae3a957 100644 --- a/lib/dns/rdata/generic/rrsig_46.c +++ b/lib/dns/rdata/generic/rrsig_46.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rrsig_46.c,v 1.12 2009/12/04 22:06:37 tbox Exp $ */ +/* $Id: rrsig_46.c,v 1.13 2011/01/13 00:55:49 marka Exp $ */ /* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */ @@ -134,8 +134,6 @@ totext_rrsig(ARGS_TOTEXT) { unsigned long exp; unsigned long foot; dns_name_t name; - dns_name_t prefix; - isc_boolean_t sub; REQUIRE(rdata->type == 46); REQUIRE(rdata->length != 0); @@ -217,11 +215,9 @@ totext_rrsig(ARGS_TOTEXT) { * Signer. */ dns_name_init(&name, NULL); - dns_name_init(&prefix, NULL); dns_name_fromregion(&name, &sr); isc_region_consume(&sr, name_length(&name)); - sub = name_prefix(&name, tctx->origin, &prefix); - RETERR(dns_name_totext(&prefix, sub, target)); + RETERR(dns_name_totext(&name, ISC_FALSE, target)); /* * Sig.