[v9_11] fix dyndb issues; isc_errno_toresult()

4445.	[cleanup]	isc_errno_toresult() can now be used to call the
			formerly private function isc__errno2result().
			[RT #43050]

4444.	[bug]		Fixed some issues related to dyndb: A bug caused
			braces to be omitted when passing configuration text
			from named.conf to a dyndb driver, and there was a
			use-after-free in the sample dyndb driver. [RT #43050]

Patch for dyndb driver submitted by Petr Spacek at Red Hat.

(cherry picked from commit 3390d74e33)
This commit is contained in:
Evan Hunt
2016-08-17 11:22:44 -07:00
parent ab598428c8
commit f5898cf348
22 changed files with 308 additions and 67 deletions

View File

@@ -82,9 +82,14 @@ new_sample_instance(isc_mem_t *mctx, const char *db_name,
CHECKED_MEM_GET_PTR(mctx, inst);
ZERO_PTR(inst);
inst->db_name = db_name; /* const during lifetime of inst */
isc_mem_attach(mctx, &inst->mctx);
inst->db_name = isc_mem_strdup(mctx, db_name);
if (inst->db_name == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
dns_fixedname_init(&inst->zone1_fn);
inst->zone1_name = dns_fixedname_name(&inst->zone1_fn);
@@ -137,6 +142,8 @@ destroy_sample_instance(sample_instance_t **instp) {
if (inst == NULL)
return;
if (inst->db_name != NULL)
isc_mem_free(inst->mctx, inst->db_name);
if (inst->zone1 != NULL)
dns_zone_detach(&inst->zone1);
if (inst->zone2 != NULL)