summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato.botelho@bluepex.com>2010-04-13 11:05:20 -0300
committerRenato Botelho <renato.botelho@bluepex.com>2010-04-13 11:05:20 -0300
commit532f800b08721ef320260019212839ed9cb24081 (patch)
treea2df79389a29563c3bc675b754a114df5e8a9a14
parent3504e10b0f98fd7f02a68dc3a22d0b150346e241 (diff)
downloadpfsense-532f800b08721ef320260019212839ed9cb24081.zip
pfsense-532f800b08721ef320260019212839ed9cb24081.tar.gz
Check if var exist before compare its value
-rw-r--r--etc/inc/pfsense-utils.inc6
-rwxr-xr-xusr/local/www/firewall_aliases.php20
2 files changed, 13 insertions, 13 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index de702dd..dc50d9e 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -289,11 +289,11 @@ function is_alias_inuse($alias) {
/* loop through nat rules looking for alias in use */
if(is_array($config['nat']['rule']))
foreach($config['nat']['rule'] as $rule) {
- if($rule['target'] == $alias)
+ if($rule['target'] && $rule['target'] == $alias)
return true;
- if($rule['source']['address'] == $alias)
+ if($rule['source']['address'] && $rule['source']['address'] == $alias)
return true;
- if($rule['destination']['address'] == $alias)
+ if($rule['destination']['address'] && $rule['destination']['address'] == $alias)
return true;
}
return false;
diff --git a/usr/local/www/firewall_aliases.php b/usr/local/www/firewall_aliases.php
index 842447e..3c941e6 100755
--- a/usr/local/www/firewall_aliases.php
+++ b/usr/local/www/firewall_aliases.php
@@ -87,22 +87,22 @@ if ($_GET['act'] == "del") {
if($is_alias_referenced == false) {
if(is_array($config['filter']['rule'])) {
foreach($config['filter']['rule'] as $rule) {
- if($rule['source']['address'] == $alias_name) {
+ if($rule['source']['address'] && $rule['source']['address'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['source']['address'] == $alias_name) {
+ if($rule['source']['port'] && $rule['source']['port'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['source']['port'] == $alias_name) {
+ if($rule['destination']['address'] && $rule['destination']['address'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['destination']['port'] == $alias_name) {
+ if($rule['destination']['port'] && $rule['destination']['port'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
@@ -113,32 +113,32 @@ if ($_GET['act'] == "del") {
if($is_alias_referenced == false) {
if(is_array($config['nat']['rule'])) {
foreach($config['nat']['rule'] as $rule) {
- if($rule['source']['address'] == $alias_name) {
+ if($rule['source']['address'] && $rule['source']['address'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['source']['port'] == $alias_name) {
+ if($rule['source']['port'] && $rule['source']['port'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['destination']['address'] == $alias_name) {
+ if($rule['destination']['address'] && $rule['destination']['address'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['destination']['port'] == $alias_name) {
+ if($rule['destination']['port'] && $rule['destination']['port'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['target'] == $alias_name) {
+ if($rule['target'] && $rule['target'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
}
- if($rule['local-port'] == $alias_name) {
+ if($rule['local-port'] && $rule['local-port'] == $alias_name) {
$is_alias_referenced = true;
$referenced_by = $rule['descr'];
break;
OpenPOWER on IntegriCloud