]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
conf: simplify zone checks
authorDaniel Salzman <daniel.salzman@nic.cz>
Sat, 28 May 2022 17:12:51 +0000 (19:12 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Sat, 28 May 2022 17:17:17 +0000 (19:17 +0200)
src/knot/conf/tools.c

index a43955ac69430507425a6f0a48c8381062e42de6..b9745541c08f0d8978df6441b2b6b77b089c69be 100644 (file)
@@ -786,21 +786,24 @@ int check_zone(
 {
        conf_val_t zf_load = conf_zone_get_txn(args->extra->conf, args->extra->txn,
                                               C_ZONEFILE_LOAD, yp_dname(args->id));
-       conf_val_t journal = conf_zone_get_txn(args->extra->conf, args->extra->txn,
-                                              C_JOURNAL_CONTENT, yp_dname(args->id));
-       if (conf_opt(&zf_load) == ZONEFILE_LOAD_DIFSE &&
-           conf_opt(&journal) != JOURNAL_CONTENT_ALL) {
-               args->err_str = "'zonefile-load: difference-no-serial' requires 'journal-content: all'";
-               return KNOT_EINVAL;
+       if (conf_opt(&zf_load) == ZONEFILE_LOAD_DIFSE) {
+               conf_val_t journal = conf_zone_get_txn(args->extra->conf, args->extra->txn,
+                                                      C_JOURNAL_CONTENT, yp_dname(args->id));
+               if (conf_opt(&journal) != JOURNAL_CONTENT_ALL) {
+                       args->err_str = "'zonefile-load: difference-no-serial' requires 'journal-content: all'";
+                       return KNOT_EINVAL;
+               }
        }
 
-       conf_val_t signing = conf_zone_get_txn(args->extra->conf, args->extra->txn,
-                                              C_DNSSEC_SIGNING, yp_dname(args->id));
        conf_val_t validation = conf_zone_get_txn(args->extra->conf, args->extra->txn,
                                                  C_DNSSEC_VALIDATION, yp_dname(args->id));
-       if (conf_bool(&signing) == true && conf_bool(&validation) == true) {
-               args->err_str = "'dnssec-validation' is not compatible with 'dnssec-signing'";
-               return KNOT_EINVAL;
+       if (conf_bool(&validation)) {
+               conf_val_t signing = conf_zone_get_txn(args->extra->conf, args->extra->txn,
+                                                      C_DNSSEC_SIGNING, yp_dname(args->id));
+               if (conf_bool(&signing)) {
+                       args->err_str = "'dnssec-validation' is not compatible with 'dnssec-signing'";
+                       return KNOT_EINVAL;
+               }
        }
 
        conf_val_t catalog_role = conf_zone_get_txn(args->extra->conf, args->extra->txn,