zone->zonefile.mtime.tv_nsec == mtime.tv_nsec);
free(filename);
if (ret == KNOT_EOK) {
- ret = zone_load_contents(conf, zone->name, &zf_conts);
+ ret = zone_load_contents(conf, zone->name, &zf_conts, false);
}
if (ret != KNOT_EOK) {
zf_conts = NULL;
struct sem_handler {
sem_callback cb;
bool fatal_error;
+ bool warning;
};
/*!
#include "libknot/libknot.h"
int zone_load_contents(conf_t *conf, const knot_dname_t *zone_name,
- zone_contents_t **contents)
+ zone_contents_t **contents, bool fail_on_warning)
{
if (conf == NULL || zone_name == NULL || contents == NULL) {
return KNOT_EINVAL;
if (*contents == NULL) {
return KNOT_ERROR;
}
+ if (handler.warning && fail_on_warning) {
+ return KNOT_ESEMCHECK;
+ }
zone_trees_unify_binodes((*contents)->nodes, (*contents)->nsec3_nodes);
-/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
* \param conf
* \param zone_name
* \param contents
- * \return KNOT_EOK or an error
+ * \param fail_on_warning
+ *
+ * \retval KNOT_EOK if success.
+ * \retval KNOT_ESEMCHECK if any semantic check warning.
+ * \retval KNOT_E* if error.
*/
int zone_load_contents(conf_t *conf, const knot_dname_t *zone_name,
- zone_contents_t **contents);
+ zone_contents_t **contents, bool fail_on_warning);
/*!
* \brief Update zone contents from the journal.
assert(handler != NULL);
assert(zone != NULL);
+ if (!handler->fatal_error) {
+ handler->warning = true;
+ }
+
char buff[KNOT_DNAME_TXT_MAXLEN + 1] = "";
if (node != NULL) {
(void)knot_dname_to_str(buff, node->owner, sizeof(buff));
-/* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
static int zone_check(const knot_dname_t *dname, void *data)
{
- UNUSED(data);
+ cmd_args_t *args = data;
- zone_contents_t *contents;
- int ret = zone_load_contents(conf(), dname, &contents);
- if (ret == KNOT_EOK) {
- zone_contents_deep_free(contents);
- }
+ zone_contents_t *contents = NULL;
+ int ret = zone_load_contents(conf(), dname, &contents, args->force);
+ zone_contents_deep_free(contents);
return ret;
}
static int cmd_zone_check(cmd_args_t *args)
{
- return zone_exec(args, zone_check, NULL);
+ return zone_exec(args, zone_check, args);
}
static int zone_memstats(const knot_dname_t *dname, void *data)