summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-03-22 16:22:45 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-03-22 16:22:45 -0300
commite680b2f912e7334c1b4c8d8bd1b6be0ecf61b0bd (patch)
treea6cae6668efd5a521d031a2ef0d20294bbfbbfde /usr/local/www/services_captiveportal.php
parentab1cf45537b0a96c39ddaaa57cd9a6ac742d39af (diff)
downloadpfsense-e680b2f912e7334c1b4c8d8bd1b6be0ecf61b0bd.zip
pfsense-e680b2f912e7334c1b4c8d8bd1b6be0ecf61b0bd.tar.gz
Add checks to make sure CP hard timeout is less or equal DHCP server default lease time. It fixes #2899
Diffstat (limited to 'usr/local/www/services_captiveportal.php')
-rwxr-xr-xusr/local/www/services_captiveportal.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr/local/www/services_captiveportal.php b/usr/local/www/services_captiveportal.php
index 3ce84b5..a387ede 100755
--- a/usr/local/www/services_captiveportal.php
+++ b/usr/local/www/services_captiveportal.php
@@ -180,8 +180,24 @@ if ($_POST) {
}
}
- if ($_POST['timeout'] && (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))) {
- $input_errors[] = gettext("The timeout must be at least 1 minute.");
+ if ($_POST['timeout']) {
+ if (!is_numeric($_POST['timeout']) || ($_POST['timeout'] < 1))
+ $input_errors[] = gettext("The timeout must be at least 1 minute.");
+ else if (isset($config['dhcpd']) && is_array($config['dhcpd'])) {
+ foreach ($config['dhcpd'] as $dhcpd_if => $dhcpd_data) {
+ if (!isset($dhcpd_data['enable']))
+ continue;
+ if (!is_array($_POST['cinterface']) || !in_array($dhcpd_if, $_POST['cinterface']))
+ continue;
+
+ $deftime = 7200; // Default lease time
+ if (isset($dhcpd_data['defaultleasetime']) && is_numeric($dhcpd_data['defaultleasetime']))
+ $deftime = $dhcpd_data['defaultleasetime'];
+
+ if ($_POST['timeout'] > $deftime)
+ $input_errors[] = gettext("Hard timeout must be less or equal Default lease time set on DHCP Server");
+ }
+ }
}
if ($_POST['idletimeout'] && (!is_numeric($_POST['idletimeout']) || ($_POST['idletimeout'] < 1))) {
$input_errors[] = gettext("The idle timeout must be at least 1 minute.");
OpenPOWER on IntegriCloud