summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2000-10-01 02:03:50 +0000
committergshapiro <gshapiro@FreeBSD.org>2000-10-01 02:03:50 +0000
commit1bbf49b55a2601a4b47f84ef0db64d5bbc97608f (patch)
tree8243eef774bd2693d62f2204f2be075a5b646c32 /contrib
parent0cc8aac437ca5de8f94291323499241c949261f9 (diff)
downloadFreeBSD-src-1bbf49b55a2601a4b47f84ef0db64d5bbc97608f.zip
FreeBSD-src-1bbf49b55a2601a4b47f84ef0db64d5bbc97608f.tar.gz
Fix conflicts from merge of sendmail 8.11.1
Diffstat (limited to 'contrib')
-rw-r--r--contrib/sendmail/cf/m4/cfhead.m44
-rw-r--r--contrib/sendmail/mail.local/mail.local.814
-rw-r--r--contrib/sendmail/mail.local/mail.local.c449
-rw-r--r--contrib/sendmail/mailstats/mailstats.c4
-rw-r--r--contrib/sendmail/makemap/makemap.c4
-rw-r--r--contrib/sendmail/rmail/rmail.c24
-rw-r--r--contrib/sendmail/smrsh/smrsh.c4
-rw-r--r--contrib/sendmail/src/conf.c17
-rw-r--r--contrib/sendmail/src/conf.h19
-rw-r--r--contrib/sendmail/src/headers.c8
-rw-r--r--contrib/sendmail/src/mailq.16
-rw-r--r--contrib/sendmail/src/savemail.c6
-rw-r--r--contrib/sendmail/src/sendmail.813
13 files changed, 318 insertions, 254 deletions
diff --git a/contrib/sendmail/cf/m4/cfhead.m4 b/contrib/sendmail/cf/m4/cfhead.m4
index 5a7bad3..940a072 100644
--- a/contrib/sendmail/cf/m4/cfhead.m4
+++ b/contrib/sendmail/cf/m4/cfhead.m4
@@ -157,6 +157,8 @@ define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
sinclude(_CF_DIR_`'siteconfig/$1.m4)')
define(`EXPOSED_USER', `PUSHDIVERT(5)CE$1
POPDIVERT`'dnl`'')
+ifdef(`_FFR_EXPOSED_USER_FILE', `define(`EXPOSED_USER_FILE', `PUSHDIVERT(5)FE$1
+POPDIVERT`'dnl`'')', `dnl')
define(`LOCAL_USER', `PUSHDIVERT(5)CL$1
POPDIVERT`'dnl`'')
define(`MASQUERADE_AS', `define(`MASQUERADE_NAME', $1)')
@@ -252,4 +254,4 @@ define(`confMILTER_MACROS_ENVRCPT', ``{rcpt_mailer}, {rcpt_host}, {rcpt_addr}'')
divert(0)dnl
-VERSIONID(`$Id: cfhead.m4,v 8.76.4.9 2000/07/11 23:50:30 geir Exp $')
+VERSIONID(`$Id: cfhead.m4,v 8.76.4.13 2000/08/24 17:09:50 gshapiro Exp $')
diff --git a/contrib/sendmail/mail.local/mail.local.8 b/contrib/sendmail/mail.local/mail.local.8
index 246a952..2c21239 100644
--- a/contrib/sendmail/mail.local/mail.local.8
+++ b/contrib/sendmail/mail.local/mail.local.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -8,17 +8,17 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: mail.local.8,v 8.14 1999/08/26 15:49:20 ca Exp $
+.\" $Id: mail.local.8,v 8.14.14.3 2000/09/17 17:04:25 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
-.TH MAIL.LOCAL 8 "$Date: 1999/08/26 15:49:20 $"
+.TH MAIL.LOCAL 8 "$Date: 2000/09/17 17:04:25 $"
.SH NAME
.B mail.local
\- store mail in a mailbox
.SH SYNOPSIS
.B mail.local
-.RB [ \-7 "] [" \-B "] [" \-d "] [" \-l "] [" \-s "] [" \-f
+.RB [ \-7 "] [" \-B "] [" \-b "] [" \-d "] [" \-l "] [" \-s "] [" \-f
.IR from "] " "user ..."
.SH DESCRIPTION
.B Mail.local
@@ -109,6 +109,12 @@ flock(2),
getservbyname(3),
comsat(8),
sendmail(8)
+.SH WARNING
+.B mail.local
+escapes only "^From " lines that follow an empty line.
+If all lines starting with "From " should be escaped,
+use the 'E' flag for the local mailer in the
+sendmail.cf file.
.SH HISTORY
A superset of
.B mail.local
diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c
index 03fe02c..d182b49 100644
--- a/contrib/sendmail/mail.local/mail.local.c
+++ b/contrib/sendmail/mail.local/mail.local.c
@@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.13 2000/07/18 05:41:38 gshapiro Exp $";
+static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.37 2000/09/22 00:49:10 doug Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@@ -34,215 +34,219 @@ static char id[] = "@(#)$Id: mail.local.c,v 8.143.4.13 2000/07/18 05:41:38 gshap
*/
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/file.h>
-
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-
-#include <fcntl.h>
-#include <netdb.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <syslog.h>
-#include <time.h>
-#include <unistd.h>
-#ifdef EX_OK
-# undef EX_OK /* unistd.h may have another use for this */
-#endif /* EX_OK */
-#include <sysexits.h>
-#include <ctype.h>
-
-#ifndef __P
-# include "sendmail/cdefs.h"
-#endif /* ! __P */
-#include "sendmail/useful.h"
+/* additional mode for open() */
+# define EXTRA_MODE 0
-extern size_t strlcpy __P((char *, const char *, size_t));
-extern size_t strlcat __P((char *, const char *, size_t));
+# include <sys/types.h>
+# include <sys/param.h>
+# include <sys/stat.h>
+# include <sys/socket.h>
+# include <sys/file.h>
-#if defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__) || defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
-# ifndef HASSTRERROR
-# define HASSTRERROR 1
-# endif /* ! HASSTRERROR */
-#endif /* defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__) ||
- defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
+# include <netinet/in.h>
+# include <arpa/nameser.h>
-#include "sendmail/errstring.h"
+# include <fcntl.h>
+# include <netdb.h>
+# include <pwd.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+# include <syslog.h>
+# include <time.h>
+# include <unistd.h>
+# ifdef EX_OK
+# undef EX_OK /* unistd.h may have another use for this */
+# endif /* EX_OK */
+# include <sysexits.h>
+# include <ctype.h>
+# ifndef __P
+# include "sendmail/cdefs.h"
+# endif /* ! __P */
+# include "sendmail/useful.h"
-#ifndef LOCKTO_RM
-# define LOCKTO_RM 300 /* timeout for stale lockfile removal */
-#endif /* LOCKTO_RM */
-#ifndef LOCKTO_GLOB
-# define LOCKTO_GLOB 400 /* global timeout for lockfile creation */
-#endif /* LOCKTO_GLOB */
+extern size_t strlcpy __P((char *, const char *, size_t));
+extern size_t strlcat __P((char *, const char *, size_t));
-#ifdef __STDC__
-# include <stdarg.h>
-# define REALLOC(ptr, size) realloc(ptr, size)
-#else /* __STDC__ */
-# include <varargs.h>
+# if defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__) || defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
+# ifndef HASSTRERROR
+# define HASSTRERROR 1
+# endif /* ! HASSTRERROR */
+# endif /* defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__) || defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
+
+# include "sendmail/errstring.h"
+
+# ifndef LOCKTO_RM
+# define LOCKTO_RM 300 /* timeout for stale lockfile removal */
+# endif /* ! LOCKTO_RM */
+# ifndef LOCKTO_GLOB
+# define LOCKTO_GLOB 400 /* global timeout for lockfile creation */
+# endif /* ! LOCKTO_GLOB */
+
+# ifdef __STDC__
+# include <stdarg.h>
+# define REALLOC(ptr, size) realloc(ptr, size)
+# else /* __STDC__ */
+# include <varargs.h>
/* define a realloc() which works for NULL pointers */
-# define REALLOC(ptr, size) (((ptr) == NULL) ? malloc(size) : realloc(ptr, size))
-#endif /* __STDC__ */
-
-#if (defined(sun) && defined(__svr4__)) || defined(__SVR4)
-# define USE_LOCKF 1
-# define USE_SETEUID 1
-# define _PATH_MAILDIR "/var/mail"
-#endif /* (defined(sun) && defined(__svr4__)) || defined(__SVR4) */
-
-#ifdef NCR_MP_RAS3
-# define USE_LOCKF 1
-# define HASSNPRINTF 1
-# define _PATH_MAILDIR "/var/mail"
-#endif /* NCR_MP_RAS3 */
-
-#if defined(_AIX)
-# define USE_LOCKF 1
-# define USE_SETEUID 1
-# define USE_VSYSLOG 0
-#endif /* defined(_AIX) */
-
-#if defined(__hpux)
-# define USE_LOCKF 1
-# define USE_SETRESUID 1
-# define USE_VSYSLOG 0
-#endif /* defined(__hpux) */
-
-#ifdef DGUX
-# define HASSNPRINTF 1
-# define USE_LOCKF 1
-# define USE_VSYSLOG 0
-#endif /* DGUX */
-
-#if defined(_CRAY)
-# if !defined(MAXPATHLEN)
-# define MAXPATHLEN PATHSIZE
-# endif /* !defined(MAXPATHLEN) */
-# define USE_VSYSLOG 0
-# define _PATH_MAILDIR "/usr/spool/mail"
-#endif /* defined(_CRAY) */
-
-#if defined(ultrix)
-# define USE_VSYSLOG 0
-#endif /* defined(ultrix) */
-
-#if defined(__osf__)
-# define USE_VSYSLOG 0
-#endif /* defined(__osf__) */
-
-#if defined(NeXT) && !defined(__APPLE__)
-# include <libc.h>
-# define _PATH_MAILDIR "/usr/spool/mail"
-# define S_IRUSR S_IREAD
-# define S_IWUSR S_IWRITE
-#endif /* defined(NeXT) && !defined(__APPLE__) */
-
-#if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
-# include <paths.h>
-#endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
+# define REALLOC(ptr, size) (((ptr) == NULL) ? malloc(size) : realloc(ptr, size))
+# endif /* __STDC__ */
+
+# if (defined(sun) && defined(__svr4__)) || defined(__SVR4)
+# define USE_LOCKF 1
+# define USE_SETEUID 1
+# define _PATH_MAILDIR "/var/mail"
+# endif /* (defined(sun) && defined(__svr4__)) || defined(__SVR4) */
+
+# ifdef NCR_MP_RAS3
+# define USE_LOCKF 1
+# define HASSNPRINTF 1
+# define _PATH_MAILDIR "/var/mail"
+# endif /* NCR_MP_RAS3 */
+
+# if defined(_AIX)
+# define USE_LOCKF 1
+# define USE_SETEUID 1
+# define USE_VSYSLOG 0
+# endif /* defined(_AIX) */
+
+# if defined(__hpux)
+# define USE_LOCKF 1
+# define USE_SETRESUID 1
+# define USE_VSYSLOG 0
+# endif /* defined(__hpux) */
+
+# ifdef DGUX
+# define HASSNPRINTF 1
+# define USE_LOCKF 1
+# define USE_VSYSLOG 0
+# endif /* DGUX */
+
+# if defined(_CRAY)
+# if !defined(MAXPATHLEN)
+# define MAXPATHLEN PATHSIZE
+# endif /* !defined(MAXPATHLEN) */
+# define USE_VSYSLOG 0
+# define _PATH_MAILDIR "/usr/spool/mail"
+# endif /* defined(_CRAY) */
+
+# if defined(ultrix)
+# define USE_VSYSLOG 0
+# endif /* defined(ultrix) */
+
+# if defined(__osf__)
+# define USE_VSYSLOG 0
+# endif /* defined(__osf__) */
+
+# if defined(NeXT) && !defined(__APPLE__)
+# include <libc.h>
+# define _PATH_MAILDIR "/usr/spool/mail"
+# define S_IRUSR S_IREAD
+# define S_IWUSR S_IWRITE
+# endif /* defined(NeXT) && !defined(__APPLE__) */
+
+# if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
+# include <paths.h>
+# endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
/*
* If you don't have flock, you could try using lockf instead.
*/
-#ifdef USE_LOCKF
-# define flock(a, b) lockf(a, b, 0)
-# ifdef LOCK_EX
-# undef LOCK_EX
-# endif /* LOCK_EX */
-# define LOCK_EX F_LOCK
-#endif /* USE_LOCKF */
-
-#ifndef USE_VSYSLOG
-# define USE_VSYSLOG 1
-#endif /* ! USE_VSYSLOG */
-
-#ifndef LOCK_EX
-# include <sys/file.h>
-#endif /* ! LOCK_EX */
-
-#if defined(BSD4_4) || defined(__GLIBC__)
-# include <paths.h>
-# define _PATH_LOCTMP "/var/tmp/local.XXXXXX"
-#endif /* defined(BSD4_4) || defined(__GLIBC__) */
-
-#ifdef BSD4_4
-# define HAS_ST_GEN 1
-#else /* BSD4_4 */
-# ifndef _BSD_VA_LIST_
-# define _BSD_VA_LIST_ va_list
-# endif /* ! _BSD_VA_LIST_ */
-#endif /* BSD4_4 */
-
-#if defined(BSD4_4) || defined(linux)
-# define HASSNPRINTF 1
-#else /* defined(BSD4_4) || defined(linux) */
-# ifndef ultrix
+# ifdef USE_LOCKF
+# define flock(a, b) lockf(a, b, 0)
+# ifdef LOCK_EX
+# undef LOCK_EX
+# endif /* LOCK_EX */
+# define LOCK_EX F_LOCK
+# endif /* USE_LOCKF */
+
+# ifndef USE_VSYSLOG
+# define USE_VSYSLOG 1
+# endif /* ! USE_VSYSLOG */
+
+# ifndef LOCK_EX
+# include <sys/file.h>
+# endif /* ! LOCK_EX */
+
+# if defined(BSD4_4) || defined(__GLIBC__)
+# include <paths.h>
+# define _PATH_LOCTMP "/var/tmp/local.XXXXXX"
+# endif /* defined(BSD4_4) || defined(__GLIBC__) */
+
+# ifdef BSD4_4
+# define HAS_ST_GEN 1
+# else /* BSD4_4 */
+# ifndef _BSD_VA_LIST_
+# define _BSD_VA_LIST_ va_list
+# endif /* ! _BSD_VA_LIST_ */
+# endif /* BSD4_4 */
+
+# if defined(BSD4_4) || defined(linux)
+# define HASSNPRINTF 1
+# else /* defined(BSD4_4) || defined(linux) */
+# ifndef ultrix
extern FILE *fdopen __P((int, const char *));
-# endif /* ! ultrix */
-#endif /* defined(BSD4_4) || defined(linux) */
+# endif /* ! ultrix */
+# endif /* defined(BSD4_4) || defined(linux) */
-#if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
-# define CONTENTLENGTH 1 /* Needs the Content-Length header */
-#endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
+# if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
+# define CONTENTLENGTH 1 /* Needs the Content-Length header */
+# endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
-#if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
-# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
-#endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
+# if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
+# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
+# endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
-#ifdef HPUX11
-# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
-#endif /* HPUX11 */
+# ifdef HPUX11
+# define HASSNPRINTF 1 /* has snprintf starting in 11.X */
+# endif /* HPUX11 */
-#if _AIX4 >= 40300
-# define HASSNPRINTF 1 /* has snprintf starting in 4.3 */
-#endif /* _AIX4 >= 40300 */
+# if _AIX4 >= 40300
+# define HASSNPRINTF 1 /* has snprintf starting in 4.3 */
+# endif /* _AIX4 >= 40300 */
-#if !HASSNPRINTF
+# if !HASSNPRINTF
extern int snprintf __P((char *, size_t, const char *, ...));
-# ifndef _CRAY
+# ifndef _CRAY
extern int vsnprintf __P((char *, size_t, const char *, ...));
-# endif /* ! _CRAY */
-#endif /* !HASSNPRINTF */
+# endif /* ! _CRAY */
+# endif /* !HASSNPRINTF */
/*
** If you don't have setreuid, and you have saved uids, and you have
** a seteuid() call that doesn't try to emulate using setuid(), then
** you can try defining USE_SETEUID.
*/
-#ifdef USE_SETEUID
-# define setreuid(r, e) seteuid(e)
-#endif /* USE_SETEUID */
+# ifdef USE_SETEUID
+# define setreuid(r, e) seteuid(e)
+# endif /* USE_SETEUID */
/*
** And of course on hpux you have setresuid()
*/
-#ifdef USE_SETRESUID
-# define setreuid(r, e) setresuid(-1, e, -1)
-#endif /* USE_SETRESUID */
+# ifdef USE_SETRESUID
+# define setreuid(r, e) setresuid(-1, e, -1)
+# endif /* USE_SETRESUID */
-#ifndef _PATH_LOCTMP
-# define _PATH_LOCTMP "/var/tmp/local.XXXXXX"
-#endif /* ! _PATH_LOCTMP */
-# ifndef _PATH_MAILDIR
-# define _PATH_MAILDIR "/var/spool/mail"
-# endif /* ! _PATH_MAILDIR */
+# ifndef _PATH_LOCTMP
+# define _PATH_LOCTMP "/var/tmp/local.XXXXXX"
+# endif /* ! _PATH_LOCTMP */
+# ifndef _PATH_MAILDIR
+# define _PATH_MAILDIR "/var/spool/mail"
+# endif /* ! _PATH_MAILDIR */
-#ifndef S_ISREG
-# define S_ISREG(mode) (((mode) & _S_IFMT) == S_IFREG)
-#endif /* ! S_ISREG */
+# ifndef S_ISREG
+# define S_ISREG(mode) (((mode) & _S_IFMT) == S_IFREG)
+# endif /* ! S_ISREG */
-#ifdef MAILLOCK
-# include <maillock.h>
-#endif /* MAILLOCK */
+# ifdef MAILLOCK
+# include <maillock.h>
+# endif /* MAILLOCK */
+
+# define U_UID pw->pw_uid
+# define U_GID pw->pw_gid
#ifndef INADDRSZ
# define INADDRSZ 4 /* size of an IPv4 address in bytes */
@@ -538,7 +542,8 @@ dolmtp(bouncequota)
p = strchr(rcpt_addr[i], '+');
if (p != NULL)
*p++ = '\0';
- deliver(msgfd, rcpt_addr[i], bouncequota);
+ deliver(msgfd, rcpt_addr[i],
+ bouncequota);
}
(void) close(msgfd);
goto rset;
@@ -628,7 +633,7 @@ dolmtp(bouncequota)
{
rcpt_alloc += RCPT_GROW;
rcpt_addr = (char **)
- REALLOC((char *)rcpt_addr,
+ REALLOC((char *) rcpt_addr,
rcpt_alloc *
sizeof(char **));
if (rcpt_addr == NULL)
@@ -811,7 +816,7 @@ store(from, lmtprcpts)
{
if (eline && line[0] == 'F' &&
!memcmp(line, "From ", 5))
- (void)putc('>', fp);
+ (void) putc('>', fp);
eline = FALSE;
#ifdef CONTENTLENGTH
/* discard existing "Content-Length:" headers */
@@ -879,7 +884,8 @@ store(from, lmtprcpts)
snprintf(line, sizeof line, "%s\n",
quad_to_string(BodyLength));
else
- snprintf(line, sizeof line, "%ld\n", (long) BodyLength);
+ snprintf(line, sizeof line, "%ld\n",
+ (long) BodyLength);
strlcpy(&ContentHdr[16], line, sizeof(ContentHdr) - 16);
}
else
@@ -940,7 +946,8 @@ deliver(fd, name, bouncequota)
if (LMTPMode)
{
if (ExitVal == EX_TEMPFAIL)
- printf("451 4.3.0 cannot lookup name: %s\r\n", name);
+ printf("451 4.3.0 cannot lookup name: %s\r\n",
+ name);
else
printf("550 5.1.1 unknown name: %s\r\n", name);
}
@@ -1030,7 +1037,7 @@ tryagain:
{
int save_errno;
int mode = S_IRUSR|S_IWUSR;
- gid_t gid = pw->pw_gid;
+ gid_t gid = U_GID;
#ifdef MAILGID
(void) umask(0007);
@@ -1038,8 +1045,8 @@ tryagain:
mode |= S_IRGRP|S_IWGRP;
#endif /* MAILGID */
- mbfd = open(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY, mode);
-
+ mbfd = open(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY|EXTRA_MODE,
+ mode);
save_errno = errno;
if (lstat(path, &sb) < 0)
@@ -1049,36 +1056,61 @@ tryagain:
"%s: lstat: file changed after open", path);
goto err1;
}
- else
- sb.st_uid = pw->pw_uid;
if (mbfd == -1)
{
if (save_errno == EEXIST)
goto tryagain;
+
+ /* open failed, don't try again */
+ mailerr("450 4.2.0", "%s: %s", path,
+ errstring(save_errno));
+ goto err0;
}
- else if (fchown(mbfd, pw->pw_uid, gid) < 0)
+ else if (fchown(mbfd, U_UID, gid) < 0)
{
mailerr("451 4.3.0", "chown %u.%u: %s",
- pw->pw_uid, gid, name);
+ U_UID, gid, name);
goto err1;
}
+ else
+ {
+ /*
+ ** open() was successful, now close it so can
+ ** be opened as the right owner again.
+ ** Paranoia: reset mbdf since the file descriptor
+ ** is no longer valid; better safe than sorry.
+ */
+
+ sb.st_uid = U_UID;
+ (void) close(mbfd);
+ mbfd = -1;
+ }
}
else if (sb.st_nlink != 1 || !S_ISREG(sb.st_mode))
{
mailerr("550 5.2.0", "%s: irregular file", path);
goto err0;
}
- else if (sb.st_uid != pw->pw_uid)
+ else if (sb.st_uid != U_UID)
{
ExitVal = EX_CANTCREAT;
mailerr("550 5.2.0", "%s: wrong ownership (%d)",
path, sb.st_uid);
goto err0;
}
- else
- mbfd = open(path, O_APPEND|O_WRONLY, 0);
- if (mbfd == -1)
+ /* change UID for quota checks */
+ if (setreuid(0, U_UID) < 0)
+ {
+ mailerr("450 4.2.0", "setreuid(0, %d): %s (r=%d, e=%d)",
+ U_UID, errstring(errno), getuid(), geteuid());
+ goto err1;
+ }
+#ifdef DEBUG
+ fprintf(stderr, "new euid = %d\n", geteuid());
+#endif /* DEBUG */
+ mbfd = open(path, O_APPEND|O_WRONLY|EXTRA_MODE, 0);
+ if (mbfd < 0)
{
mailerr("450 4.2.0", "%s: %s", path, errstring(errno));
goto err0;
@@ -1089,9 +1121,9 @@ tryagain:
!S_ISREG(fsb.st_mode) ||
sb.st_dev != fsb.st_dev ||
sb.st_ino != fsb.st_ino ||
-#if HAS_ST_GEN && 0 /* AFS returns random values for st_gen */
+# if HAS_ST_GEN && 0 /* AFS returns random values for st_gen */
sb.st_gen != fsb.st_gen ||
-#endif /* HAS_ST_GEN && 0 */
+# endif /* HAS_ST_GEN && 0 */
sb.st_uid != fsb.st_uid)
{
ExitVal = EX_TEMPFAIL;
@@ -1113,11 +1145,11 @@ tryagain:
/* Get the starting offset of the new message for biff. */
curoff = lseek(mbfd, (off_t)0, SEEK_END);
if (sizeof curoff > sizeof(long))
- (void)snprintf(biffmsg, sizeof(biffmsg), "%s@%s\n",
- name, quad_to_string(curoff));
+ (void) snprintf(biffmsg, sizeof(biffmsg), "%s@%s\n",
+ name, quad_to_string(curoff));
else
- (void)snprintf(biffmsg, sizeof(biffmsg), "%s@%ld\n",
- name, curoff);
+ (void) snprintf(biffmsg, sizeof(biffmsg), "%s@%ld\n",
+ name, (long) curoff);
}
/* Copy the message into the file. */
@@ -1127,14 +1159,8 @@ tryagain:
errstring(errno));
goto err1;
}
- if (setreuid(0, pw->pw_uid) < 0)
- {
- mailerr("450 4.2.0", "setreuid(0, %d): %s (r=%d, e=%d)",
- pw->pw_uid, errstring(errno), getuid(), geteuid());
- goto err1;
- }
#ifdef DEBUG
- fprintf(stderr, "new euid = %d\n", geteuid());
+ fprintf(stderr, "before writing: euid = %d\n", geteuid());
#endif /* DEBUG */
#ifdef CONTENTLENGTH
headerbytes = (BodyLength >= 0) ? HeaderLength : -1 ;
@@ -1203,7 +1229,8 @@ err3:
fprintf(stderr, "reset euid = %d\n", geteuid());
#endif /* DEBUG */
(void) ftruncate(mbfd, curoff);
-err1: (void) close(mbfd);
+err1: if (mbfd >= 0)
+ (void) close(mbfd);
err0: unlockmbox();
return;
}
@@ -1250,7 +1277,7 @@ int
lockmbox(name)
char *name;
{
- int r;
+ int r = 0;
if (Locked)
return 0;
@@ -1398,7 +1425,7 @@ void
usage()
{
ExitVal = EX_USAGE;
- mailerr(NULL, "usage: mail.local [-B] [-l] [-f from] [-s] user ...");
+ mailerr(NULL, "usage: mail.local [-7] [-B] [-b] [-l] [-f from] user ...");
exit(ExitVal);
}
@@ -1674,8 +1701,8 @@ _gettemp(path, doopen)
{
if (doopen)
{
- if ((*doopen =
- open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
+ if ((*doopen = open(path, O_CREAT|O_EXCL|O_RDWR,
+ 0600)) >= 0)
return(1);
if (errno != EEXIST)
return(0);
diff --git a/contrib/sendmail/mailstats/mailstats.c b/contrib/sendmail/mailstats/mailstats.c
index 6bd918e..cb6f190 100644
--- a/contrib/sendmail/mailstats/mailstats.c
+++ b/contrib/sendmail/mailstats/mailstats.c
@@ -14,14 +14,14 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: mailstats.c,v 8.53.16.10 2000/07/18 05:51:15 gshapiro Exp $";
+static char id[] = "@(#)$Id: mailstats.c,v 8.53.16.11 2000/09/17 17:04:26 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
diff --git a/contrib/sendmail/makemap/makemap.c b/contrib/sendmail/makemap/makemap.c
index 33acfb8..0506dc4 100644
--- a/contrib/sendmail/makemap/makemap.c
+++ b/contrib/sendmail/makemap/makemap.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: makemap.c,v 8.135.4.10 2000/07/18 05:41:39 gshapiro Exp $";
+static char id[] = "@(#)$Id: makemap.c,v 8.135.4.11 2000/09/13 01:11:10 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@@ -339,7 +339,7 @@ main(argc, argv)
(void) database->smdb_sync(database, 0);
- if (geteuid() == 0 && TrustedUid != 0)
+ if (!unmake && geteuid() == 0 && TrustedUid != 0)
{
errno = database->smdb_set_owner(database, TrustedUid, -1);
if (errno != SMDBE_OK)
diff --git a/contrib/sendmail/rmail/rmail.c b/contrib/sendmail/rmail/rmail.c
index bd21b7c..79f8b92 100644
--- a/contrib/sendmail/rmail/rmail.c
+++ b/contrib/sendmail/rmail/rmail.c
@@ -19,7 +19,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: rmail.c,v 8.39.4.5 2000/07/18 05:55:29 gshapiro Exp $";
+static char id[] = "@(#)$Id: rmail.c,v 8.39.4.8 2000/09/16 22:20:25 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@@ -91,9 +91,9 @@ static char id[] = "@(#)$Id: rmail.c,v 8.39.4.5 2000/07/18 05:55:29 gshapiro Exp
# define STDIN_FILENO 0
#endif /* ! STDIN_FILENO */
-#if defined(BSD4_4) || defined(linux) || SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) || _AIX4 >= 40300
+#if defined(BSD4_4) || defined(linux) || SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) || _AIX4 >= 40300 || defined(HPUX11)
# define HASSNPRINTF 1
-#endif /* defined(BSD4_4) || defined(linux) || SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) || _AIX4 >= 40300 */
+#endif /* defined(BSD4_4) || defined(linux) || SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) || _AIX4 >= 40300 || defined(HPUX11) */
#if defined(sun) && !defined(BSD) && !defined(SOLARIS) && !defined(__svr4__) && !defined(__SVR4)
# define memmove(d, s, l) (bcopy((s), (d), (l)))
@@ -153,7 +153,7 @@ main(argc, argv)
FILE *fp;
char *addrp = NULL, *domain, *p, *t;
char *from_path, *from_sys, *from_user;
- char *args[100], buf[2048], lbuf[2048];
+ char **args, buf[2048], lbuf[2048];
struct stat sb;
extern char *optarg;
extern int optind;
@@ -312,8 +312,13 @@ main(argc, argv)
offset = (off_t)ftell(stdin);
}
+
+ /* Allocate args (with room for sendmail args as well as recipients */
+ args = (char **)xalloc(sizeof(*args) * (10 + argc));
+
i = 0;
args[i++] = _PATH_SENDMAIL; /* Build sendmail's argument list. */
+ args[i++] = "-G"; /* relay submission */
args[i++] = "-oee"; /* No errors, just status. */
#ifdef QUEUE_ONLY
args[i++] = "-odq"; /* Queue it, don't try to deliver. */
@@ -344,7 +349,7 @@ main(argc, argv)
** the address (helps to pass addrs like @gw1,@gw2:aa@bb)
*/
- while (*argv)
+ while (*argv != NULL)
{
if (**argv == '-')
err(EX_USAGE, "dash precedes argument: %s", *argv);
@@ -359,13 +364,18 @@ main(argc, argv)
snprintf(args[i++], len, "<%s>", *argv);
}
argv++;
+ argc--;
+
+ /* Paranoia check, argc used for args[] bound */
+ if (argc < 0)
+ err(EX_SOFTWARE, "Argument count mismatch");
}
- args[i] = 0;
+ args[i] = NULL;
if (debug)
{
fprintf(stderr, "Sendmail arguments:\n");
- for (i = 0; args[i]; i++)
+ for (i = 0; args[i] != NULL; i++)
fprintf(stderr, "\t%s\n", args[i]);
}
diff --git a/contrib/sendmail/smrsh/smrsh.c b/contrib/sendmail/smrsh/smrsh.c
index 0b8ecef..f32e340 100644
--- a/contrib/sendmail/smrsh/smrsh.c
+++ b/contrib/sendmail/smrsh/smrsh.c
@@ -13,7 +13,7 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.\n\
+"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1993 Eric P. Allman. All rights reserved.\n\
Copyright (c) 1993\n\
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.4 2000/05/25 21:44:29 gshapiro Exp $";
+static char id[] = "@(#)$Id: smrsh.c,v 8.31.4.5 2000/09/17 17:04:27 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index 85668b8..6130bee 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.23 2000/07/15 17:35:18 gshapiro Exp $";
+static char id[] = "@(#)$Id: conf.c,v 8.646.2.2.2.32 2000/09/23 00:31:33 ca Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@@ -199,6 +199,12 @@ struct dbsval DontBlameSendmailValues[] =
#if _FFR_UNSAFE_SASL
{ "groupreadablesaslfile", DBS_GROUPREADABLESASLFILE },
#endif /* _FFR_UNSAFE_SASL */
+#if _FFR_UNSAFE_WRITABLE_INCLUDE
+ { "groupwritableforwardfile", DBS_GROUPWRITABLEFORWARDFILE },
+ { "groupwritableincludefile", DBS_GROUPWRITABLEINCLUDEFILE },
+ { "worldwritableforwardfile", DBS_WORLDWRITABLEFORWARDFILE },
+ { "worldwritableincludefile", DBS_WORLDWRITABLEINCLUDEFILE },
+#endif /* _FFR_UNSAFE_WRITABLE_INCLUDE */
{ NULL, 0 }
};
@@ -2147,7 +2153,7 @@ sm_getla(e)
{
char labuf[8];
- snprintf(labuf, sizeof labuf, "%d", CurrentLA);
+ snprintf(labuf, sizeof labuf, "%d", la);
define(macid("{load_avg}", NULL), newstr(labuf), e);
}
return la;
@@ -2986,7 +2992,7 @@ setsid __P ((void))
fd = open("/dev/tty", O_RDWR, 0);
if (fd >= 0)
{
- (void) ioctl(fd, (int) TIOCNOTTY, (char *) 0);
+ (void) ioctl(fd, TIOCNOTTY, (char *) 0);
(void) close(fd);
}
# endif /* TIOCNOTTY */
@@ -4919,7 +4925,7 @@ load_if_names()
if (addr != NULL)
(void) snprintf(ip_addr, sizeof ip_addr,
"[%.*s]",
- sizeof ip_addr - 3, addr);
+ (int) sizeof ip_addr - 3, addr);
break;
case AF_INET:
@@ -4934,7 +4940,7 @@ load_if_names()
/* save IP address in text from */
(void) snprintf(ip_addr, sizeof ip_addr, "[%.*s]",
- sizeof ip_addr - 3, inet_ntoa(ia));
+ (int) sizeof ip_addr - 3, inet_ntoa(ia));
break;
}
@@ -4995,6 +5001,7 @@ load_if_names()
if (tTd(0, 4))
dprintf("SIOCGIFCONF failed: %s\n", errstring(errno));
(void) close(s);
+ free(ifc.ifc_buf);
return;
}
diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h
index c748bf3..1ef1427 100644
--- a/contrib/sendmail/src/conf.h
+++ b/contrib/sendmail/src/conf.h
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Id: conf.h,v 8.496.4.20 2000/07/15 17:35:19 gshapiro Exp $
+ * $Id: conf.h,v 8.496.4.25 2000/08/08 23:50:40 ca Exp $
*/
/* $FreeBSD$ */
@@ -527,6 +527,8 @@ typedef int pid_t;
# endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
# if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
+# else /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
+ typedef int int32_t;
# endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
# if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
# ifndef LA_TYPE
@@ -536,9 +538,9 @@ typedef int pid_t;
# define HASGETUSERSHELL 1 /* getusershell(3c) bug fixed in 2.7 */
# endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
# if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
-# undef NETINET6
-# define NETINET6 1 /* IPv6 added in 2.8 */
# define HASSTRL 1 /* str*(3) added in 2.8 */
+# undef _PATH_SENDMAILPID /* tmpfs /var/run added in 2.8 */
+# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
# endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
# ifndef HASGETUSERSHELL
# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps pre-2.7 */
@@ -2791,9 +2793,14 @@ typedef void (*sigfunc_t) __P((int));
# define LOG_DEBUG 7 /* debug-level messages */
#endif /* !LOG */
-#if SFIO && defined(ERRLIST_PREDEFINED)
-# undef ERRLIST_PREDEFINED
-#endif /* SFIO && defined(ERRLIST_PREDEFINED) */
+#if SFIO
+# ifdef ERRLIST_PREDEFINED
+# undef ERRLIST_PREDEFINED
+# endif /* ERRLIST_PREDEFINED */
+# if !HASSNPRINTF
+# define HASSNPRINTF 1 /* sfio includes snprintf() */
+# endif /* !HASSNPRINTF */
+#endif /* SFIO */
#ifndef SFIO_STDIO_COMPAT
# define SFIO_STDIO_COMPAT 0
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index ac830a1..03472ac 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: headers.c,v 8.203.4.6 2000/07/19 02:53:32 ca Exp $";
+static char id[] = "@(#)$Id: headers.c,v 8.203.4.7 2000/08/22 21:50:36 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@@ -53,9 +53,7 @@ setupheaders()
**
** Parameters:
** line -- header as a text line.
-** pflag -- flags:
-** CHHDR_DEF: this is a default value.
-** CHHDR_CHECK: call rulesets.
+** pflag -- flags for chompheader() (from sendmail.h)
** hdrp -- a pointer to the place to save the header.
** e -- the envelope including this header.
**
@@ -416,7 +414,7 @@ hse:
h->h_macro = mid;
*hp = h;
h->h_flags = hi->hi_flags;
- if (bitset(pflag, CHHDR_USER))
+ if (bitset(pflag, CHHDR_USER) || bitset(pflag, CHHDR_QUEUE))
h->h_flags |= H_USER;
/* strip EOH flag if parsing MIME headers */
diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1
index d7160f9..d3e83c51 100644
--- a/contrib/sendmail/src/mailq.1
+++ b/contrib/sendmail/src/mailq.1
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1985, 1990, 1993
@@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: mailq.1,v 8.14.28.1 2000/07/14 05:07:01 gshapiro Exp $
+.\" $Id: mailq.1,v 8.14.28.2 2000/09/17 17:04:27 gshapiro Exp $
.\"
.\" $FreeBSD$
.\"
-.TH MAILQ 1 "$Date: 2000/07/14 05:07:01 $"
+.TH MAILQ 1 "$Date: 2000/09/17 17:04:27 $"
.SH NAME
.B mailq
\- print the mail queue
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index 9a196b0..a5173eb 100644
--- a/contrib/sendmail/src/savemail.c
+++ b/contrib/sendmail/src/savemail.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: savemail.c,v 8.212.4.3 2000/06/13 07:16:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: savemail.c,v 8.212.4.5 2000/08/22 22:46:00 gshapiro Exp $";
#endif /* ! lint */
/* $FreeBSD$ */
@@ -334,7 +334,8 @@ savemail(e, sendbody)
{
if (e->e_from.q_home != NULL)
p = e->e_from.q_home;
- else if ((pw = sm_getpwnam(e->e_from.q_user)) != NULL)
+ else if ((pw = sm_getpwnam(e->e_from.q_user)) != NULL &&
+ *pw->pw_dir != '\0')
p = pw->pw_dir;
}
if (p == NULL || e->e_dfp == NULL)
@@ -447,6 +448,7 @@ savemail(e, sendbody)
case ESM_PANIC:
/* leave the locked queue & transcript files around */
loseqfile(e, "savemail panic");
+ errno = 0;
syserr("!554 savemail: cannot save rejected email anywhere");
}
}
diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8
index a256033..2cf6600 100644
--- a/contrib/sendmail/src/sendmail.8
+++ b/contrib/sendmail/src/sendmail.8
@@ -9,11 +9,11 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: sendmail.8,v 8.36 2000/02/01 05:49:57 gshapiro Exp $
+.\" $Id: sendmail.8,v 8.36.8.2 2000/09/07 21:14:00 ca Exp $
.\"
.\" $FreeBSD$
.\"
-.TH SENDMAIL 8 "$Date: 2000/02/01 05:49:57 $"
+.TH SENDMAIL 8 "$Date: 2000/09/07 21:14:00 $"
.SH NAME
.B sendmail
\- an electronic mail transport agent
@@ -172,6 +172,13 @@ Otherwise,
an X-Authentication-Warning header
will be added to the message.
.TP
+.BI \-G
+Relay (gateway) submission of a message,
+e.g., when
+.BR rmail
+calls
+.B sendmail .
+.TP
.BI \-h N
Set the hop count to
.IR N .
@@ -674,8 +681,6 @@ Internet Request For Comments
.IR RFC819 ,
.IR RFC821 ,
.IR RFC822 .
-.IR "Sendmail \- An Internetwork Mail Router" ,
-No. 9, SMM.
.IR "Sendmail Installation and Operation Guide" ,
No. 8, SMM.
.PP
OpenPOWER on IntegriCloud