From nobody@FreeBSD.org  Wed Feb 27 01:23:07 2002
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id CF5C937B400
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 27 Feb 2002 01:23:03 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id g1R9N3M96119;
	Wed, 27 Feb 2002 01:23:03 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200202270923.g1R9N3M96119@freefall.freebsd.org>
Date: Wed, 27 Feb 2002 01:23:03 -0800 (PST)
From: Michael Wardle <michael@endbracket.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /etc/rc virecover script starts sendmail even if sendmail should be off
X-Send-Pr-Version: www-1.0

>Number:         35371
>Category:       conf
>Synopsis:       /etc/rc virecover script starts sendmail even if sendmail should be off
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 27 01:30:01 PST 2002
>Closed-Date:    Wed Feb 27 15:01:01 PST 2002
>Last-Modified:  Thu Feb 28 03:00:06 PST 2002
>Originator:     Michael Wardle
>Release:        4.5
>Organization:
-
>Environment:
FreeBSD 4.5-RELEASE i386
>Description:
I installed FreeBSD on a low-end machine to make it essentially a terminal, and decided to turn off network services including sendmail.

On boot, sendmail is started by the virecover script in /etc/rc, even if sendmail is configured off.


>How-To-Repeat:
Turn off sendmail in /etc/rc.conf (sendmail_enable="NO"), reboot.

It's probably also necessary to have a crashed vi session.
>Fix:
The way I worked around it was to check the value of ${sendmail_enable}.  It would also be possible to check whether sendmail is running or see if there's a sendmail pid or lock file (but it doesn't seem to put one in /var/run).

I'll attach a patch when I find a form that lets me upload files.
>Release-Note:
>Audit-Trail:

From: Ceri <setantae@submonkey.net>
To: Michael Wardle <michael@endbracket.net>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: conf/35371: /etc/rc virecover script starts sendmail even if sendmail should be off
Date: Wed, 27 Feb 2002 10:17:59 +0000

 On Wed, Feb 27, 2002 at 01:23:03AM -0800, Michael Wardle wrote:
 
 > On boot, sendmail is started by the virecover script in /etc/rc, even if sendmail is configured off.
 
 This is the only reference to sendmail in /etc/rc :
 
           # Delete any recovery files that are zero length,
           # corrupted, or that have no corresponding backup file.
           # Else send mail to the user.
           recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"`
           if [ -n "${recfile}" -a -s "${recfile}" ]; then
                   sendmail -t < "${i}"
           else
                   rm -f "${i}"
           fi
 
 It's sending mail, which is not quite the same as starting sendmail.
 
 Or do you mean something else ?
 
 Ceri
 

From: Ceri <setantae@submonkey.net>
To: freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: conf/35371: /etc/rc virecover script starts sendmail even if sendmail should be off
Date: Wed, 27 Feb 2002 10:40:52 +0000

 On Wed, Feb 27, 2002 at 02:20:02AM -0800, Ceri wrote:
 
 >  This is the only reference to sendmail in /etc/rc :
 
 Whoops, I mean w.r.t. vi.recover, of course..
 
 Ceri
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
 
State-Changed-From-To: open->closed 
State-Changed-By: cjc 
State-Changed-When: Wed Feb 27 15:01:01 PST 2002 
State-Changed-Why:  
As Ceri points out, the code in question is not starting sendmail(8) 
as a daemon. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35371 

From: Michael Wardle <michael@endbracket.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: conf/35371: /etc/rc virecover script starts sendmail even if sendmail should be off
Date: Thu, 28 Feb 2002 02:18:51 -0800 (PST)

 1) shouldn't we test to see if sendmail is installed before calling it?
 2) shouldn't it be possible to disable calling "sendmail" (particularly
    if ${sendmail_enable} is NO)?
 3) is there any reason why we shouldn't call "mail" instead of
    "sendmail"? (admittedly, i don't know too much about these
 utilities,
    but I thought it would be preferred to invoke a MUA rather than an
    MTA if all we wanted to do was send a message)
 4) if we're going to call an MTA rather than an MUA, shouldn't we at
    least test whether it's already running
    (i don't think it's correct to invoke what seems to be a system
     utility (usually invoked as a daemon) from a shell script in this
     way -- i could be wrong) 
 5) shouldn't we call whatever MTA the user has configured (e.g.
    sendmail, postfix, exim, qmail)?
 
 I'd really like to be able to disable the behavior I mentioned in the 
 original report.
 
 
 __________________________________________________
 Do You Yahoo!?
 Yahoo! Greetings - Send FREE e-cards for every occasion!
 http://greetings.yahoo.com

