summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/unbound.inc
diff options
context:
space:
mode:
authorNOYB <Al_Stu@Frontier.com>2016-01-08 02:45:14 -0800
committerNOYB <Al_Stu@Frontier.com>2016-01-25 17:03:01 -0800
commit9a83872f226c20635feb2662d4d45df6f93de6a0 (patch)
treebf32e03fa1a44361df3c6338e597aa74348fe361 /src/etc/inc/unbound.inc
parentbc91a3fe288bc5b7e5da3ab5e7665adea3ebc5fc (diff)
downloadpfsense-9a83872f226c20635feb2662d4d45df6f93de6a0.zip
pfsense-9a83872f226c20635feb2662d4d45df6f93de6a0.tar.gz
Move unbound local zone types array to function in unbound.inc.
Protect against breaking the system; check for valid unbound local zone type rather than just the setting existence.
Diffstat (limited to 'src/etc/inc/unbound.inc')
-rw-r--r--src/etc/inc/unbound.inc22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/etc/inc/unbound.inc b/src/etc/inc/unbound.inc
index b903551..0dde2a8 100644
--- a/src/etc/inc/unbound.inc
+++ b/src/etc/inc/unbound.inc
@@ -599,10 +599,11 @@ function unbound_add_domain_overrides($pvt_rev="", $cfgsubdir = "") {
function unbound_add_host_entries($cfgsubdir = "") {
global $config, $g;
- if (empty($config['unbound']['system_domain_local_zone_type'])) {
- $system_domain_local_zone_type = "transparent";
- } else {
+ // Make sure the config setting is a valid unbound local zone type. If not use "transparent".
+ if (array_key_exists($config['unbound']['system_domain_local_zone_type'], unbound_local_zone_types())) {
$system_domain_local_zone_type = $config['unbound']['system_domain_local_zone_type'];
+ } else {
+ $system_domain_local_zone_type = "transparent";
}
$unbound_entries = "local-zone: \"{$config['system']['domain']}\" $system_domain_local_zone_type\n";
@@ -793,4 +794,19 @@ function unbound_hosts_generate() {
unbound_control("reload");
}
+// Array of valid unbound local zone types
+function unbound_local_zone_types() {
+ return array(
+ "deny" => gettext("Deny"),
+ "refuse" => gettext("Refuse"),
+ "static" => gettext("Static"),
+ "transparent" => gettext("Transparent"),
+ "typetransparent" => gettext("Type Transparent"),
+ "redirect" => gettext("Redirect"),
+ "inform" => gettext("Inform"),
+ "inform_deny" => gettext("Inform Deny"),
+ "nodefault" => gettext("No Default")
+ );
+}
+
?>
OpenPOWER on IntegriCloud