]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
fix determining if we apply SOA with changeset
authorLibor Peltan <libor.peltan@nic.cz>
Fri, 13 Jul 2018 09:19:37 +0000 (11:19 +0200)
committerLibor Peltan <libor.peltan@nic.cz>
Fri, 13 Jul 2018 09:19:37 +0000 (11:19 +0200)
src/knot/updates/apply.c

index 5864712424fd991c7be12c06b8be21ef22984647..216c1f76d402c5b01c57a8d2f30d2bdb08c0360d 100644 (file)
@@ -191,11 +191,15 @@ static int apply_single(apply_ctx_t *ctx, const changeset_t *chset)
 
        zone_contents_t *contents = ctx->contents;
 
-       bool ignore_soa = (chset->soa_from == NULL && chset->soa_to == NULL);
-
        // check if serial matches
        const knot_rdataset_t *soa = node_rdataset(contents->apex, KNOT_RRTYPE_SOA);
-       if (soa == NULL || (!ignore_soa && knot_soa_serial(soa->rdata) != knot_soa_serial(chset->soa_from->rrs.rdata))) {
+
+       // either we are in the mode of ignoring SOA (both NULL), or we shall be strict and apply SOA later
+       bool ignore_soa = (chset->soa_from == NULL && chset->soa_to == NULL);
+       bool soa_mismatch = (chset->soa_from == NULL || chset->soa_to == NULL || soa == NULL ||
+                            knot_soa_serial(soa->rdata) != knot_soa_serial(chset->soa_from->rrs.rdata));
+
+       if (soa == NULL || (!ignore_soa && soa_mismatch)) {
                return KNOT_EINVAL;
        }