From a012d6dbfb100390efa7d0d4be64ada0210b09dd Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Tue, 20 Feb 2001 23:20:44 +0000 Subject: [PATCH] 746. [bug] The sdb didn't clone rdatasets properly, causing a crash when the server followed delegations. [RT #905] --- CHANGES | 3 +++ lib/dns/sdb.c | 23 +++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index fcc9800f23..18759ec23b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ + 746. [bug] The sdb didn't clone rdatasets properly, causing + a crash when the server followed delegations. [RT #905] + 745. [func] Report the owner name of records that fail semantic checks while loading. diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index f93353a391..3b201a7d98 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sdb.c,v 1.27 2001/02/14 00:29:16 gson Exp $ */ +/* $Id: sdb.c,v 1.28 2001/02/20 23:20:44 bwelling Exp $ */ #include @@ -1252,12 +1252,24 @@ disassociate(dns_rdataset_t *rdataset) { isc__rdatalist_disassociate(rdataset); } +static void +rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) { + dns_dbnode_t *node = source->private5; + dns_sdbnode_t *sdbnode = (dns_sdbnode_t *) node; + dns_db_t *db = (dns_db_t *) sdbnode->sdb; + dns_dbnode_t *tempdb = NULL; + + isc__rdatalist_clone(source, target); + attachnode(db, node, &tempdb); + source->private5 = tempdb; +} + static dns_rdatasetmethods_t methods = { disassociate, isc__rdatalist_first, isc__rdatalist_next, isc__rdatalist_current, - isc__rdatalist_clone, + rdataset_clone, isc__rdatalist_count }; @@ -1266,6 +1278,13 @@ list_tordataset(dns_rdatalist_t *rdatalist, dns_db_t *db, dns_dbnode_t *node, dns_rdataset_t *rdataset) { + /* + * The sdb rdataset is an rdatalist with some additions. + * - private1 & private2 are used by the rdatalist. + * - private3 & private 4 are unused. + * - private5 is the node. + */ + /* This should never fail. */ RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) == ISC_R_SUCCESS);