aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authormarcelloc <marcellocoutinho@gmail.com>2012-01-05 00:35:04 -0200
committermarcelloc <marcellocoutinho@gmail.com>2012-01-05 00:35:04 -0200
commit37c0d0e1753831982e740fd1ac3573f4f80a8a14 (patch)
tree8e775f46c54616905d53e98b709b9ab3ee517b3b /config
parent92fcd206fd5e5167b19468ddd75a170f3131a20d (diff)
downloadpfsense-packages-37c0d0e1753831982e740fd1ac3573f4f80a8a14.tar.gz
pfsense-packages-37c0d0e1753831982e740fd1ac3573f4f80a8a14.tar.bz2
pfsense-packages-37c0d0e1753831982e740fd1ac3573f4f80a8a14.zip
mailscanner - fix bugs in startup scripts and service status
Diffstat (limited to 'config')
-rw-r--r--config/mailscanner/mailscanner.inc48
-rw-r--r--config/mailscanner/mailscanner.xml4
2 files changed, 33 insertions, 19 deletions
diff --git a/config/mailscanner/mailscanner.inc b/config/mailscanner/mailscanner.inc
index 82ce84e7..1a4f284d 100644
--- a/config/mailscanner/mailscanner.inc
+++ b/config/mailscanner/mailscanner.inc
@@ -938,9 +938,12 @@ EOF;
unlink_if_exists($libexec_dir.'clamav-wrapper');
}
else{
- chown('/var/run/clamav/', 'postfix');
- chown('/var/log/clamav/', 'postfix');
- chown('/var/db/clamav/', 'postfix');
+ if (file_exists('/var/run/clamav/'))
+ chown('/var/run/clamav/', 'postfix');
+ if (file_exists('/var/log/clamav/'))
+ chown('/var/log/clamav/', 'postfix');
+ if (file_exists('/var/db/clamav/'))
+ chown('/var/db/clamav/', 'postfix');
if (file_exists('/var/db/clamav/bytecode.cld'))
chown('/var/db/clamav/bytecode.cld', 'postfix');
if (file_exists('/var/db/clamav/daily.cld'))
@@ -987,14 +990,21 @@ EOF;
}
#clamd script file
$script='/usr/local/etc/rc.d/clamav-clamd';
- $script_file=file_get_contents($script);
- if (preg_match('/NO/',$script_file)){
- $script_file=preg_replace("/NO/","YES",$script_file);
- file_put_contents($script, $script_file, LOCK_EX);
- chmod ($script,0755);
+ $script_file=file($script);
+ foreach ($script_file as $script_line){
+ if(preg_match("/command=/",$script_line)){
+ $new_clamav_startup.= "/bin/mkdir /var/run/clamav\n";
+ $new_clamav_startup.= "chown postfix /var/run/clamav\n";
+ $new_clamav_startup.=$script_line;
+ }
+ elseif(!preg_match("/(mkdir|chown|sleep|mailscanner)/",$script_line)) {
+ $new_clamav_startup.=preg_replace("/NO/","YES",$script_line);
+ }
}
- mwexec_bg("$script fastrestart");
-
+ file_put_contents($script, $new_clamav_startup, LOCK_EX);
+ chmod ($script,0755);
+ mwexec("$script stop");
+ mwexec_bg("$script start");
}
}
else{
@@ -1010,7 +1020,6 @@ EOF;
file_put_contents($script, $script_file, LOCK_EX);
chmod ($script,0755);
}
- mwexec_bg("$script fastrestart");
#check dcc config file
$script='/usr/local/dcc/dcc_conf';
$script_file=file_get_contents($script);
@@ -1018,7 +1027,9 @@ EOF;
$script_file=preg_replace("/DCCIFD_ENABLE=off/","DCCIFD_ENABLE=on",$script_file);
file_put_contents($script, $script_file, LOCK_EX);
}
-
+ mwexec("$script stop");
+ mwexec_bg("$script start");
+
$script='/usr/local/etc/rc.d/mailscanner';
#fix MIME::ToolUtils deprecated function and usecure dependency calls in /usr/local/sbin/mailscanner
@@ -1037,13 +1048,16 @@ EOF;
$script_file=file_get_contents($script);
if (preg_match('/NO/',$script_file)){
- $script_file=preg_replace("/NO/","YES",$script_file);
- file_put_contents($script, $script_file, LOCK_EX);
- }
+ $script_file=preg_replace("/NO/","YES",$script_file);
+ file_put_contents($script, $script_file, LOCK_EX);
+ chmod ($script,0755);
+ }
if($config['installedpackages']['mailscanner']['config'][0]['enable']){
log_error("Reload mailscanner");
chmod ($script,0755);
- mwexec_bg("$script fastrestart");
+ mwexec("$script stop");
+ sleep(2);
+ mwexec_bg("$script start");
}
else{
log_error("Stopping mailscanner if running");
@@ -1196,4 +1210,4 @@ function mailscanner_do_xmlrpc_sync($sync_to_ip, $password,$sync_type) {
}
}
-?> \ No newline at end of file
+?>
diff --git a/config/mailscanner/mailscanner.xml b/config/mailscanner/mailscanner.xml
index d7b7dab4..150ab8c7 100644
--- a/config/mailscanner/mailscanner.xml
+++ b/config/mailscanner/mailscanner.xml
@@ -49,12 +49,12 @@
<name>Mailscanner</name>
<tooltiptext>Configure MailScanner service</tooltiptext>
<section>Services</section>
- <url>/pkg_edit.php?xml=mailscanner.xml&amp;id=0</url>
+ <url>pkg_edit.php?xml=mailscanner.xml&amp;id=0</url>
</menu>
<service>
<name>mailscanner</name>
<rcfile>mailscanner</rcfile>
- <executable>MailScanner</executable>
+ <executable>perl5.12.4</executable>
<description>MailScanner</description>
</service>
<additional_files_needed>