From 807fd6cd358c71dd48fb7766e49f05f86b93d3fb Mon Sep 17 00:00:00 2001 From: Ermal Date: Tue, 4 Jan 2011 18:32:52 +0000 Subject: Unbreak dns server colletion. Pointyhat: myself --- etc/inc/system.inc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index ad7a9ef..bdd8157 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -160,9 +160,14 @@ function get_searchdomains() { // Read in dhclient nameservers $search_list = glob("/var/etc/searchdomain_*"); if (is_array($search_lists)) { - foreach($search_lists as $dns) { - if(is_hostname($dns)) - $master_list[] = $dns; + foreach($search_lists as $fdns) { + $contents = file($fdns, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (!is_array($contents)) + continue; + foreach ($contents as $dns) { + if(is_hostname($dns)) + $master_list[] = $dns; + } } } @@ -176,9 +181,14 @@ function get_nameservers() { // Read in dhclient nameservers $dns_lists = glob("/var/etc/nameserver_*"); if (is_array($dns_lists)) { - foreach($dns_lists as $dns) { - if(is_ipaddr($dns)) - $master_list[] = $dns; + foreach($dns_lists as $fdns) { + $contents = file($fdns, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); + if (!is_array($contents)) + continue; + foreach ($contents as $dns) { + if(is_ipaddr($dns)) + $master_list[] = $dns; + } } } -- cgit v1.1