mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
Refactor dnssec-ksr
Refactor some more, making the cleanup a generic function.
This commit is contained in:
@@ -211,6 +211,17 @@ setcontext(ksr_ctx_t *ksr, dns_kasp_t *kasp) {
|
|||||||
ksr->ttlsig = dns_kasp_zonemaxttl(kasp, true);
|
ksr->ttlsig = dns_kasp_zonemaxttl(kasp, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cleanup(dns_dnsseckeylist_t *keys, dns_kasp_t *kasp) {
|
||||||
|
while (!ISC_LIST_EMPTY(*keys)) {
|
||||||
|
dns_dnsseckey_t *key = ISC_LIST_HEAD(*keys);
|
||||||
|
ISC_LIST_UNLINK(*keys, key, link);
|
||||||
|
dst_key_free(&key->key);
|
||||||
|
dns_dnsseckey_destroy(mctx, &key);
|
||||||
|
}
|
||||||
|
dns_kasp_detach(&kasp);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
progress(int p) {
|
progress(int p) {
|
||||||
char c = '*';
|
char c = '*';
|
||||||
@@ -567,13 +578,7 @@ keygen(ksr_ctx_t *ksr) {
|
|||||||
fatal("policy '%s' has no zsks", ksr->policy);
|
fatal("policy '%s' has no zsks", ksr->policy);
|
||||||
}
|
}
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
while (!ISC_LIST_EMPTY(keys)) {
|
cleanup(&keys, kasp);
|
||||||
dns_dnsseckey_t *key = ISC_LIST_HEAD(keys);
|
|
||||||
ISC_LIST_UNLINK(keys, key, link);
|
|
||||||
dst_key_free(&key->key);
|
|
||||||
dns_dnsseckey_destroy(mctx, &key);
|
|
||||||
}
|
|
||||||
dns_kasp_detach(&kasp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -630,12 +635,7 @@ request(ksr_ctx_t *ksr) {
|
|||||||
inception = next;
|
inception = next;
|
||||||
}
|
}
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
while (!ISC_LIST_EMPTY(keys)) {
|
cleanup(&keys, kasp);
|
||||||
dns_dnsseckey_t *key = ISC_LIST_HEAD(keys);
|
|
||||||
ISC_LIST_UNLINK(keys, key, link);
|
|
||||||
dst_key_free(&key->key);
|
|
||||||
dns_dnsseckey_destroy(mctx, &key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Reference in New Issue
Block a user