aboutsummaryrefslogtreecommitdiffstats
path: root/config/dansguardian/dansguardian.inc
diff options
context:
space:
mode:
Diffstat (limited to 'config/dansguardian/dansguardian.inc')
-rwxr-xr-xconfig/dansguardian/dansguardian.inc18
1 files changed, 10 insertions, 8 deletions
diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc
index b1c79a97..39282409 100755
--- a/config/dansguardian/dansguardian.inc
+++ b/config/dansguardian/dansguardian.inc
@@ -90,7 +90,7 @@ function check_ca_hashes(){
}
}
-function sync_package_dansguardian($via_rpc=false,$install_process=false) {
+function sync_package_dansguardian($via_rpc="no",$install_process=false) {
global $config,$g;
# detect boot process
@@ -101,7 +101,7 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
$boot_process="on";
}
- if (is_process_running('dansguardian') && isset($boot_process) && $via_rpc==false){
+ if (is_process_running('dansguardian') && isset($boot_process) && $via_rpc=="no"){
log_error("[Dansguardian] - Detected boot process pr:".is_process_running('dansguardian')." bp:".isset($boot_process)." rpc:".$via_rpc);
return;
}
@@ -723,6 +723,7 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
'urlacl'=> "Default",
'group_options' => "scancleancache,infectionbypasserrorsonly",
'reportinglevel'=>'3',
+ 'group_name_source'=>'name',
'mode'=> "1",
'report_level'=>"global");
@@ -979,7 +980,7 @@ EOF;
$cron_found=0;
if (is_array($config['cron']['item']))
foreach($config['cron']['item'] as $cron)
- if (preg_match("@".DANSGUARDIAN_DIR."/(bin.freshclam|www/dansguardian)@",$cron["command"]))
+ if (preg_match("@(".DANSGUARDIAN_DIR."|/usr/local)/(bin.freshclam|www/dansguardian)@",$cron["command"]))
$cron_found++;
else
$new_cron['item'][]=$cron;
@@ -1062,6 +1063,7 @@ EOF;
$cron_cmd="/usr/local/bin/php /usr/local/www/dansguardian_ldap.php";
if (is_array($config['installedpackages']['dansguardiangroups']['config']))
foreach ($config['installedpackages']['dansguardiangroups']['config'] as $dansguardian_groups){
+ $dans_group_source=($dansguardian_groups['groupnamesource'] !="" ? $dansguardian_groups['groupnamesource'] : "name");
if(preg_match('/(\d+)m/',$dansguardian_groups['freq'],$matches)){
$new_cron['item'][]=array( "minute" => "*/".$matches[1],
"hour" => "*",
@@ -1069,7 +1071,7 @@ EOF;
"month" => "*",
"wday" => "*",
"who" => "root",
- "command"=> $cron_cmd." ".$dansguardian_groups['name']);
+ "command"=> "{$cron_cmd} $dans_group_source '{$dansguardian_groups[$dans_group_source]}'");
$config['cron']=$new_cron;
$cron_found++;
}
@@ -1080,7 +1082,7 @@ EOF;
"month" => "*",
"wday" => "*",
"who" => "root",
- "command"=> $cron_cmd." ".$dansguardian_groups['name']);
+ "command"=> "{$cron_cmd} $dans_group_source '{$dansguardian_groups[$dans_group_source]}'");
$config['cron']=$new_cron;
$cron_found++;
}
@@ -1205,7 +1207,7 @@ EOF;
#avoid sync during boot process
- if (!isset($boot_process)){
+ if (!isset($boot_process) || $via_rpc=="yes"){
/* Uses XMLRPC to synchronize the changes to a remote node */
if (is_array($config['installedpackages']['dansguardiansync']['config'])){
$dans_sync=$config['installedpackages']['dansguardiansync']['config'][0];
@@ -1280,7 +1282,7 @@ function dansguardian_validate_input($post, &$input_errors) {
}
function dansguardian_php_install_command() {
- sync_package_dansguardian(false,true);
+ sync_package_dansguardian("no",true);
}
function dansguardian_php_deinstall_command() {
@@ -1385,7 +1387,7 @@ function dansguardian_do_xmlrpc_sync($sync_to_ip,$username,$password,$sync_type,
/* tell dansguardian to reload our settings on the destionation sync host. */
$method = 'pfsense.exec_php';
$execcmd = "require_once('/usr/local/pkg/dansguardian.inc');\n";
- $execcmd .= "sync_package_dansguardian(true);";
+ $execcmd .= "sync_package_dansguardian('yes');";
/* assemble xmlrpc payload */
$params = array(