aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--config/mailscanner/mailscanner.inc48
-rw-r--r--config/mailscanner/mailscanner.xml4
-rw-r--r--pkg_config.8.xml2
-rw-r--r--pkg_config.8.xml.amd642
4 files changed, 35 insertions, 21 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>
diff --git a/pkg_config.8.xml b/pkg_config.8.xml
index 79a271ad..a834dd9e 100644
--- a/pkg_config.8.xml
+++ b/pkg_config.8.xml
@@ -429,7 +429,7 @@
<depends_on_package>pyzor-0.5.0_1.tbz</depends_on_package>
<depends_on_package>p5-Mail-SPF-2.007.tbz</depends_on_package>
<depends_on_package>p5-IP-Country-2.27.tbz</depends_on_package>
- <version>4.83.5 pkg v.0.2</version>
+ <version>4.83.5 pkg v.0.2.1</version>
<status>beta</status>
<required_version>2.0</required_version>
<configurationfile>mailscanner.xml</configurationfile>
diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64
index 5c89f089..755a07df 100644
--- a/pkg_config.8.xml.amd64
+++ b/pkg_config.8.xml.amd64
@@ -517,7 +517,7 @@
<depends_on_package>pyzor-0.5.0_1.tbz</depends_on_package>
<depends_on_package>p5-Mail-SPF-2.007.tbz</depends_on_package>
<depends_on_package>p5-IP-Country-2.27.tbz</depends_on_package>
- <version>4.83.5 pkg v.0.2</version>
+ <version>4.83.5 pkg v.0.2.1</version>
<status>beta</status>
<required_version>2.0</required_version>
<configurationfile>mailscanner.xml</configurationfile>