add ability to get root hints file

This commit is contained in:
Warren Baker 2011-10-01 05:08:30 +02:00
parent 7e0d217d29
commit df74eeb07b

View File

@ -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;
}
?>