From 474f36d1b277b3e0732496bf0ca8aa1659710809 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 25 May 2011 18:00:54 -0400 Subject: * 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. --- etc/inc/pfsense-utils.inc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'etc/inc/pfsense-utils.inc') 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 -- cgit v1.1 From d65962a7736ae9917182007f4ee0862193fc910f Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 25 May 2011 19:42:48 -0400 Subject: Adding a new hook system for firewall nat edit and firewall rules edit page. Basically if the directory exists it will suck in the files to extend these pags. /usr/local/pkg/firewall_nat/input_validation /usr/local/pkg/firewall_nat/pre_write_config /usr/local/pkg/firewall_nat/htmlphpearly /usr/local/pkg/firewall_nat/htmlphplate /usr/local/pkg/firewall_rules/input_validation /usr/local/pkg/firewall_rules/pre_write_config /usr/local/pkg/firewall_rules/htmlphpearly /usr/local/pkg/firewall_rules/htmlphplate --- etc/inc/pfsense-utils.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'etc/inc/pfsense-utils.inc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index a673685..6241a1e 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2224,4 +2224,17 @@ function is_ipaddr_configured($ipaddr) { } } +function pfSense_handle_custom_code($src_dir) { + // Allow extending of the nat edit page and include custom input validation + if(is_dir("$src_dir")) { + $cf = glob($src_dir); + foreach($cf as $nf) { + if($nf == "." || $nf == "..") + continue; + // Include the extra handler + include("$src_dir/$nf"); + } + } +} + ?> \ No newline at end of file -- cgit v1.1 From e4a8ed97395866b353f99f5473e1fd413f5a05a0 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 25 May 2011 19:51:00 -0400 Subject: Add function header --- etc/inc/pfsense-utils.inc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'etc/inc/pfsense-utils.inc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 6241a1e..01d3762 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2224,6 +2224,14 @@ function is_ipaddr_configured($ipaddr) { } } +/****f* pfsense-utils/pfSense_handle_custom_code + * NAME + * pfSense_handle_custom_code + * INPUTS + * directory name to process + * RESULT + * globs the directory and includes the files + */ function pfSense_handle_custom_code($src_dir) { // Allow extending of the nat edit page and include custom input validation if(is_dir("$src_dir")) { -- cgit v1.1 From 3dbceb92140459d4ffff77df33dcc150c4e01d00 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 30 May 2011 12:02:41 -0400 Subject: Include .inc files for plugin system --- etc/inc/pfsense-utils.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'etc/inc/pfsense-utils.inc') diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 01d3762..c75ae20 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -2235,12 +2235,12 @@ function is_ipaddr_configured($ipaddr) { function pfSense_handle_custom_code($src_dir) { // Allow extending of the nat edit page and include custom input validation if(is_dir("$src_dir")) { - $cf = glob($src_dir); + $cf = glob($src_dir . "/*.inc"); foreach($cf as $nf) { if($nf == "." || $nf == "..") continue; // Include the extra handler - include("$src_dir/$nf"); + include("$nf"); } } } -- cgit v1.1