]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
load: ignore DNSSEC records in the remove section of journal changesets
authorDaniel Salzman <daniel.salzman@nic.cz>
Fri, 18 Oct 2019 17:47:24 +0000 (19:47 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Mon, 21 Oct 2019 10:58:25 +0000 (12:58 +0200)
This can happen if 'zonefile-load: difference' and 'dnssec-signing: on` are
configured and the server tries to apply such a changeset on unsigned zone file.

Compatibility with journal versions < 2.9.

fixes #659

src/knot/zone/node.c
src/knot/zone/zone-load.c

index feffe7048bcb99b4572bfe0bb53cfed2d9e0d5f5..fa92910de227d30b465b7308be76d0f997786fba 100644 (file)
@@ -358,6 +358,9 @@ int node_remove_rrset(zone_node_t *node, const knot_rrset_t *rrset, knot_mm_t *m
        }
 
        knot_rdataset_t *node_rrs = node_rdataset(node, rrset->type);
+       if (node_rrs == NULL) {
+               return KNOT_ENOENT;
+       }
 
        node->flags &= ~NODE_FLAGS_RRSIGS_VALID;
 
index e6fb55576c07b0b5e649eff92477c6a360db1bb0..96d12a880a0cf1bb13c6e5e77b8e2642efd613b4 100644 (file)
@@ -64,8 +64,17 @@ static int apply_one_cb(bool remove, const knot_rrset_t *rr, void *ctx)
 {
        zone_node_t *unused = NULL;
        zone_contents_t *contents = ctx;
-       return remove ? zone_contents_remove_rr(contents, rr, &unused)
-                     : zone_contents_add_rr(contents, rr, &unused);
+       int ret = remove ? zone_contents_remove_rr(contents, rr, &unused)
+                        : zone_contents_add_rr(contents, rr, &unused);
+       if (ret == KNOT_ENOENT && remove && knot_rrtype_is_dnssec(rr->type)) {
+               // Compatibility with imperfect journal contents (versions < 2.9) if
+               // 'zonefile-load: difference' and 'dnssec-signing: on`.
+               // Journal history can contain a changeset with removed DNSSEC records
+               // which are not present in the zonefile.
+               return KNOT_EOK;
+       } else {
+               return ret;
+       }
 }
 
 int zone_load_journal(conf_t *conf, zone_t *zone, zone_contents_t *contents)