]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
catalog: fix conf conflict detection
authorLibor Peltan <libor.peltan@nic.cz>
Fri, 13 Aug 2021 17:43:20 +0000 (19:43 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 19 Aug 2021 17:44:25 +0000 (19:44 +0200)
src/knot/catalog/catalog_update.c

index b52d748f1361befe72a9ea698160ef27c37ed82d..576f95929a2dd23dc520f565a8756a77096a6c0b 100644 (file)
@@ -263,13 +263,18 @@ static bool check_member(catalog_upd_val_t *val, conf_t *conf, catalog_t *cat)
        return true;
 }
 
+typedef struct {
+       conf_t *conf;
+       catalog_update_t *cup;
+} rem_conflict_ctx_t;
+
 static int rem_conf_conflict(const knot_dname_t *mem, const knot_dname_t *ow,
                              const knot_dname_t *cz, _unused_ const char *gr, void *ctx)
 {
-       conf_t *conf = ctx;
+       rem_conflict_ctx_t *rcctx = ctx;
 
-       if (conf_rawid_exists(conf, C_ZONE, mem, knot_dname_size(mem))) {
-               return catalog_update_add(ctx, mem, ow, cz, CAT_UPD_REM, NULL, 0, NULL);
+       if (conf_rawid_exists(rcctx->conf, C_ZONE, mem, knot_dname_size(mem))) {
+               return catalog_update_add(rcctx->cup, mem, ow, cz, CAT_UPD_REM, NULL, 0, NULL);
        }
        return KNOT_EOK;
 }
@@ -289,7 +294,8 @@ void catalog_update_finalize(catalog_update_t *u, catalog_t *cat, conf_t *conf)
        // This checks if the configuration file has not changed in the way
        // it conflicts with existing member zone and let config take precendence.
        if (cat->ro_txn != NULL) {
-               (void)catalog_apply(cat, NULL, rem_conf_conflict, conf, false);
+               rem_conflict_ctx_t rcctx = { conf, u };
+               (void)catalog_apply(cat, NULL, rem_conf_conflict, &rcctx, false);
        }
 }