mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-11 10:40:56 -04:00
Refactor dnssec-ksr
Refactor some more, making the cleanup a generic function.
This commit is contained in:
parent
852ba174dd
commit
2bf03ab7df
1 changed files with 13 additions and 13 deletions
|
|
@ -211,6 +211,17 @@ setcontext(ksr_ctx_t *ksr, dns_kasp_t *kasp) {
|
|||
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
|
||||
progress(int p) {
|
||||
char c = '*';
|
||||
|
|
@ -567,13 +578,7 @@ keygen(ksr_ctx_t *ksr) {
|
|||
fatal("policy '%s' has no zsks", ksr->policy);
|
||||
}
|
||||
/* Cleanup */
|
||||
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);
|
||||
cleanup(&keys, kasp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -630,12 +635,7 @@ request(ksr_ctx_t *ksr) {
|
|||
inception = next;
|
||||
}
|
||||
/* Cleanup */
|
||||
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);
|
||||
}
|
||||
cleanup(&keys, kasp);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Reference in a new issue