mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Make sure $cpzoneid is defined and use it to call pfSense_ipfw_Tableaction() and pfSense_ipfw_getTablestats(). Also fix fieldnames for captiveportal_hostnames. It should fix #4001
This commit is contained in:
parent
0cd7c91a29
commit
b4e0f02b89
@ -61,27 +61,32 @@ if (!is_array($config['captiveportal']))
|
||||
$config['captiveportal'] = array();
|
||||
$a_cp =& $config['captiveportal'];
|
||||
|
||||
if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid']))
|
||||
$cpzoneid = $a_cp[$cpzone]['zoneid'];
|
||||
|
||||
$pgtitle = array(gettext("Services"),gettext("Captive portal"), $a_cp[$cpzone]['zone']);
|
||||
$shortcut_section = "captiveportal";
|
||||
|
||||
if ($_GET['act'] == "del" && !empty($cpzone)) {
|
||||
if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
|
||||
$a_allowedhostnames =& $a_cp[$cpzone]['allowedhostname'];
|
||||
if ($a_allowedhostnames[$_GET['id']]) {
|
||||
$ipent = $a_allowedhostnames[$_GET['id']];
|
||||
|
||||
if (isset($a_cp[$cpzone]['enable'])) {
|
||||
if (!empty($ipent['sn']))
|
||||
$ipent['ip'] .= "/{$ipent['sn']}";
|
||||
$ip = gethostbyname($ipent['ip']);
|
||||
if(is_ipaddr($ipent['hostname']))
|
||||
$ip = $ipent['hostname'];
|
||||
else
|
||||
$ip = gethostbyname($ipent['hostname']);
|
||||
$sn = (is_ipaddrv6($ip)) ? 128 : 32;
|
||||
if(is_ipaddr($ip)) {
|
||||
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ip);
|
||||
$ipfw = pfSense_ipfw_getTablestats($cpzoneid, 3, $ip);
|
||||
if (is_array($ipfw)) {
|
||||
captiveportal_free_dn_ruleno($ipfw['dnpipe']);
|
||||
pfSense_pipe_action("pipe delete {$ipfw['dnpipe']}");
|
||||
pfSense_pipe_action("pipe delete " . ($ipfw['dnpipe']+1));
|
||||
}
|
||||
pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_XDEL, 3, $ip);
|
||||
pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_XDEL, 4, $ip);
|
||||
pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 3, $ip, $sn);
|
||||
pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 4, $ip, $sn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,10 +59,13 @@ if (!is_array($config['captiveportal']))
|
||||
$config['captiveportal'] = array();
|
||||
$a_cp =& $config['captiveportal'];
|
||||
|
||||
if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid']))
|
||||
$cpzoneid = $a_cp[$cpzone]['zoneid'];
|
||||
|
||||
$pgtitle = array(gettext("Services"),gettext("Captive portal"), $a_cp[$cpzone]['zone']);
|
||||
$shortcut_section = "captiveportal";
|
||||
|
||||
if ($_GET['act'] == "del") {
|
||||
if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
|
||||
$a_allowedips =& $config['captiveportal'][$cpzone]['allowedip'];
|
||||
if ($a_allowedips[$_GET['id']]) {
|
||||
$ipent = $a_allowedips[$_GET['id']];
|
||||
@ -70,9 +73,9 @@ if ($_GET['act'] == "del") {
|
||||
if (isset($config['captiveportal'][$cpzone]['enable'])) {
|
||||
$mask = (!empty($ipent['sn'])) ? $ipent['sn'] : 32;
|
||||
|
||||
$ipfw = pfSense_ipfw_getTablestats($cpzone, 3, $ipent['ip'], $mask);
|
||||
pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_XDEL, 3, $ipent['ip'], $mask);
|
||||
pfSense_ipfw_Tableaction($cpzone, IP_FW_TABLE_XDEL, 4, $ipent['ip'], $mask);
|
||||
$ipfw = pfSense_ipfw_getTablestats($cpzoneid, 3, $ipent['ip'], $mask);
|
||||
pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 3, $ipent['ip'], $mask);
|
||||
pfSense_ipfw_Tableaction($cpzoneid, IP_FW_TABLE_XDEL, 4, $ipent['ip'], $mask);
|
||||
|
||||
if (is_array($ipfw)) {
|
||||
captiveportal_free_dn_ruleno($ipfw['dnpipe']);
|
||||
|
||||
@ -50,12 +50,6 @@ $cpzone = $_GET['zone'];
|
||||
if (isset($_POST['zone']))
|
||||
$cpzone = $_POST['zone'];
|
||||
|
||||
if ($_GET['act'] == "del" && !empty($cpzone)) {
|
||||
captiveportal_disconnect_client($_GET['id']);
|
||||
header("Location: status_captiveportal.php?zone={$cpzone}");
|
||||
exit;
|
||||
}
|
||||
|
||||
$pgtitle = array(gettext("Status: Captive portal"));
|
||||
$shortcut_section = "captiveportal";
|
||||
|
||||
@ -66,6 +60,15 @@ $a_cp =& $config['captiveportal'];
|
||||
if (count($a_cp) == 1)
|
||||
$cpzone = current(array_keys($a_cp));
|
||||
|
||||
if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid']))
|
||||
$cpzoneid = $a_cp[$cpzone]['zoneid'];
|
||||
|
||||
if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid) && isset($_GET['id'])) {
|
||||
captiveportal_disconnect_client($_GET['id']);
|
||||
header("Location: status_captiveportal.php?zone={$cpzone}");
|
||||
exit;
|
||||
}
|
||||
|
||||
include("head.inc");
|
||||
|
||||
?>
|
||||
|
||||
@ -47,10 +47,21 @@ require_once("captiveportal.inc");
|
||||
|
||||
<?php
|
||||
|
||||
if (($_GET['act'] == "del") && (!empty($_GET['zone']))) {
|
||||
$cpzone = $_GET['zone'];
|
||||
if (!is_array($config['captiveportal']))
|
||||
$config['captiveportal'] = array();
|
||||
$a_cp =& $config['captiveportal'];
|
||||
|
||||
$cpzone = $_GET['zone'];
|
||||
if (isset($_POST['zone']))
|
||||
$cpzone = $_POST['zone'];
|
||||
|
||||
if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid']))
|
||||
$cpzoneid = $a_cp[$cpzone]['zoneid'];
|
||||
|
||||
if (($_GET['act'] == "del") && !empty($cpzone) && isset($cpzoneid)) {
|
||||
captiveportal_disconnect_client($_GET['id']);
|
||||
}
|
||||
unset($cpzone);
|
||||
|
||||
flush();
|
||||
|
||||
@ -59,10 +70,6 @@ function clientcmp($a, $b) {
|
||||
return strcmp($a[$order], $b[$order]);
|
||||
}
|
||||
|
||||
if (!is_array($config['captiveportal']))
|
||||
$config['captiveportal'] = array();
|
||||
$a_cp =& $config['captiveportal'];
|
||||
|
||||
$cpdb_all = array();
|
||||
|
||||
foreach ($a_cp as $cpzone => $cp) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user