diff options
author | Renato Botelho <renato@netgate.com> | 2017-01-11 13:45:31 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-01-11 14:46:33 -0200 |
commit | 881ebd59520f6140546a45fd3fa21b62eb09f037 (patch) | |
tree | 90da411a50754704e84533ab4e4152658caccedd /src/etc/inc/unbound.inc | |
parent | e0696aa4ad3a8a7efa8c3bb9effc0b14e17440ec (diff) | |
download | pfsense-881ebd59520f6140546a45fd3fa21b62eb09f037.zip pfsense-881ebd59520f6140546a45fd3fa21b62eb09f037.tar.gz |
Ticket #6712: Deprecate read_hosts()
Read local items from system_hosts_local_entries()
Diffstat (limited to 'src/etc/inc/unbound.inc')
-rw-r--r-- | src/etc/inc/unbound.inc | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/src/etc/inc/unbound.inc b/src/etc/inc/unbound.inc index f4575ec..95dfe06 100644 --- a/src/etc/inc/unbound.inc +++ b/src/etc/inc/unbound.inc @@ -449,35 +449,6 @@ EOF; } } -// Read /etc/hosts -function read_hosts() { - - /* Open /etc/hosts and extract the only dhcpleases info - * XXX - to convert to an unbound C library which reads /etc/hosts automatically - */ - $etc_hosts = array(); - foreach (file('/etc/hosts') as $line) { - if (strpos($line, "dhcpleases automatically entered")) { - break; - } - $d = preg_split('/\s+/', $line, -1, PREG_SPLIT_NO_EMPTY); - if (empty($d) || substr(reset($d), 0, 1) == "#") { - continue; - } - $ip = array_shift($d); - $fqdn = array_shift($d); - $name = array_shift($d); - if (!empty($fqdn) && $fqdn != "empty") { - if (!empty($name) && $name != "empty") { - array_push($etc_hosts, array(ipaddr => "$ip", fqdn => "$fqdn", name => "$name")); - } else { - array_push($etc_hosts, array(ipaddr => "$ip", fqdn => "$fqdn")); - } - } - } - return $etc_hosts; -} - function sync_unbound_service() { global $config, $g; @@ -609,7 +580,7 @@ function unbound_add_host_entries($cfgsubdir = "") { $unbound_entries = "local-zone: \"{$config['system']['domain']}\" {$system_domain_local_zone_type}\n"; - $hosts = read_hosts(); + $hosts = system_hosts_local_entries(); $added_ptr = array(); foreach ($hosts as $host) { if (is_ipaddrv4($host['ipaddr'])) { |