mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-08 21:42:06 -04:00
Merge branch '3221-catz-lightweight-cleanup' into 'main'
[1/5] Catalog zones lightweight cleanup Closes #3221 See merge request isc-projects/bind9!6011
This commit is contained in:
commit
e759fa9847
3 changed files with 53 additions and 29 deletions
7
CHANGES
7
CHANGES
|
|
@ -1,3 +1,10 @@
|
|||
5838. [cleanup] When modifying a member zone in a catalog zone, and it
|
||||
is detected that the zone exists and was not created by
|
||||
the current catalog zone, distinguish the two cases when
|
||||
the zone was not added by a catalog zone at all, and
|
||||
when the zone was added by a different catalog zone,
|
||||
and log a warning message accordingly. [GL #3221]
|
||||
|
||||
5837. [func] Key timing options for `dnssec-keygen` and
|
||||
`dnssec-settime` now accept times as printed by
|
||||
`dnssec-settime -p`. [GL !2947]
|
||||
|
|
|
|||
|
|
@ -2681,6 +2681,8 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
|
|||
dns_catz_entry_getname(ev->entry), 0, NULL, &zone);
|
||||
|
||||
if (ev->mod) {
|
||||
dns_catz_zone_t *parentcatz;
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
|
|
@ -2688,30 +2690,40 @@ catz_addmodzone_taskaction(isc_task_t *task, isc_event_t *event0) {
|
|||
"modify zone \"%s\"",
|
||||
isc_result_totext(result), nameb);
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (!dns_zone_getadded(zone)) {
|
||||
isc_log_write(
|
||||
named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
"catz: "
|
||||
"catz_addmodzone_taskaction: "
|
||||
"zone '%s' is not a dynamically "
|
||||
"added zone",
|
||||
nameb);
|
||||
goto cleanup;
|
||||
}
|
||||
if (dns_zone_get_parentcatz(zone) != ev->origin) {
|
||||
isc_log_write(
|
||||
named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
"catz: catz_delzone_taskaction: "
|
||||
"zone '%s' exists in multiple "
|
||||
"catalog zones",
|
||||
nameb);
|
||||
goto cleanup;
|
||||
}
|
||||
dns_zone_detach(&zone);
|
||||
}
|
||||
|
||||
if (!dns_zone_getadded(zone)) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
"catz: catz_addmodzone_taskaction: "
|
||||
"zone '%s' is not a dynamically "
|
||||
"added zone",
|
||||
nameb);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
parentcatz = dns_zone_get_parentcatz(zone);
|
||||
|
||||
if (parentcatz == NULL) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
"catz: catz_addmodzone_taskaction: "
|
||||
"zone '%s' exists and is not added by "
|
||||
"a catalog zone, so won't be modified",
|
||||
nameb);
|
||||
goto cleanup;
|
||||
}
|
||||
if (parentcatz != ev->origin) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
"catz: catz_addmodzone_taskaction: "
|
||||
"zone '%s' exists in multiple "
|
||||
"catalog zones",
|
||||
nameb);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dns_zone_detach(&zone);
|
||||
} else {
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
|
|
|
|||
|
|
@ -1059,12 +1059,14 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||
result = dns_rdata_tostruct(&rdata, &rdata_a, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_sockaddr_fromin(&sockaddr, &rdata_a.in_addr, 0);
|
||||
dns_rdata_freestruct(&rdata_a);
|
||||
break;
|
||||
case dns_rdatatype_aaaa:
|
||||
result = dns_rdata_tostruct(&rdata, &rdata_aaaa, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_sockaddr_fromin6(&sockaddr, &rdata_aaaa.in6_addr,
|
||||
0);
|
||||
dns_rdata_freestruct(&rdata_aaaa);
|
||||
break;
|
||||
case dns_rdatatype_txt:
|
||||
result = dns_rdata_tostruct(&rdata, &rdata_txt, NULL);
|
||||
|
|
@ -1072,16 +1074,19 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||
|
||||
result = dns_rdata_txt_first(&rdata_txt);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_rdata_freestruct(&rdata_txt);
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_rdata_txt_current(&rdata_txt, &rdatastr);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_rdata_freestruct(&rdata_txt);
|
||||
return (result);
|
||||
}
|
||||
|
||||
result = dns_rdata_txt_next(&rdata_txt);
|
||||
if (result != ISC_R_NOMORE) {
|
||||
dns_rdata_freestruct(&rdata_txt);
|
||||
return (ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -1090,6 +1095,7 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||
dns_name_init(keyname, 0);
|
||||
memmove(keycbuf, rdatastr.data, rdatastr.length);
|
||||
keycbuf[rdatastr.length] = 0;
|
||||
dns_rdata_freestruct(&rdata_txt);
|
||||
result = dns_name_fromstring(keyname, keycbuf, 0, mctx);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_name_free(keyname, mctx);
|
||||
|
|
@ -1167,16 +1173,17 @@ catz_process_primaries(dns_catz_zone_t *zone, dns_ipkeylist_t *ipkl,
|
|||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_sockaddr_fromin(&ipkl->addrs[ipkl->count],
|
||||
&rdata_a.in_addr, 0);
|
||||
dns_rdata_freestruct(&rdata_a);
|
||||
} else {
|
||||
result = dns_rdata_tostruct(&rdata, &rdata_aaaa, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
isc_sockaddr_fromin6(&ipkl->addrs[ipkl->count],
|
||||
&rdata_aaaa.in6_addr, 0);
|
||||
dns_rdata_freestruct(&rdata_aaaa);
|
||||
}
|
||||
ipkl->keys[ipkl->count] = NULL;
|
||||
ipkl->labels[ipkl->count] = NULL;
|
||||
ipkl->count++;
|
||||
dns_rdata_freestruct(&rdata_a);
|
||||
}
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
|
@ -1418,6 +1425,7 @@ dns_catz_update_process(dns_catz_zones_t *catzs, dns_catz_zone_t *zone,
|
|||
/*
|
||||
* xxxwpk TODO do we want to save something from SOA?
|
||||
*/
|
||||
dns_rdata_freestruct(&soa);
|
||||
return (result);
|
||||
} else if (rdataset->type == dns_rdatatype_ns) {
|
||||
return (ISC_R_SUCCESS);
|
||||
|
|
@ -1778,12 +1786,13 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) {
|
|||
dns_rdatasetiter_t *rdsiter = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
char bname[DNS_NAME_FORMATSIZE];
|
||||
isc_buffer_t ibname;
|
||||
uint32_t vers;
|
||||
|
||||
REQUIRE(DNS_DB_VALID(db));
|
||||
REQUIRE(DNS_CATZ_ZONES_VALID(catzs));
|
||||
|
||||
dns_name_format(&db->origin, bname, DNS_NAME_FORMATSIZE);
|
||||
|
||||
/*
|
||||
* Create a new catz in the same context as current catz.
|
||||
*/
|
||||
|
|
@ -1797,10 +1806,6 @@ dns_catz_update_from_db(dns_db_t *db, dns_catz_zones_t *catzs) {
|
|||
return;
|
||||
}
|
||||
|
||||
isc_buffer_init(&ibname, bname, DNS_NAME_FORMATSIZE);
|
||||
result = dns_name_totext(&db->origin, true, &ibname);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
|
||||
result = dns_db_getsoaserial(db, oldzone->dbversion, &vers);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
/* A zone without SOA record?!? */
|
||||
|
|
|
|||
Loading…
Reference in a new issue