Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 2009 12:59:07 GMT
From:      Denny Lin <dennylin93@cnmc32.hs.ntnu.edu.tw>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/137992: [PATCH] The startup script of mail/spamd has several bugs
Message-ID:  <200908201259.n7KCx7OP075060@www.freebsd.org>
Resent-Message-ID: <200908201300.n7KD09iY019541@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         137992
>Category:       ports
>Synopsis:       [PATCH] The startup script of mail/spamd has several bugs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 20 13:00:09 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Denny Lin
>Release:        FreeBSD 7.2-RELEASE-p3
>Organization:
>Environment:
FreeBSD cnmc32.hs.ntnu.edu.tw 7.2-RELEASE-p3 FreeBSD 7.2-RELEASE-p3 #0: Mon Aug 10 17:02:08 CST 2009     root@cnmc32.hs.ntnu.edu.tw:/usr/obj/usr/src/sys/CNMC32  amd64
>Description:
1. Originally, the -b flag required a space before it in case of a misread such as 'IP-based'. This can be worked around by using "(^\-b| \-b)", so now the script functions normally even when no space it added.

2. When spamd is started in blacklist mode, the -b flag for  is appended by obspamd_flags. However, spamd-setup in the startup script doesn't use this setting. As a result, the blacklists fail to load in blacklist mode. By adding if and else conditions, this can be fixed as well.
>How-To-Repeat:
Simply use blacklist mode with a normal installation of mail/spamd.
>Fix:
See patch.

Patch attached with submission follows:

--- ports/mail/spamd/files/obspamd.in.orig	2009-08-20 20:44:15.000000000 +0800
+++ ports/mail/spamd/files/obspamd.in	2009-08-20 20:52:18.000000000 +0800
@@ -35,10 +35,7 @@
 obspamd_precmd()
 {
 	_rc=0
-    # we need the white-space in the grep expr. to limit a failure
-    # in parsing the flags, for example if someone
-    # defined the word 'IP-based' in the banner.
-	echo "${obspamd_flags}" | grep " \-b" 2>&1 > /dev/null
+	echo "${obspamd_flags}" | egrep "(^\-b| \-b)" 2>&1 > /dev/null
 	if [ $? -eq 1 ]; then
 		/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
 		_rc=${?}
@@ -58,7 +55,12 @@
 {
 	if [ -x %%PREFIX%%/sbin/spamd-setup ]; then
 		if [ -r %%PREFIX%%/etc/spamd/spamd.conf ]; then
-			%%PREFIX%%/sbin/spamd-setup -D
+			echo "${obspamd_flags}" | egrep "(^\-b| \-b)" 2>&1 > /dev/null
+			if [ $? ]; then
+				%%PREFIX%%/sbin/spamd-setup -bD
+			else
+				%%PREFIX%%/sbin/spamd-setup -D
+			fi
 		fi
 	fi
 }


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908201259.n7KCx7OP075060>