4624. [bug] Check isc_mem_strdup results in dns_view_setnewzones.
[RT #45210]
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
4624. [bug] Check isc_mem_strdup results in dns_view_setnewzones.
|
||||
[RT #45210]
|
||||
|
||||
4622. [bug] Remove unnecessary escaping of semicolon in CAA and
|
||||
URI records. [RT #45216]
|
||||
|
||||
|
||||
+11
-5
@@ -5639,19 +5639,25 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
allow = cfg_obj_asboolean(nz);
|
||||
|
||||
if (!allow) {
|
||||
dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
|
||||
return (ISC_R_SUCCESS);
|
||||
return (dns_view_setnewzones(view, ISC_FALSE, NULL, NULL));
|
||||
}
|
||||
|
||||
nzcfg = isc_mem_get(view->mctx, sizeof(*nzcfg));
|
||||
if (nzcfg == NULL) {
|
||||
dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
|
||||
result = dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
dns_view_setnewzones(view, allow, nzcfg, newzone_cfgctx_destroy);
|
||||
|
||||
memset(nzcfg, 0, sizeof(*nzcfg));
|
||||
|
||||
result = dns_view_setnewzones(view, allow, nzcfg,
|
||||
newzone_cfgctx_destroy);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_mem_put(view->mctx, nzcfg, sizeof(*nzcfg));
|
||||
return (ISC_R_NOMEMORY);
|
||||
}
|
||||
|
||||
isc_mem_attach(view->mctx, &nzcfg->mctx);
|
||||
cfg_obj_attach(config, &nzcfg->config);
|
||||
cfg_parser_attach(parser, &nzcfg->parser);
|
||||
|
||||
@@ -1146,7 +1146,7 @@ dns_view_untrust(dns_view_t *view, dns_name_t *keyname,
|
||||
* \li 'dnskey' is valid.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_result_t
|
||||
dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
|
||||
void (*cfg_destroy)(void **));
|
||||
/*%<
|
||||
@@ -1165,6 +1165,10 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
|
||||
*
|
||||
* Requires:
|
||||
* \li 'view' is valid.
|
||||
*
|
||||
* Returns:
|
||||
* \li ISC_R_SUCCESS
|
||||
* \li ISC_R_NOMEMORY
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -1183,14 +1187,14 @@ dns_view_searchdlz(dns_view_t *view, dns_name_t *name,
|
||||
* findzone method. If successful, '*dbp' is set to point to the
|
||||
* DLZ database.
|
||||
*
|
||||
* Returns:
|
||||
* \li ISC_R_SUCCESS
|
||||
* \li ISC_R_NOTFOUND
|
||||
*
|
||||
* Requires:
|
||||
* \li 'view' is valid.
|
||||
* \li 'name' is not NULL.
|
||||
* \li 'dbp' is not NULL and *dbp is NULL.
|
||||
*
|
||||
* Returns:
|
||||
* \li ISC_R_SUCCESS
|
||||
* \li ISC_R_NOTFOUND
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
+7
-3
@@ -281,6 +281,7 @@ static inline void
|
||||
destroy(dns_view_t *view) {
|
||||
dns_dns64_t *dns64;
|
||||
dns_dlzdb_t *dlzdb;
|
||||
isc_result_t result;
|
||||
|
||||
REQUIRE(!ISC_LINK_LINKED(view, link));
|
||||
REQUIRE(isc_refcount_current(&view->references) == 0);
|
||||
@@ -295,7 +296,6 @@ destroy(dns_view_t *view) {
|
||||
dns_peerlist_detach(&view->peers);
|
||||
|
||||
if (view->dynamickeys != NULL) {
|
||||
isc_result_t result;
|
||||
char template[20];
|
||||
char keyfile[20];
|
||||
FILE *fp = NULL;
|
||||
@@ -453,7 +453,8 @@ destroy(dns_view_t *view) {
|
||||
dns_zone_detach(&view->managed_keys);
|
||||
if (view->redirect != NULL)
|
||||
dns_zone_detach(&view->redirect);
|
||||
dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
|
||||
result = dns_view_setnewzones(view, ISC_FALSE, NULL, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
dns_fwdtable_destroy(&view->fwdtable);
|
||||
dns_aclenv_destroy(&view->aclenv);
|
||||
DESTROYLOCK(&view->lock);
|
||||
@@ -1853,7 +1854,7 @@ dns_view_untrust(dns_view_t *view, dns_name_t *keyname,
|
||||
|
||||
#define NZF ".nzf"
|
||||
|
||||
void
|
||||
isc_result_t
|
||||
dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
|
||||
void (*cfg_destroy)(void **))
|
||||
{
|
||||
@@ -1876,9 +1877,12 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx,
|
||||
/* Truncate the hash at 16 chars; full length is overkill */
|
||||
isc_string_printf(buffer + 16, sizeof(NZF), "%s", NZF);
|
||||
view->new_zone_file = isc_mem_strdup(view->mctx, buffer);
|
||||
if (view->new_zone_file == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
view->new_zone_config = cfgctx;
|
||||
view->cfg_destroy = cfg_destroy;
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
||||
Reference in New Issue
Block a user