summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorFrancois Blanchette <fblanchette@datavalet.com>2014-02-07 15:11:58 -0500
committerFrancois Blanchette <fblanchette@datavalet.com>2014-02-07 15:11:58 -0500
commitd460371416d4e2cfef976d5a7616f63f6faa203f (patch)
treecdd99689b5f1352c316ff33bdb9c7eb2de835a6b /etc
parent59c6e2181f4c95eb68c9ef909b2675bea1d4ec8f (diff)
downloadpfsense-d460371416d4e2cfef976d5a7616f63f6faa203f.zip
pfsense-d460371416d4e2cfef976d5a7616f63f6faa203f.tar.gz
Replaced gethostbyname() with gethostbynamel() to get a list of all IPs associated with the dns name and add them to the allowed list
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/captiveportal.inc22
1 files changed, 12 insertions, 10 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc
index aaa0198..1322f20 100644
--- a/etc/inc/captiveportal.inc
+++ b/etc/inc/captiveportal.inc
@@ -1025,13 +1025,13 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) {
*/
if ($ishostname === true) {
if (!$g['booting']) {
- $ipaddress = gethostbyname($ipent['hostname']);
- if (!is_ipaddr($ipaddress))
+ $ipaddress = gethostbynamel($ipent['hostname']);
+ if(!is_array($ipaddress) || empty($ipaddress))
return;
- } else
- $ipaddress = "";
- } else
- $ipaddress = $ipent['ip'];
+ } else
+ $ipaddress = array();
+ } else
+ $ipaddress = array($ipent['ip']);
$rules = "";
$cp_filterdns_conf = "";
@@ -1045,15 +1045,17 @@ 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 (!is_ipaddr($ipaddress))
+ if (empty($ipaddress))
return array("", $cp_filterdns_conf);
}
$subnet = "";
if (!empty($ipent['sn']))
$subnet = "/{$ipent['sn']}";
- $rules .= "table 3 add {$ipaddress}{$subnet} {$pipeno}\n";
- $rules .= "table 4 add {$ipaddress}{$subnet} {$pipedown}\n";
-
+ foreach($ipaddress AS $one_address) {
+ $rules .= "table 3 add {$one_address}{$subnet} {$pipeno}\n";
+ $rules .= "table 4 add {$one_address}{$subnet} {$pipedown}\n";
+ }
+
if ($ishostname === true)
return array($rules, $cp_filterdns_conf);
else
OpenPOWER on IntegriCloud