From: Peter Pentchev <roam@ringlet.net>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/35371: /etc/rc virecover script starts sendmail even if sendmail should be off
Date: Thu, 28 Feb 2002 12:59:26 +0200

 Oof; let GNATS know about this, too..
 
 ----- Forwarded message from Peter Pentchev <roam@ringlet.net> -----
 
 Date: Thu, 28 Feb 2002 12:56:31 +0200
 From: Peter Pentchev <roam@ringlet.net>
 To: Michael Wardle <michael@endbracket.net>
 Cc: freebsd-bugs@FreeBSD.org
 Subject: Re: conf/35371: /etc/rc virecover script starts sendmail even if sendmail should be off
 Mail-Followup-To: Michael Wardle <michael@endbracket.net>,
 	freebsd-bugs@FreeBSD.org
 User-Agent: Mutt/1.2.5i
 In-Reply-To: <200202281020.g1SAK2R65822@freefall.freebsd.org>; from michael@endbracket.net on Thu, Feb 28, 2002 at 02:20:02AM -0800
 
 On Thu, Feb 28, 2002 at 02:20:02AM -0800, Michael Wardle wrote:
 > The following reply was made to PR conf/35371; it has been noted by GNATS.
 > 
 > From: Michael Wardle <michael@endbracket.net>
 > To: freebsd-gnats-submit@FreeBSD.org
 > Cc:  
 > Subject: Re: conf/35371: /etc/rc virecover script starts sendmail even if sendmail should be off
 > Date: Thu, 28 Feb 2002 02:18:51 -0800 (PST)
 > 
 >  1) shouldn't we test to see if sendmail is installed before calling it?
 
 /usr/sbin/sendmail is simply a symlink to mailwrapper(8); see below.
 
 >  2) shouldn't it be possible to disable calling "sendmail" (particularly
 >     if ${sendmail_enable} is NO)?
 
 Yes, edit your mailer.conf to run e.g. /bin/true when /usr/sbin/sendmail
 is invoked :)
 
 >  3) is there any reason why we shouldn't call "mail" instead of
 >     "sendmail"? (admittedly, i don't know too much about these
 >  utilities,
 >     but I thought it would be preferred to invoke a MUA rather than an
 >     MTA if all we wanted to do was send a message)
 
 With the arguments it is invoked, sendmail would actually function
 as a MUA; any sendmail wrappers installed by ports (e.g. qmail's
 /var/qmail/bin/sendmail) would recognize that and act appropriately.
 
 >  4) if we're going to call an MTA rather than an MUA, shouldn't we at
 >     least test whether it's already running
 >     (i don't think it's correct to invoke what seems to be a system
 >      utility (usually invoked as a daemon) from a shell script in this
 >      way -- i could be wrong) 
 
 We are not running it as an MTA; we are only calling it as a MUA,
 all it is supposed to do is (somehow) queue a message for delivery
 by the actual system MTA.
 
 >  5) shouldn't we call whatever MTA the user has configured (e.g.
 >     sendmail, postfix, exim, qmail)?
 
 Invoking /usr/sbin/sendmail actually invokes mailwrapper(8) under
 the name of 'sendmail'; that is, it is exactly what you want -
 invoking whatever MTA the user has chosen to install.
 
 I suspect that a large part of the confusion here is caused by
 the fact that sendmail may function as an MTA, MUA or even simply
 an MSA, depending on its command-line arguments.
 
 G'luck,
 Peter
 
 -- 
 Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
 PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
 Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
 I am not the subject of this sentence.
 
 ----- End forwarded message -----
>Unformatted:
