summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1996-10-29 05:22:52 +0000
committerPeter Wemm <peter@FreeBSD.org>1996-10-29 05:22:52 +0000
commitb0591e84e91e6fc8900d5e755acd7f0b48ac835c (patch)
tree5cff80cabee4332f6c2e209d33f3d945d81d8cd2
parentaccc8b5dba17857caca549fd14a8e881cfbd9aea (diff)
Notes
-rw-r--r--usr.sbin/sendmail/mail.local/Makefile6
-rw-r--r--usr.sbin/sendmail/mail.local/mail.local.87
-rw-r--r--usr.sbin/sendmail/mail.local/mail.local.c53
3 files changed, 43 insertions, 23 deletions
diff --git a/usr.sbin/sendmail/mail.local/Makefile b/usr.sbin/sendmail/mail.local/Makefile
index e8556d8ea5c6..9e2217c8f6b3 100644
--- a/usr.sbin/sendmail/mail.local/Makefile
+++ b/usr.sbin/sendmail/mail.local/Makefile
@@ -1,9 +1,13 @@
# @(#)Makefile 8.1 (Berkeley) 7/19/93
PROG= mail.local
-MAN8= mail.local.0
+MAN8= mail.local.8
+.if defined(DONT_FSYNC)
+CFLAGS+= -DDONT_FSYNC
+.endif
BINOWN= root
BINMODE=4555
INSTALLFLAGS=-fschg
+BINDIR= /usr/libexec
.include <bsd.prog.mk>
diff --git a/usr.sbin/sendmail/mail.local/mail.local.8 b/usr.sbin/sendmail/mail.local/mail.local.8
index 661615c462f8..8ffd5357ddf4 100644
--- a/usr.sbin/sendmail/mail.local/mail.local.8
+++ b/usr.sbin/sendmail/mail.local/mail.local.8
@@ -30,6 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)mail.local.8 8.2 (Berkeley) 12/11/93
+.\" $Id$
.\"
.Dd December 11, 1993
.Dt MAIL.LOCAL 8
@@ -40,6 +41,7 @@
.Sh SYNOPSIS
.Nm mail.local
.Op Fl f Ar from
+.Op Fl b
.Ar user ...
.Sh DESCRIPTION
.Nm Mail.local
@@ -55,6 +57,10 @@ The options are as follows:
.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
@@ -90,7 +96,6 @@ user's mailbox directory
.El
.Sh SEE ALSO
.Xr mail 1 ,
-.Xr xsend 1 ,
.Xr flock 2 ,
.Xr getservbyname 3 ,
.Xr comsat 8 ,
diff --git a/usr.sbin/sendmail/mail.local/mail.local.c b/usr.sbin/sendmail/mail.local/mail.local.c
index 860486726477..131583688d27 100644
--- a/usr.sbin/sendmail/mail.local/mail.local.c
+++ b/usr.sbin/sendmail/mail.local/mail.local.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $Id$
*/
#ifndef lint
@@ -174,9 +176,9 @@ extern FILE *fdopen __P((int, const char *));
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 err __P((const char *, ...)) __dead2;
void notifybiff __P((char *));
int store __P((char *));
void usage __P((void));
@@ -191,7 +193,7 @@ main(argc, argv)
char *argv[];
{
struct passwd *pw;
- int ch, fd;
+ int ch, fd, nobiff;
uid_t uid;
char *from;
extern char *optarg;
@@ -211,8 +213,12 @@ main(argc, argv)
#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':
@@ -253,7 +259,7 @@ main(argc, argv)
* at the expense of repeated failures and multiple deliveries.
*/
for (fd = store(from); *argv; ++argv)
- deliver(fd, *argv);
+ deliver(fd, *argv, nobiff);
exit(eval);
}
@@ -308,8 +314,8 @@ store(from)
}
void
-deliver(fd, name)
- int fd;
+deliver(fd, name, nobiff)
+ int fd, nobiff;
char *name;
{
struct stat fsb, sb;
@@ -418,11 +424,13 @@ tryagain:
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) {
@@ -449,13 +457,6 @@ tryagain:
if (nr < 0) {
e_to_sys(errno);
warn("temporary file: %s", strerror(errno));
- goto err3;
- }
-
- /* Flush to disk, don't wait for update. */
- if (fsync(mbfd)) {
- e_to_sys(errno);
- warn("%s: %s", path, strerror(errno));
err3:
if (setreuid(0, 0) < 0) {
e_to_sys(errno);
@@ -469,6 +470,15 @@ err1: (void)close(mbfd);
err0: unlockmbox();
return;
}
+
+#if !defined(DONT_FSYNC)
+ /* Flush to disk, don't wait for update. */
+ if (fsync(mbfd)) {
+ e_to_sys(errno);
+ warn("%s: %s", path, strerror(errno));
+ goto err3;
+ }
+#endif
/* Close and check -- NFS doesn't write until the close. */
if (close(mbfd)) {
@@ -486,7 +496,8 @@ err0: unlockmbox();
printf("reset euid = %d\n", geteuid());
#endif
unlockmbox();
- notifybiff(biffmsg);
+ if (!nobiff)
+ notifybiff(biffmsg);
}
/*
@@ -577,7 +588,7 @@ void
usage()
{
eval = EX_USAGE;
- err("usage: mail.local [-f from] user ...");
+ err("usage: mail.local [-b] [-f from] user ...");
}
#if __STDC__