Bug 57379 - [FIX] security/clamav 0.60
Summary: [FIX] security/clamav 0.60
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Dirk Meyer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-30 01:30 UTC by Martin Matuska
Modified: 2003-10-25 21:53 UTC (History)
0 users

See Also:


Attachments
file.diff (937 bytes, patch)
2003-09-30 01:30 UTC, Martin Matuska
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Matuska 2003-09-30 01:30:15 UTC
	The clamd socket has to be deleted before starting via rc_subr.
Comment 1 Oliver Eikemeier 2003-09-30 04:36:57 UTC
Martin Matuska wrote:

> The clamd socket has to be deleted before starting via rc_subr.

Why?
Comment 2 Martin Matuska 2003-09-30 09:59:02 UTC
Try the following:

Start clamd via rc_subr startup script. Kill the process with -9 signal (may
happen), the socket file is not deleted. Now try to start it again.
The process is NOT started because of existing socket file.
Comment 3 Oliver Eikemeier 2003-09-30 19:11:20 UTC
martin@tradex.sk wrote:

>  Try the following:
>  
>  Start clamd via rc_subr startup script. Kill the process with -9 signal (may
>  happen), the socket file is not deleted. Now try to start it again.
>  The process is NOT started because of existing socket file.

But then you already had a problem (clamd was terminated by sigkill),
and you should have a hint to investigate. I would prefer:

start_precmd=start_precmd

start_precmd()
{
	if [ -S "%%CLAMD_SOCKET%%" ]; then
		warn "Stale socket %%CLAMD_SOCKET%% removed."
		rm "%%CLAMD_SOCKET%%
	fi
}

or, even better:

start_precmd=start_precmd

start_precmd()
{
	if [ -S "%%CLAMD_SOCKET%%" ]; then
		warn "Stale socket %%CLAMD_SOCKET%%, clamd may already be running."
		return 1
	fi
}
Comment 4 Martin Matuska 2003-09-30 22:40:06 UTC
I agree to you proposal, the first version, here is a updated patch.
But the best way would be existing pidfile and socket flags to clamd (there are
no such flags).

--- Makefile.orig       Tue Sep 30 00:45:14 2003
+++ Makefile    Tue Sep 30 02:02:48 2003
@@ -7,7 +7,7 @@

 PORTNAME=      clamav
 PORTVERSION=   0.60
-PORTREVISION=  3
+PORTREVISION=  4
 CATEGORIES=    security
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=    clamav
@@ -40,8 +40,11 @@
 MAN5=          clamav.conf.5
 MAN8=          clamd.8

+CLAMD_SOCKET?= /var/run/clamav/clamd
+
 SED_SCRIPT=    -e 's|%%PREFIX%%|${PREFIX}|g' \
-               -e 's|%%DATADIR%%|${DATADIR}|g'
+               -e 's|%%DATADIR%%|${DATADIR}|g' \
+               -e 's|%%CLAMD_SOCKET%%|${CLAMD_SOCKET}|g'

 SED_CONF=      -E -e 's|^\#?(Example)$$|\#\1|' \
                -e 's|^\#?(LogFile) .*$$|\1 /var/log/clamav/clamd.log|' \
--- files/clamd.sh.orig Tue Sep 30 23:33:16 2003
+++ files/clamd.sh      Tue Sep 30 23:33:05 2003
@@ -26,6 +26,16 @@
 required_dirs=%%DATADIR%%
 required_files=%%PREFIX%%/etc/clamav.conf

+start_precmd=start_precmd
+
+start_precmd()
+{
+       if [ -S "$clamd_socket" ]; then
+       warn "Stale socket $clamd_socket removed."
+       rm "$clamd_socket"
+       fi
+}
+
 stop_postcmd=stop_postcmd

 stop_postcmd()
@@ -37,6 +47,7 @@

 clamd_enable=${clamd_enable:-"NO"}
 clamd_flags=${clamd_flags:-""}
+clamd_socket=${clamd_socket:-"%%CLAMD_SOCKET%%"}

 load_rc_config $name
 run_rc_command "$1"
Comment 5 Dirk Meyer freebsd_committer freebsd_triage 2003-10-01 05:31:36 UTC
Responsible Changed
From-To: freebsd-ports-bugs->dinoex

I will take care of it.
Comment 6 Dirk Meyer freebsd_committer freebsd_triage 2003-10-01 05:33:56 UTC
State Changed
From-To: open->feedback

waiting for approval of mainatiner
Comment 7 Dirk Meyer freebsd_committer freebsd_triage 2003-10-25 21:53:02 UTC
State Changed
From-To: feedback->closed

committed after maintainter-timeout, thanks.