Bug 111545

Summary: security/clamav: clamav-milter rc script requires clamd but clamav-milter does not
Product: Ports & Packages Reporter: Craig Leres <leres>
Component: Individual Port(s)Assignee: Renato Botelho <garga>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Craig Leres freebsd_committer 2007-04-13 21:20:01 UTC
	The clamav-milter rc script was changed in to wait for the
	clamd socket in rev 1.2. In 1.3 (today's version) it was
	changed to also require the clamd socket to exist and will
	not start clamav-milter unless it does.

	This is a mistake since clamav-milter can be configured to
	use clamd or to access the virus db directly.

Fix: 

The clamd socket test should be conditional on clamd_enable="YES"
How-To-Repeat: 	When /etc/rc.conf contains:

	    clamav_clamd_enable="NO"
	    clamav_milter_enable="YES"

	attempting to start clamav-milter fails after waiting 60
	seconds for the clamd socket to appear.
Comment 1 Edwin Groothuis freebsd_committer 2007-04-13 21:20:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->garga

Over to maintainer
Comment 2 Renato Botelho freebsd_committer 2007-05-25 14:09:23 UTC
Could you test following patch and confirm if it works ok?

Thanks

-------------------------------------------------------------------------
Index: files/clamav-milter.in
===================================================================
RCS file: /home/pcvs/ports/security/clamav/files/clamav-milter.in,v
retrieving revision 1.3
diff -u -r1.3 clamav-milter.in
--- files/clamav-milter.in	13 Apr 2007 17:49:09 -0000	1.3
+++ files/clamav-milter.in	25 May 2007 12:56:06 -0000
@@ -36,21 +36,23 @@
 	fi
 	rc_flags="--pidfile ${pidfile} ${flags:-$clamav_milter_flags} $clamav_milter_socket"
 	
-	echo -n "Waiting for clamd socket.. "
-	i=${clamav_milter_socktimeout}
-	while [ $i -ne 0 ]
-	do
-		[ -S "$clamav_clamd_socket" ] && break
-		if [ `expr $i % 10` -eq 0 ]; then
-			echo -n "${i}.. "
+	if checkyesno clamav_clamd_enable; then
+		echo -n "Waiting for clamd socket.. "
+		i=${clamav_milter_socktimeout}
+		while [ $i -ne 0 ]
+		do
+			[ -S "$clamav_clamd_socket" ] && break
+			if [ `expr $i % 10` -eq 0 ]; then
+				echo -n "${i}.. "
+			fi
+			sleep 1
+			i=$(($i-1))
+		done
+		echo
+		if [ $i -eq 0 ]; then
+			echo "There is no clamd socket (${clamav_clamd_socket})!"
+			exit 1
 		fi
-		sleep 1
-		i=$(($i-1))
-	done
-	echo
-	if [ $i -eq 0 ]; then
-		echo "There is no clamd socket (${clamav_clamd_socket})!"
-		exit 1
 	fi
 }
 
@@ -58,8 +60,10 @@
 load_rc_config $name
 : ${clamav_milter_enable="NO"}
 : ${clamav_milter_socket="%%CLAMAV_MILTER_SOCKET%%"}
-: ${clamav_clamd_socket="%%CLAMAV_CLAMD_SOCKET%%"}
 : ${clamav_milter_flags="--postmaster-only --local --outgoing --timeout=0 --max-children=50"}
 : ${clamav_milter_socktimeout="60"}
 
+: ${clamav_clamd_socket="%%CLAMAV_CLAMD_SOCKET%%"}
+: ${clamav_clamd_enable="NO"}
+
 run_rc_command "$1"
-------------------------------------------------------------------------
-- 
Renato Botelho <garga @ FreeBSD.org>
               <freebsd @ galle.com.br>
GnuPG Key: http://www.FreeBSD.org/~garga/pubkey.asc

	   THE DAILY PLANET

	SUPERMAN SAVES DESSERT!
	Plans to "Eat it later"
Comment 3 Renato Botelho freebsd_committer 2007-05-25 14:10:04 UTC
State Changed
From-To: open->feedback

Wait test and confirmation from submitter
Comment 4 dfilter service freebsd_committer 2007-06-05 15:22:55 UTC
garga       2007-06-05 14:22:46 UTC

  FreeBSD ports repository

  Modified files:
    security/clamav/files clamav-milter.in 
  Log:
  - Change clamav-milter rc.d script, now it just wait for clamd socket if
    clamav_clamd_enable is set.
  
  PR:             ports/111545
  Submitted by:   Craig Leres <leres@ee.lbl.gov>
  
  Revision  Changes    Path
  1.4       +20 -16    ports/security/clamav/files/clamav-milter.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 5 Renato Botelho freebsd_committer 2007-06-05 15:22:57 UTC
State Changed
From-To: feedback->closed

Committed, with minor changes. Thanks!