aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim P <jim@pingle.org>2012-03-15 06:18:15 -0700
committerJim P <jim@pingle.org>2012-03-15 06:18:15 -0700
commit688e1d6ecaed28288ce098baf34fa4fa116537c8 (patch)
tree4e1f27044e72078cdf0d9301bd2d6708f27de1eb
parentfbc0feb02e505c7435d6d06957e978d00a2fe7b3 (diff)
parenta9bf63038c3edf50c167294858f6676af0ed7c6a (diff)
downloadpfsense-packages-688e1d6ecaed28288ce098baf34fa4fa116537c8.tar.gz
pfsense-packages-688e1d6ecaed28288ce098baf34fa4fa116537c8.tar.bz2
pfsense-packages-688e1d6ecaed28288ce098baf34fa4fa116537c8.zip
Merge pull request #225 from phil-davis/master
Bug 2280 and 2283 Fixup date() and mktime() PHP messages, Fixup case when aliases table is empty
-rwxr-xr-xconfig/pf-blocker/pfblocker.inc35
-rw-r--r--config/pf-blocker/pfblocker.php1
2 files changed, 19 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;
diff --git a/config/pf-blocker/pfblocker.php b/config/pf-blocker/pfblocker.php
index cf0df89f..af489b81 100644
--- a/config/pf-blocker/pfblocker.php
+++ b/config/pf-blocker/pfblocker.php
@@ -23,6 +23,7 @@ if ($argv[1]=='cron'){
require_once("/etc/inc/pkg-utils.inc");
require_once("/etc/inc/globals.inc");
require_once("/etc/inc/filter.inc");
+ require_once("/etc/inc/config.inc");
$hour=date('H');
$pfbdir='/usr/local/pkg/pfblocker';
$updates=0;