From df74eeb07ba2f49c2d0dec3b96543df233f9fd1f Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Sat, 1 Oct 2011 05:08:30 +0200 Subject: [PATCH] add ability to get root hints file --- etc/inc/unbound.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc index 00949a1f76..ed5d5f2db2 100644 --- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -128,5 +128,21 @@ function unbound_optimization() { return $optimization; } +function unbound_fetch_root_hints() { + global $g; + + $hints = "{$g['unbound_chroot_path']}/etc/root.hints"; + if (@filesize($hints) == 0 ) { + conf_mount_rw(); + $returnvar = mwexec("/usr/bin/dig +tcp +nocmd +answer @`/usr/bin/dig +nocmd +noall +answer +short . NS | /usr/bin/head -1` . NS > {$hints}"); + conf_mount_ro(); + if ($returnvar != 0) { + mwexec("/bin/rm -f {$hints}"); + return false; + } else + return true; + } else + return true; +} ?> \ No newline at end of file