From martin@mail.tradex.sk  Mon Sep 29 17:28:42 2003
Return-Path: <martin@mail.tradex.sk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id C94B016A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Sep 2003 17:28:42 -0700 (PDT)
Received: from mail.tradex.sk (tradex.sk [81.0.229.33])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E0F3943F75
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Sep 2003 17:28:39 -0700 (PDT)
	(envelope-from martin@mail.tradex.sk)
Received: from localhost (tradex.sk [81.0.229.33])
	by mail.tradex.sk (Postfix) with ESMTP id 2475C25FB3
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 30 Sep 2003 02:28:38 +0200 (CEST)
Received: by mail.tradex.sk (Postfix, from userid 1007)
	id 9BE5A25FB5; Tue, 30 Sep 2003 02:28:37 +0200 (CEST)
Message-Id: <20030930002837.9BE5A25FB5@mail.tradex.sk>
Date: Tue, 30 Sep 2003 02:28:37 +0200 (CEST)
From: Martin Matuska <martin@tradex.sk>
Reply-To: Martin Matuska <martin@tradex.sk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [FIX] security/clamav 0.60
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         57379
>Category:       ports
>Synopsis:       [FIX] security/clamav 0.60
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dinoex
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 29 17:30:15 PDT 2003
>Closed-Date:    Sat Oct 25 22:53:28 CEST 2003
>Last-Modified:  Sat Oct 25 22:53:28 CEST 2003
>Originator:     Martin Matuska <martin@tradex.sk>
>Release:        FreeBSD 4.8-RELEASE-p10 i386
>Organization:
>Environment:
FreeBSD 4.8-RELEASE-p10 i386
>Description:
	The clamd socket has to be deleted before starting via rc_subr.

>How-To-Repeat:
>Fix:
--- 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 00:47:27 2003
+++ files/clamd.sh	Tue Sep 30 00:54:25 2003
@@ -22,6 +22,7 @@
 rcvar=`set_rcvar`
 
 command=%%PREFIX%%/sbin/clamd
+start_precmd="rm -f %%CLAMD_SOCKET%%"
 pidfile=/var/run/clamav/clamd.pid
 required_dirs=%%DATADIR%%
 required_files=%%PREFIX%%/etc/clamav.conf
>Release-Note:
>Audit-Trail:

From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: Martin Matuska <martin@tradex.sk>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: ports/57379: [FIX] security/clamav 0.60
Date: Tue, 30 Sep 2003 05:36:57 +0200

 Martin Matuska wrote:
 
 > The clamd socket has to be deleted before starting via rc_subr.
 
 Why?
 

From: martin@tradex.sk
To: freebsd-gnats-submit@FreeBSD.org, martin@tradex.sk
Cc:  
Subject: Re: ports/57379: [FIX] security/clamav 0.60
Date: Tue, 30 Sep 2003 10:59:02 +0200

 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.

From: Oliver Eikemeier <eikemeier@fillmore-labs.com>
To: freebsd-gnats-submit@FreeBSD.org, martin@tradex.sk
Cc:  
Subject: Re: ports/57379: [FIX] security/clamav 0.60
Date: Tue, 30 Sep 2003 20:11:20 +0200

 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
 }
 
 

From: martin@tradex.sk
To: freebsd-gnats-submit@FreeBSD.org
Cc: martin@tradex.sk
Subject: Re: ports/57379: [FIX] security/clamav 0.60
Date: Tue, 30 Sep 2003 23:40:06 +0200

 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"
Responsible-Changed-From-To: freebsd-ports-bugs->dinoex 
Responsible-Changed-By: dinoex 
Responsible-Changed-When: Wed Oct 1 06:31:36 CEST 2003 
Responsible-Changed-Why:  
I will take care of it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57379 
State-Changed-From-To: open->feedback 
State-Changed-By: dinoex 
State-Changed-When: Wed Oct 1 06:33:56 CEST 2003 
State-Changed-Why:  
waiting for approval of mainatiner 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57379 
State-Changed-From-To: feedback->closed 
State-Changed-By: dinoex 
State-Changed-When: Sat Oct 25 22:53:02 CEST 2003 
State-Changed-Why:  
committed after maintainter-timeout, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57379 
>Unformatted:
