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:38:11 -0200 |
commit | 3d146b13fdcb2a07dd389cd75740d48a738828e2 (patch) | |
tree | 293ae8ed14245f037c9ebb8daba7a02cd0380497 /src/etc/inc/unbound.inc | |
parent | 2da0fc7735d5e17f7bedc8f2f48962534b4ba301 (diff) | |
download | pfsense-3d146b13fdcb2a07dd389cd75740d48a738828e2.zip pfsense-3d146b13fdcb2a07dd389cd75740d48a738828e2.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 332e266..a080b0d 100644 --- a/src/etc/inc/unbound.inc +++ b/src/etc/inc/unbound.inc @@ -417,35 +417,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; @@ -577,7 +548,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'])) { |