aboutsummaryrefslogtreecommitdiffstats
path: root/net/unbound.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-06-19 19:49:32 +0200
committerKim Alvefur <zash@zash.se>2022-06-19 19:49:32 +0200
commit4f3ba05b4d16d02e7600ea707eac30a6a3a80fc8 (patch)
tree3ccbe7b1a161d966c36a7be867a7ae9496d53272 /net/unbound.lua
parentd5e749bc8a1a6b003ba858310145745dcad5ec9c (diff)
downloadprosody-4f3ba05b4d16d02e7600ea707eac30a6a3a80fc8.tar.gz
prosody-4f3ba05b4d16d02e7600ea707eac30a6a3a80fc8.zip
net.unbound: Merge luaunbound and prosody defaults in absence of user config (fixes #1763) (thanks rgd)
add_defaults() is supposed to merge 3 tables, the defaults in luaunbound, the defaults from prosody and any config from the prosody config file. In the case where no `unbound={}` has been in the config, it skips over the merge and returns only the prosody built-in defaults. This results in libunbound skipping reading resolv.conf and uses its default behavior of full recursive resolution. Prior to #1737 there were only two tables, the luaunbound defaults and the prosody config, where bypassing the merge and returning the former did the right thing.
Diffstat (limited to 'net/unbound.lua')
-rw-r--r--net/unbound.lua19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/unbound.lua b/net/unbound.lua
index 4d8f9284..ee742b7c 100644
--- a/net/unbound.lua
+++ b/net/unbound.lua
@@ -28,19 +28,16 @@ local parsers = dns_utils.parsers;
local builtin_defaults = { hoststxt = false }
local function add_defaults(conf)
- if conf then
- for option, default in pairs(builtin_defaults) do
- if conf[option] == nil then
- conf[option] = default;
- end
+ conf = conf or {};
+ for option, default in pairs(builtin_defaults) do
+ if conf[option] == nil then
+ conf[option] = default;
end
- for option, default in pairs(libunbound.config) do
- if conf[option] == nil then
- conf[option] = default;
- end
+ end
+ for option, default in pairs(libunbound.config) do
+ if conf[option] == nil then
+ conf[option] = default;
end
- else
- return builtin_defaults;
end
return conf;
end