lock order rule and could cause a dead lock.
[RT# 15518]
1928. [bug] Race in rbtdb.c:currentversion(). [RT #15517]
+1927. [bug] Access to soanode or nsnode in rbtdb violated the
+ lock order rule and could cause a dead lock.
+ [RT# 15518]
+
1926. [bug] The Windows installer did not check for empty
passwords. BINDinstall was being installed in
the wrong place. [RT #15483]
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: query.c,v 1.257.18.17 2005/09/05 00:18:11 marka Exp $ */
+/* $Id: query.c,v 1.257.18.18 2005/10/13 02:12:23 marka Exp $ */
/*! \file */
/*
* Find the SOA.
*/
- result = dns_db_getsoanode(db, &node);
+ result = dns_db_getoriginnode(db, &node);
if (result == ISC_R_SUCCESS) {
result = dns_db_findrdataset(db, node, version,
dns_rdatatype_soa,
result = dns_db_find(db, name, version, dns_rdatatype_soa,
client->query.dboptions, 0, &node,
fname, rdataset, sigrdataset);
-
- if (result == ISC_R_SUCCESS)
- (void)dns_db_setsoanode(db, node);
}
if (result != ISC_R_SUCCESS) {
/*
/*
* Find the NS rdataset.
*/
- result = dns_db_getnsnode(db, &node);
+ result = dns_db_getoriginnode(db, &node);
if (result == ISC_R_SUCCESS) {
result = dns_db_findrdataset(db, node, version,
dns_rdatatype_ns,
client->query.dboptions, 0, &node,
fname, rdataset, sigrdataset);
CTRACE("query_addns: dns_db_find complete");
-
- if (result == ISC_R_SUCCESS)
- (void)dns_db_setnsnode(db, node);
}
if (result != ISC_R_SUCCESS) {
CTRACE("query_addns: "
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: db.c,v 1.74.18.5 2005/06/28 03:00:20 marka Exp $ */
+/* $Id: db.c,v 1.74.18.6 2005/10/13 02:12:24 marka Exp $ */
/*! \file */
}
isc_result_t
-dns_db_getsoanode(dns_db_t *db, dns_dbnode_t **nodep) {
+dns_db_getoriginnode(dns_db_t *db, dns_dbnode_t **nodep) {
REQUIRE(DNS_DB_VALID(db));
REQUIRE(dns_db_iszone(db) == ISC_TRUE);
REQUIRE(nodep != NULL && *nodep == NULL);
- if (db->methods->getsoanode != NULL)
- return ((db->methods->getsoanode)(db, nodep));
+ if (db->methods->getoriginnode != NULL)
+ return ((db->methods->getoriginnode)(db, nodep));
return (ISC_R_NOTFOUND);
}
-
-isc_result_t
-dns_db_setsoanode(dns_db_t *db, dns_dbnode_t *node) {
- REQUIRE(DNS_DB_VALID(db));
- REQUIRE(dns_db_iszone(db) == ISC_TRUE);
- REQUIRE(node != NULL);
-
- if (db->methods->setsoanode != NULL)
- return ((db->methods->setsoanode)(db, node));
-
- return (ISC_R_FAILURE);
-}
-
-isc_result_t
-dns_db_getnsnode(dns_db_t *db, dns_dbnode_t **nodep) {
- REQUIRE(DNS_DB_VALID(db));
- REQUIRE(dns_db_iszone(db) == ISC_TRUE);
- REQUIRE(nodep != NULL && *nodep == NULL);
-
- if (db->methods->getnsnode != NULL)
- return ((db->methods->getnsnode)(db, nodep));
-
- return (ISC_R_NOTFOUND);
-}
-
-isc_result_t
-dns_db_setnsnode(dns_db_t *db, dns_dbnode_t *node) {
- REQUIRE(DNS_DB_VALID(db));
- REQUIRE(dns_db_iszone(db) == ISC_TRUE);
- REQUIRE(node != NULL);
-
- if (db->methods->setnsnode != NULL)
- return ((db->methods->setnsnode)(db, node));
-
- return (ISC_R_FAILURE);
-}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: db.h,v 1.76.18.6 2005/06/28 03:00:21 marka Exp $ */
+/* $Id: db.h,v 1.76.18.7 2005/10/13 02:12:25 marka Exp $ */
#ifndef DNS_DB_H
#define DNS_DB_H 1
isc_boolean_t (*ispersistent)(dns_db_t *db);
void (*overmem)(dns_db_t *db, isc_boolean_t overmem);
void (*settask)(dns_db_t *db, isc_task_t *);
- isc_result_t (*getsoanode)(dns_db_t *db, dns_dbnode_t **nodep);
- isc_result_t (*setsoanode)(dns_db_t *db, dns_dbnode_t *nodep);
- isc_result_t (*getnsnode)(dns_db_t *db, dns_dbnode_t **nodep);
- isc_result_t (*setnsnode)(dns_db_t *db, dns_dbnode_t *nodep);
+ isc_result_t (*getoriginnode)(dns_db_t *db, dns_dbnode_t **nodep);
} dns_dbmethods_t;
typedef isc_result_t
*/
isc_result_t
-dns_db_getsoanode(dns_db_t *db, dns_dbnode_t **nodep);
+dns_db_getoriginnode(dns_db_t *db, dns_dbnode_t **nodep);
/*%<
- * Get a cached SOA DB node corresponding to the DB's zone.
+ * Get the origin DB node corresponding to the DB's zone. This function
+ * should typically succeed unless the underlying DB implementation doesn't
+ * support the feature.
*
* Requires:
*
* \li 'nodep' != NULL && '*nodep' == NULL
*
* Ensures:
- * \li On sucess, '*nodep' will point to a DB node for the SOA RR of 'db.'
+ * \li On success, '*nodep' will point to the DB node of the zone's origin.
*
* Returns:
* \li #ISC_R_SUCCESS
- * \li #ISC_R_NOTFOUND - an SOA RR node has not been cached in 'db' or SOA RR
- * caching is not supported for 'db'
- */
-
-isc_result_t
-dns_db_setsoanode(dns_db_t *db, dns_dbnode_t *node);
-/*%<
- * Set an SOA DB node as cache corresponding to the DB's zone. If there is
- * already a node set in the DB, it will be detached and replaced with the
- * new one.
- *
- * Requires:
- *
- * \li 'db' is a valid zone database.
- * \li 'node' is a valid DB node.
- *
- * Ensures:
- * \li On sucess, '*nodep' will point to a DB node for the SOA RR of 'db.'
- *
- * Returns:
- * \li #ISC_R_SUCCESS
- * \li #ISC_R_FAILURE - SOA RR caching is not supported for 'db'
- */
-
-isc_result_t
-dns_db_getnsnode(dns_db_t *db, dns_dbnode_t **nodep);
-/*%<
- * Get a cached NS DB node corresponding to the DB's zone.
- *
- * Requires:
- *
- * \li 'db' is a valid zone database.
- * \li 'nodep' != NULL && '*nodep' == NULL
- *
- * Ensures:
- * \li On sucess, '*nodep' will point to a DB node for the NS RR of 'db.'
- *
- * Returns:
- * \li #ISC_R_SUCCESS
- * \li #ISC_R_NOTFOUND - an NS RR node has not been cached in 'db' or NS RR
- * caching is not supported for 'db'
- */
-
-isc_result_t
-dns_db_setnsnode(dns_db_t *db, dns_dbnode_t *node);
-/*%<
- * Set an NS DB node as cache corresponding to the DB's zone. If there is
- * already a node set in the DB, it will be detached and replaced with the
- * new one.
- *
- * Requires:
- *
- * \li 'db' is a valid zone database.
- * \li 'node' is a valid DB node.
- *
- * Ensures:
- * \li On sucess, '*nodep' will point to a DB node for the NS RR of 'db.'
- *
- * Returns:
- * \li #ISC_R_SUCCESS
- * \li #ISC_R_FAILURE - NS RR caching is not supported for 'db'
+ * \li #ISC_R_NOTFOUND - the DB implementation does not support this feature.
*/
ISC_LANG_ENDDECLS
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbtdb.c,v 1.196.18.23 2005/10/13 01:26:06 marka Exp $ */
+/* $Id: rbtdb.c,v 1.196.18.24 2005/10/13 02:12:24 marka Exp $ */
/*! \file */
}
static isc_result_t
-getsoanode(dns_db_t *db, dns_dbnode_t **nodep) {
+getoriginnode(dns_db_t *db, dns_dbnode_t **nodep) {
dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
+ dns_rbtnode_t *onode;
isc_result_t result = ISC_R_SUCCESS;
REQUIRE(VALID_RBTDB(rbtdb));
REQUIRE(nodep != NULL && *nodep == NULL);
- RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_read);
- if (rbtdb->soanode != NULL) {
- attachnode(db, rbtdb->soanode, nodep);
- } else
- result = ISC_R_NOTFOUND;
- RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_read);
-
- return (result);
-}
-
-static isc_result_t
-setsoanode(dns_db_t *db, dns_dbnode_t *node) {
- dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
-
- REQUIRE(VALID_RBTDB(rbtdb));
- REQUIRE(node != NULL);
-
- RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write);
- if (rbtdb->soanode != NULL)
- detachnode(db, &rbtdb->soanode);
- attachnode(db, node, &rbtdb->soanode);
- RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write);
-
- return (ISC_R_SUCCESS);
-}
-
-static isc_result_t
-getnsnode(dns_db_t *db, dns_dbnode_t **nodep) {
- dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
- isc_result_t result = ISC_R_SUCCESS;
-
- REQUIRE(VALID_RBTDB(rbtdb));
- REQUIRE(nodep != NULL && *nodep == NULL);
+ /* Note that the access to origin_node doesn't require a DB lock */
+ onode = (dns_rbtnode_t *)rbtdb->origin_node;
+ if (onode != NULL) {
+ NODE_STRONGLOCK(&rbtdb->node_locks[onode->locknum].lock);
+ new_reference(rbtdb, onode);
+ NODE_STRONGUNLOCK(&rbtdb->node_locks[onode->locknum].lock);
- RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_read);
- if (rbtdb->nsnode != NULL) {
- attachnode(db, rbtdb->nsnode, nodep);
- } else
+ *nodep = rbtdb->origin_node;
+ } else {
+ INSIST(!IS_CACHE(rbtdb));
result = ISC_R_NOTFOUND;
- RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_read);
+ }
return (result);
}
-static isc_result_t
-setnsnode(dns_db_t *db, dns_dbnode_t *node) {
- dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db;
-
- REQUIRE(VALID_RBTDB(rbtdb));
- REQUIRE(node != NULL);
-
- RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write);
- if (rbtdb->nsnode != NULL)
- detachnode(db, &rbtdb->nsnode);
- attachnode(db, node, &rbtdb->nsnode);
- RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write);
-
- return (ISC_R_SUCCESS);
-}
-
static dns_dbmethods_t zone_methods = {
attach,
detach,
ispersistent,
overmem,
settask,
- getsoanode,
- setsoanode,
- getnsnode,
- setnsnode
+ getoriginnode
};
static dns_dbmethods_t cache_methods = {
ispersistent,
overmem,
settask,
- getsoanode,
- setsoanode,
- getnsnode,
- setnsnode
+ getoriginnode
};
isc_result_t
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sdb.c,v 1.45.18.7 2005/08/18 01:03:01 marka Exp $ */
+/* $Id: sdb.c,v 1.45.18.8 2005/10/13 02:12:25 marka Exp $ */
/*! \file */
ispersistent,
overmem,
settask,
- NULL,
- NULL,
- NULL,
NULL
};
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sdlz.c,v 1.2.2.2 2005/09/06 03:47:17 marka Exp $ */
+/* $Id: sdlz.c,v 1.2.2.3 2005/10/13 02:12:25 marka Exp $ */
/*! \file */
overmem,
settask,
NULL,
- NULL,
- NULL,
- NULL
};
/*