Commit 740e7340 authored by Mark Andrews's avatar Mark Andrews

3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT.

                        dns_dlzcreate() failed to properly initialize
                        dlzdb.link.  When cloning a rdataset do not copy
                        the link contents.  [RT #32651]

Squashed commit of the following:

commit c36c49cbdaeec8b2506dffadbffa543283702fa2
Author: Mark Andrews <marka@isc.org>
Date:   Mon Feb 18 23:24:57 2013 +1100

    don't copy the link when cloning a rdataset

commit 9fef5827edcc925075832dcce900eeca9057456d
Author: Mark Andrews <marka@isc.org>
Date:   Mon Feb 18 23:23:25 2013 +1100

    initialise the dlzdb link; don't return a stale pointer on error

commit a13c584732eae2dde48920a73886b54f1fe6b030
Author: Mark Andrews <marka@isc.org>
Date:   Mon Feb 18 23:21:59 2013 +1100

    turn on ISC_LIST_CHECKINIT
parent 3c7df84b
3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT.
dns_dlzcreate() failed to properly initialize
dlzdb.link. When cloning a rdataset do not copy
the link contents. [RT #32651]
3488. [bug] Use after free error with DH generated keys. [RT #32649]
3487. [bug] Change 3444 was not complete. There was a additional
......
......@@ -11858,6 +11858,7 @@ fi
case "$enable_developer" in
yes)
STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
test "${with_atf+set}" = set || with_atf=yes
test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
......
......@@ -66,6 +66,7 @@ esac
AC_ARG_ENABLE(developer, [ --enable-developer enable developer build settings])
case "$enable_developer" in
yes)
STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
test "${with_atf+set}" = set || with_atf=yes
test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
......
......@@ -158,6 +158,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
{
dns_dlzimplementation_t *impinfo;
isc_result_t result;
dns_dlzdb_t *db = NULL;
/*
* initialize the dlz_implementations list, this is guaranteed
......@@ -196,33 +197,34 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
}
/* Allocate memory to hold the DLZ database driver */
(*dbp) = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
if ((*dbp) == NULL) {
db = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
if (db == NULL) {
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
return (ISC_R_NOMEMORY);
}
/* Make sure memory region is set to all 0's */
memset((*dbp), 0, sizeof(dns_dlzdb_t));
(*dbp)->implementation = impinfo;
memset(db, 0, sizeof(dns_dlzdb_t));
ISC_LINK_INIT(db, link);
db->implementation = impinfo;
if (dlzname != NULL)
(*dbp)->dlzname = isc_mem_strdup(mctx, dlzname);
db->dlzname = isc_mem_strdup(mctx, dlzname);
/* Create a new database using implementation 'drivername'. */
result = ((impinfo->methods->create)(mctx, dlzname, argc, argv,
impinfo->driverarg,
&(*dbp)->dbdata));
&db->dbdata));
/* mark the DLZ driver as valid */
if (result == ISC_R_SUCCESS) {
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
(*dbp)->magic = DNS_DLZ_MAGIC;
isc_mem_attach(mctx, &(*dbp)->mctx);
db->magic = DNS_DLZ_MAGIC;
isc_mem_attach(mctx, &db->mctx);
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
"DLZ driver loaded successfully.");
*dbp = db;
return (ISC_R_SUCCESS);
} else {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
......@@ -232,7 +234,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
/* impinfo->methods->create failed. */
RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
isc_mem_put(mctx, (*dbp), sizeof(dns_dlzdb_t));
isc_mem_put(mctx, db, sizeof(dns_dlzdb_t));
return (result);
}
......
......@@ -8419,7 +8419,9 @@ rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
dns_dbnode_t *cloned_node = NULL;
attachnode(db, node, &cloned_node);
INSIST(!ISC_LINK_LINKED(target, link));
*target = *source;
ISC_LINK_INIT(target, link);
/*
* Reset iterator state.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment