]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
hints: server stop when root hints load failed
authorVítězslav Kříž <vitezslav.kriz@nic.cz>
Mon, 4 Dec 2017 14:15:33 +0000 (15:15 +0100)
committerVítězslav Kříž <vitezslav.kriz@nic.cz>
Mon, 4 Dec 2017 15:48:05 +0000 (16:48 +0100)
If user provides custom hints file with config option hints.root_file('file')
resovler fail with error. Before it just silently pass and may fail
when loading defaults file, which leads to confusing error message.

modules/hints/hints.c

index 00c73b8ff05af8f0d6b84829b09030119e406a53..ad3f66e0a3375b49bac8bfec15d69adb27fff34c 100644 (file)
@@ -27,6 +27,7 @@
 #include <ccan/json/json.h>
 #include <ucw/mempool.h>
 #include <contrib/cleanup.h>
+#include <lauxlib.h>
 
 #include "daemon/engine.h"
 #include "lib/zonecut.h"
@@ -570,6 +571,9 @@ static char* hint_root_file(void *env, struct kr_module *module, const char *arg
        struct engine *engine = env;
        struct kr_context *ctx = &engine->resolver;
        const char *err_msg = engine_hint_root_file(ctx, args);
+       if (err_msg) {
+               luaL_error(engine->L, "error when opening '%s': %s", args, err_msg);
+       }
        return strdup(err_msg ? err_msg : "");
 }