From 9e875e0c00b4707e0b13473af431c842f2d42974 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 18 Feb 2014 08:34:29 -0300 Subject: Revert "Replaced gethostbyname() with gethostbynamel() to get a list of all IPs associated with the dns name and add them to the allowed list" This change is not needed, filterdns will handle it. This reverts commit d460371416d4e2cfef976d5a7616f63f6faa203f. --- etc/inc/captiveportal.inc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'etc') diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 9713e97..fc813ad 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -1028,13 +1028,13 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) { */ if ($ishostname === true) { if (!$g['booting']) { - $ipaddress = gethostbynamel($ipent['hostname']); - if(!is_array($ipaddress) || empty($ipaddress)) + $ipaddress = gethostbyname($ipent['hostname']); + if (!is_ipaddr($ipaddress)) return; - } else - $ipaddress = array(); - } else - $ipaddress = array($ipent['ip']); + } else + $ipaddress = ""; + } else + $ipaddress = $ipent['ip']; $rules = ""; $cp_filterdns_conf = ""; @@ -1048,17 +1048,15 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) { if ($ishostname === true) { $cp_filterdns_conf .= "ipfw {$ipent['hostname']} 3 pipe {$pipeno}\n"; $cp_filterdns_conf .= "ipfw {$ipent['hostname']} 4 pipe {$pipedown}\n"; - if (empty($ipaddress)) + if (!is_ipaddr($ipaddress)) return array("", $cp_filterdns_conf); } $subnet = ""; if (!empty($ipent['sn'])) $subnet = "/{$ipent['sn']}"; - foreach($ipaddress AS $one_address) { - $rules .= "table 3 add {$one_address}{$subnet} {$pipeno}\n"; - $rules .= "table 4 add {$one_address}{$subnet} {$pipedown}\n"; - } - + $rules .= "table 3 add {$ipaddress}{$subnet} {$pipeno}\n"; + $rules .= "table 4 add {$ipaddress}{$subnet} {$pipedown}\n"; + if ($ishostname === true) return array($rules, $cp_filterdns_conf); else -- cgit v1.1