Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Apr 1996 11:56:44 +0200 (MET DST)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-current@FreeBSD.org (FreeBSD-current users), eric@cs.berkeley.edu
Subject:   The Biff service
Message-ID:  <199604080956.LAA04555@uriah.heep.sax.de>

next in thread | raw e-mail | index | archive | help
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?199604080956.LAA04555>