From b2774343a3e9d0a3533c7b71f42b6595252ed209 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 7 Feb 2005 05:00:50 +0000 Subject: If an error occurs during the rule loading, report the error to the user. --- etc/inc/filter.inc | 4 ++-- usr/local/www/firewall_aliases.php | 5 ++++- usr/local/www/firewall_nat.php | 2 +- usr/local/www/firewall_rules.php | 4 ++-- usr/local/www/firewall_shaper.php | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ed38208..83750a7 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -148,9 +148,9 @@ function filter_configure() { if($rules_loading <> 0) { $rules_error = exec_command("/sbin/pfctl -f /tmp/rules.debug"); return "There was an error loading the rules.

" . $rules_error . "
"; + } else { + return 0; } - - return 0; } function exec_command($command) { diff --git a/usr/local/www/firewall_aliases.php b/usr/local/www/firewall_aliases.php index 770a7df..eaf0639 100755 --- a/usr/local/www/firewall_aliases.php +++ b/usr/local/www/firewall_aliases.php @@ -51,7 +51,10 @@ if ($_POST) { $retval = filter_configure(); config_unlock(); } - $savemsg = get_std_save_message($retval); + if(stristr($retval, "error") <> true) + $savemsg = get_std_save_message($retval); + else + $savemsg = $retval; if ($retval == 0) { if (file_exists($d_aliasesdirty_path)) unlink($d_aliasesdirty_path); diff --git a/usr/local/www/firewall_nat.php b/usr/local/www/firewall_nat.php index ee1c83a..11e6058 100755 --- a/usr/local/www/firewall_nat.php +++ b/usr/local/www/firewall_nat.php @@ -50,7 +50,7 @@ if ($_POST) { $retval |= filter_configure(); config_unlock(); } - if($retval == 0) + if(stristr($retval, "error") <> true) $savemsg = get_std_save_message($retval); else $savemsg = $retval; diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php index 0634a66..ca1edc2 100755 --- a/usr/local/www/firewall_rules.php +++ b/usr/local/www/firewall_rules.php @@ -60,13 +60,13 @@ if ($_POST) { $pconfig = $_POST; if ($_POST['apply']) { - $retval = 0; + $retval = "Reboot is currently required."; if (!file_exists($d_sysrebootreqd_path)) { config_lock(); $retval = filter_configure(); config_unlock(); } - if($retval == 0) + if(stristr($retval, "error") <> true) $savemsg = get_std_save_message($retval); else $savemsg = $retval; diff --git a/usr/local/www/firewall_shaper.php b/usr/local/www/firewall_shaper.php index 267772f..8eb10e8 100755 --- a/usr/local/www/firewall_shaper.php +++ b/usr/local/www/firewall_shaper.php @@ -62,7 +62,7 @@ if ($_POST) { config_lock(); $retval = filter_configure(); config_unlock(); - if($retval == 0) + if(stristr($retval, "error") <> true) $savemsg = get_std_save_message($retval); else $savemsg = $retval; -- cgit v1.1