aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcelloc <marcellocoutinho@gmail.com>2013-02-12 20:16:08 -0200
committermarcelloc <marcellocoutinho@gmail.com>2013-02-12 20:16:08 -0200
commit82a9e4c7eb601bc2c105691d63c6865a1789e394 (patch)
treefb9ec072f92869aae91ce6ffb32d8f3bde41dd5c
parent8c6e405c7432044a4d0788c8c38baccb76b34bf7 (diff)
downloadpfsense-packages-82a9e4c7eb601bc2c105691d63c6865a1789e394.tar.gz
pfsense-packages-82a9e4c7eb601bc2c105691d63c6865a1789e394.tar.bz2
pfsense-packages-82a9e4c7eb601bc2c105691d63c6865a1789e394.zip
dansguardian - improve group acl check to avoid startup errors
-rwxr-xr-xconfig/dansguardian/dansguardian.inc22
-rw-r--r--config/dansguardian/dansguardian.xml6
-rw-r--r--config/dansguardian/dansguardian_ips_header.xml.template (renamed from config/dansguardian/dansguardian_ips_header.xml)0
-rw-r--r--config/dansguardian/dansguardian_users_footer.xml.template (renamed from config/dansguardian/dansguardian_users_footer.xml)0
-rw-r--r--config/dansguardian/dansguardian_users_header.xml.template (renamed from config/dansguardian/dansguardian_users_header.xml)0
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
7 files changed, 22 insertions, 10 deletions
diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc
index 3077eddb..e3a9e87c 100755
--- a/config/dansguardian/dansguardian.inc
+++ b/config/dansguardian/dansguardian.inc
@@ -737,7 +737,7 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
$dansguardian_groups['embeddedurlweight']=($dansguardian_groups['embeddedurlweight']?$dansguardian_groups['embeddedurlweight']:"0");
$dansguardian_groups['bypass']=($dansguardian_groups['bypass']?$dansguardian_groups['bypass']:"0");
$dansguardian_groups['infectionbypass']=($dansguardian_groups['infectionbypass']?$dansguardian_groups['infectionbypass']:"0");
- $dansguardian_groups['maxuploadsize']=($dansguardian_groups['maxuploadsize']?$dansguardian_groups['maxuploadsize']:$maxuploadsize);
+ $dansguardian_groups['maxuploadsize']=(is_numeric($dansguardian_groups['maxuploadsize'])?$dansguardian_groups['maxuploadsize']:$maxuploadsize);
switch ($dansguardian_groups['reportinglevel']){
case "1":
case "2":
@@ -780,6 +780,11 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
foreach (explode(",",$dansguardian_groups[$list_key]) as $dacl){
if (! is_array(${$list_value}))
${$list_value}=array();
+ // try to avoid errors on empty acl group options
+ if (!preg_match("/\d+/",$dacl)){
+ log_error("dansguardian - Config error, Group {$dansguardian_group_name} {$list_key} cannot be empty! Trying to load default acl values");
+ $dacl=0;
+ }
$file_temp=file_get_contents(DANSGUARDIAN_DIR . "/etc/dansguardian/lists/{$list_value}list.{$dacl}")."\n";
${$list_value}=array_merge(explode("\n",$file_temp),${$list_value});
}
@@ -788,7 +793,7 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
#save group file and unset array
file_put_contents(DANSGUARDIAN_DIR . "/etc/dansguardian/lists/{$list_value}list.g_{$dansguardian_groups['name']}",implode("\n",array_unique(${$list_value}))."\n",LOCK_EX);
unset(${$list_value});
- }
+ }
}
/*
bannedphraselist = '/usr/local/etc/dansguardian/lists/bannedphraselist.{$dansguardian_groups['phraseacl']}'
@@ -902,9 +907,9 @@ EOF;
#Create/update filtergroupsiplist
file_put_contents($dansguardian_dir."/lists/authplugins/ipgroups",$filtergroupsiplist,LOCK_EX);
#Create/update userlist xml file
- $ips_xml_header=file_get_contents("/usr/local/pkg/dansguardian_ips_header.xml");
- $user_xml_header=file_get_contents("/usr/local/pkg/dansguardian_users_header.xml");
- $user_xml_footer=file_get_contents("/usr/local/pkg/dansguardian_users_footer.xml");
+ $ips_xml_header=file_get_contents("/usr/local/pkg/dansguardian_ips_header.xml.template");
+ $user_xml_header=file_get_contents("/usr/local/pkg/dansguardian_users_header.xml.template");
+ $user_xml_footer=file_get_contents("/usr/local/pkg/dansguardian_users_footer.xml.template");
file_put_contents("/usr/local/pkg/dansguardian_users.xml",$user_xml_header.$user_xml.$user_xml_footer,LOCK_EX);
file_put_contents("/usr/local/pkg/dansguardian_ips.xml",$ips_xml_header.$ips_xml.$user_xml_footer,LOCK_EX);
@@ -1221,11 +1226,18 @@ function dansguardian_validate_input($post, &$input_errors) {
$input_errors[] = "{$value} cannot be used as name.";
else if ($key == "name" && preg_match("/\W/",$value))
$input_errors[] = "{$value} cannot be used as name. Use only a-z 0-9 characters";
+ else if ($key== "group_options"){
+ $acls=array("pics","phrase","site","url","extension","header","content","search");
+ foreach ($acls as $gacl)
+ if (!array_key_exists($gacl."acl",$post))
+ $input_errors[] = ucfirst($gacl)." must has at least one acl assigned.";
+ }
else if (empty($value))
continue;
else if($key == "freq" && (!preg_match("/^\d+(h|m|d)$/",$value) || $value == 0))
$input_errors[] = "A valid number with a time reference is required for the field 'Update Frequency'";
}
+
}
function dansguardian_php_install_command() {
diff --git a/config/dansguardian/dansguardian.xml b/config/dansguardian/dansguardian.xml
index 48b7b4a7..26d87825 100644
--- a/config/dansguardian/dansguardian.xml
+++ b/config/dansguardian/dansguardian.xml
@@ -84,17 +84,17 @@
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
- <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_ips_header.xml</item>
+ <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_ips_header.xml.template</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
- <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_header.xml</item>
+ <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_header.xml.template</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
- <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_footer.xml</item>
+ <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_footer.xml.template</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
diff --git a/config/dansguardian/dansguardian_ips_header.xml b/config/dansguardian/dansguardian_ips_header.xml.template
index 48eb3e68..48eb3e68 100644
--- a/config/dansguardian/dansguardian_ips_header.xml
+++ b/config/dansguardian/dansguardian_ips_header.xml.template
diff --git a/config/dansguardian/dansguardian_users_footer.xml b/config/dansguardian/dansguardian_users_footer.xml.template
index 1288b919..1288b919 100644
--- a/config/dansguardian/dansguardian_users_footer.xml
+++ b/config/dansguardian/dansguardian_users_footer.xml.template
diff --git a/config/dansguardian/dansguardian_users_header.xml b/config/dansguardian/dansguardian_users_header.xml.template
index 1cc038d5..1cc038d5 100644
--- a/config/dansguardian/dansguardian_users_header.xml
+++ b/config/dansguardian/dansguardian_users_header.xml.template
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 6bc556d3..e9da653e 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -602,7 +602,7 @@
<depends_on_package>dansguardian-2.12.0.3.tbz</depends_on_package>
<depends_on_package>ca_root_nss-3.14.1.tbz</depends_on_package>
<depends_on_package_pbi>dansguardian-2.12.0.3-i386.pbi</depends_on_package_pbi>
- <version>2.12.0.3 pkg v.0.1.7_1</version>
+ <version>2.12.0.3 pkg v.0.1.7_2</version>
<status>beta</status>
<required_version>2.0</required_version>
<configurationfile>dansguardian.xml</configurationfile>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index cb577350..d9718295 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -589,7 +589,7 @@
<depends_on_package>dansguardian-2.12.0.3.tbz</depends_on_package>
<depends_on_package>ca_root_nss-3.14.1.tbz</depends_on_package>
<depends_on_package_pbi>dansguardian-2.12.0.3-amd64.pbi</depends_on_package_pbi>
- <version>2.12.0.3 pkg v.0.1.7_1</version>
+ <version>2.12.0.3 pkg v.0.1.7_2</version>
<status>beta</status>
<required_version>2.0</required_version>
<configurationfile>dansguardian.xml</configurationfile>