diff --git a/CHANGES b/CHANGES index 6ce9880a1f..49593a1ef0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4618. [bug] Check isc_mem_strdup results in dns_view_setnewzones. + Add logging for lmdb call failures. [RT #45204] + 4617. [test] Update rndc system test to be more delay tolerant. [RT #45177] diff --git a/lib/dns/view.c b/lib/dns/view.c index bfa63ec9cf..9bcf00db65 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -2031,17 +2031,31 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, buffer, sizeof(buffer)); if (result != ISC_R_SUCCESS) goto out; + view->new_zone_file = isc_mem_strdup(view->mctx, buffer); + if (view->new_zone_file == NULL) { + result = ISC_R_NOMEMORY; + goto out; + } #ifdef HAVE_LMDB result = isc_file_sanitize(NULL, view->name, "nzd", buffer, sizeof(buffer)); if (result != ISC_R_SUCCESS) goto out; + view->new_zone_db = isc_mem_strdup(view->mctx, buffer); + if (view->new_zone_db == NULL) { + result = ISC_R_NOMEMORY; + goto out; + } status = mdb_env_create(&env); if (status != 0) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_OTHER, ISC_LOG_ERROR, + "mdb_env_create failed: %s", + mdb_strerror(status)); result = ISC_R_FAILURE; goto out; } @@ -2049,6 +2063,10 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, if (mapsize != 0ULL) { status = mdb_env_set_mapsize(env, mapsize); if (status != 0) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_OTHER, ISC_LOG_ERROR, + "mdb_env_set_mapsize failed: %s", + mdb_strerror(status)); result = ISC_R_FAILURE; goto out; } @@ -2057,6 +2075,10 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, status = mdb_env_open(env, view->new_zone_db, MDB_NOSUBDIR|MDB_CREATE, 0600); if (status != 0) { + isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, + ISC_LOGMODULE_OTHER, ISC_LOG_ERROR, + "mdb_env_open of '%s' failed: %s", + view->new_zone_db, mdb_strerror(status)); result = ISC_R_FAILURE; goto out; }