From nobody@FreeBSD.org  Sat Feb 13 01:36:09 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3B2B7106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 13 Feb 2010 01:36:09 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 2B4588FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 13 Feb 2010 01:36:09 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o1D1a8Bm002373
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 13 Feb 2010 01:36:08 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o1D1a8xZ002372;
	Sat, 13 Feb 2010 01:36:08 GMT
	(envelope-from nobody)
Message-Id: <201002130136.o1D1a8xZ002372@www.freebsd.org>
Date: Sat, 13 Feb 2010 01:36:08 GMT
From: Markus Hitter <mah@jump-ing.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Some rc.d scripts confuse NO with NONE
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         143851
>Category:       conf
>Synopsis:       [patch] Some rc.d scripts confuse NO with NONE
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-rc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 13 01:40:04 UTC 2010
>Closed-Date:    Mon Feb 15 15:49:09 UTC 2010
>Last-Modified:  Mon Feb 15 15:49:09 UTC 2010
>Originator:     Markus Hitter
>Release:        7.1 RELEASE
>Organization:
>Environment:
FreeBSD freebsdfortinybsd.jump-ing.de 7.1-STABLE FreeBSD 7.1-STABLE #0 r187907M: Fri Jan 30 15:56:08 GMT-2 2009     root@freebsdfortinybsd.jump-ing.de:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
While /etc/defaults/rc.conf (line 510) and /etc/rc.conf uses YES and NO to switch sendmail on and off, two scripts in /etc/rc.d check against [Nn][Oo][Nn][Ee] instead. Obviously, this leads to unwanted behaviour.

Please find a patch attached.



P.S.: There's also a "checkyesno" shell function used in similar places which might be preferred. I don't know.
>How-To-Repeat:
Boot with sendmail disabled in /etc/rc.conf: some sendmail stuff gets initialized anyways.
>Fix:


Patch attached with submission follows:

diff -ur rc.d/sendmail rc.d.patched/sendmail
--- rc.d/sendmail	2009-01-30 18:50:44.000000000 +0200
+++ rc.d.patched/sendmail	2010-02-13 01:31:41.000000000 +0200
@@ -24,8 +24,7 @@
 procname=${sendmail_procname:-/usr/sbin/${name}}
 
 case ${sendmail_enable} in
-[Nn][Oo][Nn][Ee])
-	sendmail_enable="NO"
+[Nn][Oo])
 	sendmail_submit_enable="NO"
 	sendmail_outbound_enable="NO"
 	sendmail_msp_queue_enable="NO"
diff -ur rc.d/var rc.d.patched/var
--- rc.d/var	2009-01-30 18:51:06.000000000 +0200
+++ rc.d.patched/var	2010-02-13 01:18:18.000000000 +0200
@@ -41,7 +41,7 @@
 {
 	/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
 	case ${sendmail_enable} in
-	[Nn][Oo][Nn][Ee])
+	[Nn][Oo])
 		;;
 	*)
 		/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Feb 13 05:09:22 UTC 2010 
Responsible-Changed-Why:  

Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143851 

