summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2011-05-25 18:00:54 -0400
committerScott Ullrich <sullrich@pfsense.org>2011-05-25 18:02:05 -0400
commit474f36d1b277b3e0732496bf0ca8aa1659710809 (patch)
tree0d5b1a7936751d4a7f1979263d6dbf334821f702
parent5c723d9fccffe78e1650c574427100760d0faf5e (diff)
downloadpfsense-474f36d1b277b3e0732496bf0ca8aa1659710809.zip
pfsense-474f36d1b277b3e0732496bf0ca8aa1659710809.tar.gz
* Add is_ipaddr_configured() so that people do not need to reinvent the wheel for this task
* Check to make sure the administrator is not entering the IP address of the same host preventing a issue where the firewall will sync the voucher database to itself and cause the webConfigurator to crash.
-rw-r--r--etc/inc/interfaces.inc2
-rw-r--r--etc/inc/pfsense-utils.inc19
-rw-r--r--usr/local/www/services_captiveportal_vouchers.php2
3 files changed, 21 insertions, 2 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 393833f..63f380a 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -3728,4 +3728,4 @@ function get_vip_descr($ipaddress) {
return "";
}
-?>
+?> \ No newline at end of file
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index ca16634..a673685 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -2207,4 +2207,21 @@ function load_mac_manufacturer_table() {
}
-?>
+/****f* pfsense-utils/is_ipaddr_configured
+ * NAME
+ * is_ipaddr_configured
+ * INPUTS
+ * IP Address to check.
+ * RESULT
+ * returns true if the IP Address is
+ * configured and present on this device.
+*/
+function is_ipaddr_configured($ipaddr) {
+ $interface_list_ips = get_configured_ip_addresses();
+ foreach($interface_list_ips as $ilips) {
+ if(strcasecmp($ipaddr, $ilips) == 0)
+ return true;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php
index e1c54b1..bdef534 100644
--- a/usr/local/www/services_captiveportal_vouchers.php
+++ b/usr/local/www/services_captiveportal_vouchers.php
@@ -206,6 +206,8 @@ if ($_POST) {
$input_errors[] = gettext("This doesn't look like an RSA Public key.");
if ($_POST['privatekey'] && (!strstr($_POST['privatekey'],"BEGIN RSA PRIVATE KEY")))
$input_errors[] = gettext("This doesn't look like an RSA Private key.");
+ if ($_POST['vouchersyncdbip'] && (is_ipaddr_configured($_POST['vouchersyncdbip'])))
+ $input_errors[] = gettext("You cannot sync the voucher database to this host (itself).");
}
if (!$input_errors) {
OpenPOWER on IntegriCloud