aboutsummaryrefslogtreecommitdiffstats
path: root/config/pf-blocker/pfblocker.inc
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2012-03-15 10:43:00 +0545
committerPhil Davis <phil.davis@world.inf.org>2012-03-15 10:43:00 +0545
commit0e18c7dc33ae8accef6af364534705679886bde6 (patch)
tree4e2380ef67b26c6940e20b684f597343baab149e /config/pf-blocker/pfblocker.inc
parentd436abb9d5574c72bcc5b52ac2dd68468e4544ec (diff)
downloadpfsense-packages-0e18c7dc33ae8accef6af364534705679886bde6.tar.gz
pfsense-packages-0e18c7dc33ae8accef6af364534705679886bde6.tar.bz2
pfsense-packages-0e18c7dc33ae8accef6af364534705679886bde6.zip
Include foreach loop in "if (is_array($config['aliases']['alias']))" test, otherwise warnings are reported when the array is empty.
Diffstat (limited to 'config/pf-blocker/pfblocker.inc')
-rwxr-xr-xconfig/pf-blocker/pfblocker.inc35
1 files changed, 18 insertions, 17 deletions
diff --git a/config/pf-blocker/pfblocker.inc b/config/pf-blocker/pfblocker.inc
index 57d73b57..3358e07f 100755
--- a/config/pf-blocker/pfblocker.inc
+++ b/config/pf-blocker/pfblocker.inc
@@ -368,28 +368,29 @@ function sync_package_pfblocker() {
}
}
#update pfsense alias table
- if (is_array($config['aliases']['alias']))
+ if (is_array($config['aliases']['alias'])){
$aliases=$config['aliases']['alias'];
- foreach($aliases as $cbalias){
- if (preg_match("/pfBlocker/",$cbalias['name'])){
- #mark pfctl aliastable for cleaning
- if (!in_array($cbalias['name'], $aliases_list))
+ foreach($aliases as $cbalias){
+ if (preg_match("/pfBlocker/",$cbalias['name'])){
+ #mark pfctl aliastable for cleaning
+ if (!in_array($cbalias['name'], $aliases_list))
$aliases_list[]=$cbalias['name']; #mark aliastable for cleaning
- #remove previous aliastable file if alias is not defined any more
- if (!in_array($cbalias['name'], $new_aliases_list))
- unlink_if_exists("/var/db/aliastables/".$cbalias['name'].".txt");
- }
- else{
- $new_aliases[]= $cbalias;
- if (file_exists($pfb_alias_dir.'/'.$alias.'.txt') && $message ==""){
- preg_match("/(\d+)/",exec("/usr/bin/wc -l ".$pfb_alias_dir.'/'.$alias.'.txt'),$matches);
+ #remove previous aliastable file if alias is not defined any more
+ if (!in_array($cbalias['name'], $new_aliases_list))
+ unlink_if_exists("/var/db/aliastables/".$cbalias['name'].".txt");
+ }
+ else{
+ $new_aliases[]= $cbalias;
+ if (file_exists($pfb_alias_dir.'/'.$alias.'.txt') && $message ==""){
+ preg_match("/(\d+)/",exec("/usr/bin/wc -l ".$pfb_alias_dir.'/'.$alias.'.txt'),$matches);
+ }
+ if (($matches[1] * 2.1)>= $table_limit )
+ #alias table too large
+ $message= $alias .' alias table is too large. Reduce networks in list or increase "Firewall Maximum Table Entries" value to at least '. (int)($matches[1] * 2.1) .' in "system - advanced - Firewall/NAT".';
}
- if (($matches[1] * 2.1)>= $table_limit )
- #alias table too large
- $message= $alias .' alias table is too large. Reduce networks in list or increase "Firewall Maximum Table Entries" value to at least '. (int)($matches[1] * 2.1) .' in "system - advanced - Firewall/NAT".';
}
}
- #apply new alias table to xml
+#apply new alias table to xml
if ($message == "")
$config['aliases']['alias']=$new_aliases;
#exit;