From: Markus Hitter <mah@jump-ing.de>
To: bug-followup@FreeBSD.org, mah@jump-ing.de
Cc:  
Subject: Re: conf/143851: [patch] Some rc.d scripts confuse NO with NONE
Date: Sat, 13 Feb 2010 16:05:13 +0100

 --=-ywTpx/vr0wFCqMjxhEQE
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: 7bit
 
 Glen Barber kindly explained what's going on:
 
 > In rc.conf, sendmail="NO" allows outbound-only mail.
 > sendmail="NONE" tells sendmail not to send mail out at all.
 >
 > sendmail="NO" is useful when sending system mail out is
 > necessary, but the machine is not intended to receive mail.
 
 Apparently, the comment in line 510 in /etc/defaults/rc.conf has room
 for improvement. It should mention all three instead of only two
 options. I've added a new patch and hope this can be applied to FreeBSD
 8 & 9 as well.
 
 --=-ywTpx/vr0wFCqMjxhEQE
 Content-Disposition: attachment; filename="rc.conf.diff"
 Content-Type: text/x-patch; name="rc.conf.diff"; charset="UTF-8"
 Content-Transfer-Encoding: 7bit
 
 --- /etc/defaults/rc.conf	2009-01-30 18:35:32.000000000 +0200
 +++ /etc/defaults/rc.conf.patched	2010-02-13 14:58:05.000000000 +0200
 @@ -507,7 +507,8 @@
  mta_start_script="/etc/rc.sendmail"
  			# Script to start your chosen MTA, called by /etc/rc.
  # Settings for /etc/rc.sendmail and /etc/rc.d/sendmail:
 -sendmail_enable="NO"	# Run the sendmail inbound daemon (YES/NO).
 +sendmail_enable="NO"	# Run the sendmail daemon:
 +			# YES=inbound+outbound, NO=outbound only, NONE=neither.
  sendmail_pidfile="/var/run/sendmail.pid"	# sendmail pid file
  sendmail_procname="/usr/sbin/sendmail"		# sendmail process name
  sendmail_flags="-L sm-mta -bd -q30m" # Flags to sendmail (as a server)
 
 --=-ywTpx/vr0wFCqMjxhEQE--
 

From: Garrett Cooper <gcooper@FreeBSD.org>
To: bug-followup@FreeBSD.org, mah@jump-ing.de
Cc:  
Subject: Re: conf/143851: [patch] Some rc.d scripts confuse NO with NONE
Date: Sat, 13 Feb 2010 10:55:53 -0800

     As noted by brucec, the rc.sendmail(8) manpage already mentions NO
 vs NONE's use:
 
      sendmail_enable
              (str) If set to ``YES'', run the sendmail(8) daemon at system
              boot time.  If set to ``NO'', do not run a sendmail(8) daemon to
              listen for incoming network mail.  This does not preclude a
              sendmail(8) daemon listening on the SMTP port of the loopback
              interface.  The ``NONE'' option is deprecated and should not be
              used.  It will be removed in a future release.
 
 # ...
 
            # MTA
            if (${sendmail_enable} == NONE)
                    # Do nothing
            else if (${sendmail_enable} == YES)
                    start sendmail with ${sendmail_flags}
            else if (${sendmail_submit_enable} == YES)
                    start sendmail with ${sendmail_submit_flags}
            else if (${sendmail_outbound_enable} == YES)
                    start sendmail with ${sendmail_outbound_flags}
            endif
 
            # MSP Queue Runner
            if (${sendmail_enable} != NONE &&
                [ -r /etc/mail/submit.cf] &&
                ${sendmail_msp_queue_enable} == YES)
                    start sendmail with ${sendmail_msp_queue_flags}
            endif
 
     So the option can be removed eventually, but not today...
 Thanks,
 -Garrett

From: Markus Hitter <mah@jump-ing.de>
To: Garrett Cooper <gcooper@FreeBSD.org>
Cc: bug-followup@FreeBSD.org
Subject: Re: conf/143851: [patch] Some rc.d scripts confuse NO with NONE
Date: Sat, 13 Feb 2010 20:19:23 +0100

 Am 13.02.2010 um 19:55 schrieb Garrett Cooper:
 
 >     As noted by brucec, the rc.sendmail(8) manpage already mentions NO
 > vs NONE's use:
 
 Fully agreed rc.conf isn't the right place for exhaustive  
 documentation. The current comment for sendmail_enable isn't correct,  
 though. This variable doesn't offer the choice between YES and NO,  
 but between YES and NO and NONE. Removing this comment entirely would  
 be a solution as well.
 
State-Changed-From-To: open->closed  
State-Changed-By: brucec 
State-Changed-When: Mon Feb 15 15:45:48 UTC 2010 
State-Changed-Why:  
This is documented behaviour: rc.conf(5) has links to  
rc.sendmail(8) which document the sendmail_* variables.  
That page documents the "NONE" setting as disabling sendmail  
altogether, while the "NO" setting just disables listening for  
incoming mail. 

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