Permalink
Browse files

Add a safety belt in case we get no values returned

  • Loading branch information...
1 parent e1df5bd commit 09b882f22f8456f50242febe3f16f2fa9bd7d591 Warren Baker committed Feb 23, 2014
Showing with 9 additions and 6 deletions.
  1. +9 −6 config/unbound/unbound.inc
View
@@ -543,11 +543,6 @@ EOD;
// Set up forward-zones if configured
if ($unbound_config['forwarding_mode'] == "on") {
- $unbound_conf .=<<<EOD
-forward-zone:
- name: "."
-
-EOD;
$dnsservers = array();
if (!isset($config['system']['dnsallowoverride'])) {
$ns = array_unique(get_nameservers());
@@ -562,8 +557,16 @@ EOD;
$dnsservers[] = $nameserver;
}
}
- foreach($dnsservers as $dnsserver)
+
+ if (!empty($dnsservers)) {
+ $unbound_conf .=<<<EOD
+forward-zone:
+ name: "."
+
+EOD;
+ foreach($dnsservers as $dnsserver)
$unbound_conf .= "\tforward-addr: $dnsserver\n";
+ }
}

0 comments on commit 09b882f

Please sign in to comment.