1808. [bug] zone.c:notify_zone() contained a race condition,
zone->db could change underneath it. [RT #13511]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,6 +1,7 @@
|
||||
1809. [placeholder] rt13463
|
||||
|
||||
1808. [placeholder] rt13511
|
||||
1808. [bug] zone.c:notify_zone() contained a race condition,
|
||||
zone->db could change underneath it. [RT #13511]
|
||||
|
||||
1807. [placeholder] rt13526
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.c,v 1.429 2005/01/11 23:10:05 marka Exp $ */
|
||||
/* $Id: zone.c,v 1.430 2005/02/03 05:07:35 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -3042,6 +3042,7 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
||||
dns_notifytype_t notifytype;
|
||||
unsigned int flags = 0;
|
||||
isc_boolean_t loggednotify = ISC_FALSE;
|
||||
dns_db_t *db = NULL;
|
||||
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
||||
@@ -3061,6 +3062,13 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
||||
zone->type != dns_zone_master)
|
||||
return;
|
||||
|
||||
LOCK_ZONE(zone);
|
||||
if (zone->db != NULL)
|
||||
dns_db_attach(zone->db, &db);
|
||||
UNLOCK_ZONE(zone);
|
||||
if (db == NULL)
|
||||
return;
|
||||
|
||||
origin = &zone->origin;
|
||||
|
||||
/*
|
||||
@@ -3073,14 +3081,13 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
||||
/*
|
||||
* Get SOA RRset.
|
||||
*/
|
||||
dns_db_currentversion(zone->db, &version);
|
||||
result = dns_db_findnode(zone->db, origin, ISC_FALSE, &node);
|
||||
dns_db_currentversion(db, &version);
|
||||
result = dns_db_findnode(db, origin, ISC_FALSE, &node);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup1;
|
||||
|
||||
dns_rdataset_init(&soardset);
|
||||
result = dns_db_findrdataset(zone->db, node, version,
|
||||
dns_rdatatype_soa,
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_soa,
|
||||
dns_rdatatype_none, 0, &soardset, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup2;
|
||||
@@ -3137,8 +3144,7 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
||||
*/
|
||||
|
||||
dns_rdataset_init(&nsrdset);
|
||||
result = dns_db_findrdataset(zone->db, node, version,
|
||||
dns_rdatatype_ns,
|
||||
result = dns_db_findrdataset(db, node, version, dns_rdatatype_ns,
|
||||
dns_rdatatype_none, 0, &nsrdset, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup3;
|
||||
@@ -3195,9 +3201,10 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) {
|
||||
if (dns_name_dynamic(&master))
|
||||
dns_name_free(&master, zone->mctx);
|
||||
cleanup2:
|
||||
dns_db_detachnode(zone->db, &node);
|
||||
dns_db_detachnode(db, &node);
|
||||
cleanup1:
|
||||
dns_db_closeversion(zone->db, &version, ISC_FALSE);
|
||||
dns_db_closeversion(db, &version, ISC_FALSE);
|
||||
dns_db_detach(&db);
|
||||
}
|
||||
|
||||
/***
|
||||
|
||||
Reference in New Issue
Block a user