aboutsummaryrefslogtreecommitdiffstats
path: root/config/countryblock-dev
diff options
context:
space:
mode:
authormarcelloc <marcellocoutinho@gmail.com>2011-10-26 13:58:55 -0200
committermarcelloc <marcellocoutinho@gmail.com>2011-10-26 13:58:55 -0200
commit39b915dac80c31207385c2a43aa46437871c008e (patch)
tree96a15c390a468d9a767f110c7dbce620661891c9 /config/countryblock-dev
parent8406cb7277dad465e76fb42d2be766c36bfb9bff (diff)
downloadpfsense-packages-39b915dac80c31207385c2a43aa46437871c008e.tar.gz
pfsense-packages-39b915dac80c31207385c2a43aa46437871c008e.tar.bz2
pfsense-packages-39b915dac80c31207385c2a43aa46437871c008e.zip
countryblock-dev - fix missing filter rule creation
Diffstat (limited to 'config/countryblock-dev')
-rwxr-xr-xconfig/countryblock-dev/countryblock.inc30
1 files changed, 23 insertions, 7 deletions
diff --git a/config/countryblock-dev/countryblock.inc b/config/countryblock-dev/countryblock.inc
index 8aaf6a41..5844f3d1 100755
--- a/config/countryblock-dev/countryblock.inc
+++ b/config/countryblock-dev/countryblock.inc
@@ -33,6 +33,7 @@ require_once("util.inc");
require_once("functions.inc");
require_once("pkg-utils.inc");
require_once("globals.inc");
+require_once("filter.inc");
function cb_text_area_decode($text){
return preg_replace('/\r\n/', "\n",base64_decode($text));
@@ -96,10 +97,17 @@ function sync_package_countryblock() {
"type"=> "urltable",
"detail"=> "DO NOT EDIT THIS ALIAS");
#force alias file update
- if (! is_dir('/var/db/aliastables/'))
- mkdir ('/var/db/aliastables/',0755);
- file_put_contents('/var/db/aliastables/Countryblock.txt',$ips, LOCK_EX);
+ if (! is_dir('/var/db/aliastables/'))
+ mkdir ('/var/db/aliastables/',0755);
+ if (file_exists('/var/db/aliastables/Countryblock.txt'))
+ file_put_contents('/var/db/aliastables/Countryblock.txt',$ips, LOCK_EX);
+ }
+ else{
+ #remove previous aliastable if exist
+ if (file_exists('/var/db/aliastables/Countryblock.txt'))
+ unlink('/var/db/aliastables/Countryblock.txt');
}
+
if (cb_text_area_decode($countryblock_config['whitelist']) != ""){
#create or reaply alias
$new_aliases[]=array("name"=> 'CountryblockWL',
@@ -110,10 +118,17 @@ function sync_package_countryblock() {
"type"=> "urltable",
"detail"=> "DO NOT EDIT THIS ALIAS");
#force alias file update
- if (! is_dir('/var/db/aliastables/'))
- mkdir ('/var/db/aliastables/',0755);
- file_put_contents('/var/db/aliastables/CountryblockWL.txt',cb_text_area_decode($countryblock_config['whitelist']), LOCK_EX);
+ if (! is_dir('/var/db/aliastables/'))
+ mkdir ('/var/db/aliastables/',0755);
+ if (file_exists('/var/db/aliastables/CountryblockWL.txt'))
+ file_put_contents('/var/db/aliastables/CountryblockWL.txt',cb_text_area_decode($countryblock_config['whitelist']), LOCK_EX);
+ }
+ else{
+ #remove previous aliastable if exist
+ if (file_exists('/var/db/aliastables/CountryblockWL.txt'))
+ unlink('/var/db/aliastables/CountryblockWL.txt');
}
+
if (is_array($aliases))
foreach($aliases as $cbalias){
if (! preg_match("/Countryblock.*list/",$cbalias['descr']))
@@ -222,8 +237,9 @@ function sync_package_countryblock() {
}
$config['filter']['rule']=$new_rules;
- #save all changes to xml
+ #save and apply all changes
write_config();
+ filter_configure();
countryblock_sync_on_changes();
}