2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

2349. [func] Provide incremental re-signing support for secure

dynamic zones. [RT #1091]
This commit is contained in:
Mark Andrews
2008-04-01 01:37:25 +00:00
parent 28b3569d62
commit a76b380643
29 changed files with 2781 additions and 304 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: journal.c,v 1.99 2007/09/07 05:14:33 marka Exp $ */
/* $Id: journal.c,v 1.100 2008/04/01 01:37:24 marka Exp $ */
#include <config.h>
@@ -709,8 +709,35 @@ ixfr_order(const void *av, const void *bv) {
dns_difftuple_t const *a = *ap;
dns_difftuple_t const *b = *bp;
int r;
int bop = 0, aop = 0;
r = (b->op == DNS_DIFFOP_DEL) - (a->op == DNS_DIFFOP_DEL);
switch (a->op) {
case DNS_DIFFOP_DEL:
case DNS_DIFFOP_DELRESIGN:
aop = 1;
break;
case DNS_DIFFOP_ADD:
case DNS_DIFFOP_ADDRESIGN:
aop = 0;
break;
default:
INSIST(0);
}
switch (b->op) {
case DNS_DIFFOP_DEL:
case DNS_DIFFOP_DELRESIGN:
bop = 1;
break;
case DNS_DIFFOP_ADD:
case DNS_DIFFOP_ADDRESIGN:
bop = 0;
break;
default:
INSIST(0);
}
r = bop - aop;
if (r != 0)
return (r);
@@ -1191,7 +1218,7 @@ dns_journal_destroy(dns_journal_t **journalp) {
/* XXX Share code with incoming IXFR? */
static isc_result_t
roll_forward(dns_journal_t *j, dns_db_t *db) {
roll_forward(dns_journal_t *j, dns_db_t *db, unsigned int options) {
isc_buffer_t source; /* Transaction data from disk */
isc_buffer_t target; /* Ditto after _fromwire check */
isc_uint32_t db_serial; /* Database SOA serial */
@@ -1202,6 +1229,7 @@ roll_forward(dns_journal_t *j, dns_db_t *db) {
dns_diff_t diff;
unsigned int n_soa = 0;
unsigned int n_put = 0;
dns_diffop_t op;
REQUIRE(DNS_JOURNAL_VALID(j));
REQUIRE(DNS_DB_VALID(db));
@@ -1273,9 +1301,14 @@ roll_forward(dns_journal_t *j, dns_db_t *db) {
"initial SOA", j->filename);
FAIL(ISC_R_UNEXPECTED);
}
CHECK(dns_difftuple_create(diff.mctx, n_soa == 1 ?
DNS_DIFFOP_DEL : DNS_DIFFOP_ADD,
name, ttl, rdata, &tuple));
if ((options & DNS_JOURNALOPT_RESIGN) != 0)
op = (n_soa == 1) ? DNS_DIFFOP_DELRESIGN :
DNS_DIFFOP_ADDRESIGN;
else
op = (n_soa == 1) ? DNS_DIFFOP_DEL : DNS_DIFFOP_ADD;
CHECK(dns_difftuple_create(diff.mctx, op, name, ttl, rdata,
&tuple));
dns_diff_append(&diff, &tuple);
if (++n_put > 100) {
@@ -1317,7 +1350,9 @@ roll_forward(dns_journal_t *j, dns_db_t *db) {
}
isc_result_t
dns_journal_rollforward(isc_mem_t *mctx, dns_db_t *db, const char *filename) {
dns_journal_rollforward(isc_mem_t *mctx, dns_db_t *db,
unsigned int options, const char *filename)
{
dns_journal_t *j;
isc_result_t result;
@@ -1336,7 +1371,7 @@ dns_journal_rollforward(isc_mem_t *mctx, dns_db_t *db, const char *filename) {
if (JOURNAL_EMPTY(&j->header))
result = DNS_R_UPTODATE;
else
result = roll_forward(j, db);
result = roll_forward(j, db, options);
dns_journal_destroy(&j);