Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Apr 1996 08:48:59 -0700
From:      Eric Allman <eric@sendmail.org>
To:        joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
Cc:        freebsd-current@freebsd.org (FreeBSD-current users)
Subject:   Re: The Biff service 
Message-ID:  <199604161549.IAA26112@knecht.Oxford.Reference.COM>
In-Reply-To: Mail from J Wunsch <j@uriah.heep.sax.de>  dated Mon, 08 Apr 1996 11:56:44 %2B0200 <199604080956.LAA04555@uriah.heep.sax.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
Sorry for not answering earlier -- I've been on jury duty, and
between that and my job haven't had much free time.

The intent of mail.local is that it be as simple as possible.  I'm
reluctant to start adding options.  This one doesn't seem terribly
dangerous on the surface, but it's a dangerous precedent.

An alternative would be to add a "discard" entry to inetd.conf for
this service.  This would require no code changes and would have
the same effect.

eric


============= In Reply To: ===========================================
: From:  J Wunsch <j@uriah.heep.sax.de>
: Subject:  The Biff service
: Date:  Mon, 8 Apr 1996 11:56:44 +0200 (MET DST)

: Would people kill me for introducing a `-b' option to mail.local(8) to
: stop it from attempting to use the ``biff'' service?
: 
: (To Eric: recent FreeBSD kernels can log failed connection attempts to
: TCP or UDP ports.  So the `biff' attempts clutter the logs.  However,
: /etc/services is normally being used as a ``list of known services''
: as opposed to a ``list of installed services'', so checking with
: getservbyname() alone isn't really an option.)
: 
: Index: sendmail/mail.local/mail.local.8
: ===================================================================
: RCS file: /home/ncvs/src/usr.sbin/sendmail/mail.local/mail.local.8,v
: retrieving revision 1.1.1.1
: diff -u -u -r1.1.1.1 mail.local.8
: --- mail.local.8	1995/12/02 17:30:22	1.1.1.1
: +++ mail.local.8	1996/04/08 09:47:16
: @@ -40,6 +40,7 @@
:  .Sh SYNOPSIS
:  .Nm mail.local
:  .Op Fl f Ar from
: +.Op Fl b
:  .Ar user ...
:  .Sh DESCRIPTION
:  .Nm Mail.local
: @@ -55,6 +56,10 @@
:  .Bl -tag -width xxxfrom
:  .It Fl f Ar from
:  Specify the sender's name.
: +.It Fl b
: +Turn off the attempts to notify the
: +.Dq biff
: +service.
:  .El
:  .Pp
:  Individual mail messages in the mailbox are delimited by an empty
: Index: sendmail/mail.local/mail.local.c
: ===================================================================
: RCS file: /home/ncvs/src/usr.sbin/sendmail/mail.local/mail.local.c,v
: retrieving revision 1.1.1.1
: diff -u -u -r1.1.1.1 mail.local.c
: --- mail.local.c	1995/12/02 17:30:22	1.1.1.1
: +++ mail.local.c	1996/04/08 09:55:44
: @@ -127,7 +127,7 @@
:  
:  int eval = EX_OK;			/* sysexits.h error value. */
:  
: -void		deliver __P((int, char *));
: +void		deliver __P((int, char *, int));
:  void		e_to_sys __P((int));
:  __dead void	err __P((const char *, ...));
:  void		notifybiff __P((char *));
: @@ -142,7 +142,7 @@
:  	char *argv[];
:  {
:  	struct passwd *pw;
: -	int ch, fd;
: +	int ch, fd, nobiff;
:  	uid_t uid;
:  	char *from;
:  	extern char *optarg;
: @@ -162,8 +162,12 @@
:  #endif
:  
:  	from = NULL;
: -	while ((ch = getopt(argc, argv, "df:r:")) != EOF)
: +	nobiff = 0;
: +	while ((ch = getopt(argc, argv, "bdf:r:")) != EOF)
:  		switch(ch) {
: +		case 'b':
: +			nobiff++;
: +			break;
:  		case 'd':		/* Backward compatible. */
:  			break;
:  		case 'f':
: @@ -204,7 +208,7 @@
:  	 * at the expense of repeated failures and multiple deliveries.
:  	 */
:  	for (fd = store(from); *argv; ++argv)
: -		deliver(fd, *argv);
: +		deliver(fd, *argv, nobiff);
:  	exit(eval);
:  }
:  
: @@ -259,8 +263,8 @@
:  }
:  
:  void
: -deliver(fd, name)
: -	int fd;
: +deliver(fd, name, nobiff)
: +	int fd, nobiff;
:  	char *name;
:  {
:  	struct stat fsb, sb;
: @@ -368,11 +372,14 @@
:  		goto err1;
:  	}
:  
: -	/* Get the starting offset of the new message for biff. */
: -	curoff = lseek(mbfd, (off_t)0, SEEK_END);
: -	(void)snprintf(biffmsg, sizeof(biffmsg),
: -		sizeof curoff > sizeof(long) ? "%s@%qd\n" : "%s@%ld\n", 
: -		name, curoff);
: +	if (!nobiff) {
: +		/* Get the starting offset of the new message for biff. */
: +		curoff = lseek(mbfd, (off_t)0, SEEK_END);
: +		(void)snprintf(biffmsg, sizeof(biffmsg),
: +			       sizeof curoff > sizeof(long) ?
: +			       "%s@%qd\n" : "%s@%ld\n", 
: +			       name, curoff);
: +	}
:  
:  	/* Copy the message into the file. */
:  	if (lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) {
: @@ -436,7 +443,8 @@
:  	printf("reset euid = %d\n", geteuid());
:  #endif
:  	unlockmbox();
: -	notifybiff(biffmsg);
: +	if (!nobiff)
: +		notifybiff(biffmsg);
:  }
:  
:  /*
: @@ -525,7 +533,7 @@
:  usage()
:  {
:  	eval = EX_USAGE;
: -	err("usage: mail.local [-f from] user ...");
: +	err("usage: mail.local [-b] [-f from] user ...");
:  }
:  
:  #if __STDC__
: 
: -- 
: cheers, J"org
: 
: joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
: Never trust an operating system you don't have sources for. ;-)





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