aboutsummaryrefslogtreecommitdiffstats
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
parent8406cb7277dad465e76fb42d2be766c36bfb9bff (diff)
downloadpfsense-packages-39b915dac80c31207385c2a43aa46437871c008e.tar.gz
pfsense-packages-39b915dac80c31207385c2a43aa46437871c008e.tar.bz2
pfsense-packages-39b915dac80c31207385c2a43aa46437871c008e.zip
countryblock-dev - fix missing filter rule creation
-rwxr-xr-xconfig/countryblock-dev/countryblock.inc30
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
3 files changed, 25 insertions, 9 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();
}
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index b4aa88f7..a444614a 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -66,7 +66,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,25732.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/countryblock-dev/countryblock.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/8/All/</depends_on_package_base_url>
- <version>0.4.1</version>
+ <version>0.4.2</version>
<status>Beta</status>
<required_version>2.0</required_version>
<maintainer>tom@tomschaefer.org</maintainer>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index ca11e3c2..e12535ad 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -140,7 +140,7 @@
<pkginfolink>http://forum.pfsense.org/index.php/topic,25732.0.html</pkginfolink>
<config_file>http://pfsense.org/packages/config/countryblock-dev/countryblock.xml</config_file>
<depends_on_package_base_url>http://files.pfsense.org/packages/amd64/8/All/</depends_on_package_base_url>
- <version>0.4.1</version>
+ <version>0.4.2</version>
<status>Beta</status>
<required_version>2.0</required_version>
<maintainer>tom@tomschaefer.org</maintainer>