REQUIRE(DNS_ZONE_VALID(zone));
result = dns_db_getoriginnode(db, &node);
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
return (result);
+ }
dns_rdataset_init(&cds);
dns_rdataset_init(&dnskey);
result = dns_db_findrdataset(db, node, version, dns_rdatatype_cds,
dns_rdatatype_none, 0, &cds, NULL);
- if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND)
+ if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
goto failure;
+ }
result = dns_db_findrdataset(db, node, version, dns_rdatatype_cdnskey,
dns_rdatatype_none, 0, &cdnskey, NULL);
- if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND)
+ if (result != ISC_R_SUCCESS && result != ISC_R_NOTFOUND) {
goto failure;
+ }
if (!dns_rdataset_isassociated(&cds) &&
- !dns_rdataset_isassociated(&cdnskey)) {
+ !dns_rdataset_isassociated(&cdnskey))
+ {
result = ISC_R_SUCCESS;
goto failure;
}
result = dns_db_findrdataset(db, node, version, dns_rdatatype_dnskey,
dns_rdatatype_none, 0, &dnskey, NULL);
if (result == ISC_R_NOTFOUND) {
- if (dns_rdataset_isassociated(&cds))
+ if (dns_rdataset_isassociated(&cds)) {
result = DNS_R_BADCDS;
- else
+ } else {
result = DNS_R_BADCDNSKEY;
+ }
goto failure;
}
- if (result != ISC_R_SUCCESS)
+ if (result != ISC_R_SUCCESS) {
goto failure;
+ }
/*
* For each DNSSEC algorithm in the CDS RRset there must be
continue;
}
CHECK(dns_rdata_tostruct(&crdata, &structcds, NULL));
- if (algorithms[structcds.algorithm] == 0)
+ if (algorithms[structcds.algorithm] == 0) {
algorithms[structcds.algorithm] = 1;
+ }
for (result = dns_rdataset_first(&dnskey);
result == ISC_R_SUCCESS;
result = dns_rdataset_next(&dnskey)) {
buffer, &dsrdata));
if (crdata.length == dsrdata.length &&
memcmp(crdata.data, dsrdata.data,
- dsrdata.length) == 0) {
+ dsrdata.length) == 0)
+ {
algorithms[structcds.algorithm] = 2;
}
}
- if (result != ISC_R_NOMORE)
+ if (result != ISC_R_NOMORE) {
goto failure;
+ }
}
for (i = 0; i < sizeof(algorithms); i++) {
if (delete) {
}
CHECK(dns_rdata_tostruct(&crdata, &structcdnskey,
NULL));
- if (algorithms[structcdnskey.algorithm] == 0)
+ if (algorithms[structcdnskey.algorithm] == 0) {
algorithms[structcdnskey.algorithm] = 1;
+ }
for (result = dns_rdataset_first(&dnskey);
result == ISC_R_SUCCESS;
result = dns_rdataset_next(&dnskey)) {
dns_rdataset_current(&dnskey, &rdata);
if (crdata.length == rdata.length &&
memcmp(crdata.data, rdata.data,
- rdata.length) == 0) {
+ rdata.length) == 0)
+ {
algorithms[structcdnskey.algorithm] = 2;
}
}
- if (result != ISC_R_NOMORE)
+ if (result != ISC_R_NOMORE) {
goto failure;
+ }
}
for (i = 0; i < sizeof(algorithms); i++) {
if (delete) {
result = ISC_R_SUCCESS;
failure:
- if (dns_rdataset_isassociated(&cds))
+ if (dns_rdataset_isassociated(&cds)) {
dns_rdataset_disassociate(&cds);
- if (dns_rdataset_isassociated(&dnskey))
+ }
+ if (dns_rdataset_isassociated(&dnskey)) {
dns_rdataset_disassociate(&dnskey);
- if (dns_rdataset_isassociated(&cdnskey))
+ }
+ if (dns_rdataset_isassociated(&cdnskey)) {
dns_rdataset_disassociate(&cdnskey);
+ }
dns_db_detachnode(db, &node);
return (result);
}