summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sendmail/src
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-12-03 06:15:52 +0000
committerpeter <peter@FreeBSD.org>1996-12-03 06:15:52 +0000
commitaad7d263e00971bb9e46e80ebc671b30c5e0fa73 (patch)
treedc5eb8eff5bf4f08980ac82e89f5dbbd95fad91c /usr.sbin/sendmail/src
parent7a3624533288fa35a41c29ac536eca2fa5a5917f (diff)
downloadFreeBSD-src-aad7d263e00971bb9e46e80ebc671b30c5e0fa73.zip
FreeBSD-src-aad7d263e00971bb9e46e80ebc671b30c5e0fa73.tar.gz
Merge 8.8.3->8.8.4 changes onto our mainline where we've edited the
file at some point in the past. Obtained from: Eric Allman <eric@sendmail.org>
Diffstat (limited to 'usr.sbin/sendmail/src')
-rw-r--r--usr.sbin/sendmail/src/collect.c28
-rw-r--r--usr.sbin/sendmail/src/conf.c129
-rw-r--r--usr.sbin/sendmail/src/conf.h32
-rw-r--r--usr.sbin/sendmail/src/daemon.c285
-rw-r--r--usr.sbin/sendmail/src/deliver.c132
-rw-r--r--usr.sbin/sendmail/src/headers.c22
-rw-r--r--usr.sbin/sendmail/src/main.c56
-rw-r--r--usr.sbin/sendmail/src/mime.c7
-rw-r--r--usr.sbin/sendmail/src/parseaddr.c11
-rw-r--r--usr.sbin/sendmail/src/readcf.c14
-rw-r--r--usr.sbin/sendmail/src/recipient.c25
-rw-r--r--usr.sbin/sendmail/src/savemail.c6
-rw-r--r--usr.sbin/sendmail/src/sendmail.h19
-rw-r--r--usr.sbin/sendmail/src/srvrsmtp.c34
-rw-r--r--usr.sbin/sendmail/src/udb.c38
-rw-r--r--usr.sbin/sendmail/src/usersmtp.c37
-rw-r--r--usr.sbin/sendmail/src/util.c51
17 files changed, 602 insertions, 324 deletions
diff --git a/usr.sbin/sendmail/src/collect.c b/usr.sbin/sendmail/src/collect.c
index 48b5b89..c5e1ceb 100644
--- a/usr.sbin/sendmail/src/collect.c
+++ b/usr.sbin/sendmail/src/collect.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)collect.c 8.60 (Berkeley) 11/15/96";
+static char sccsid[] = "@(#)collect.c 8.61 (Berkeley) 11/24/96";
#endif /* not lint */
# include <errno.h>
@@ -90,18 +90,18 @@ collect(fp, smtpmode, requeueflag, hdrp, e)
HDR **hdrp;
register ENVELOPE *e;
{
- register FILE *tf;
- bool ignrdot = smtpmode ? FALSE : IgnrDot;
- time_t dbto = smtpmode ? TimeOuts.to_datablock : 0;
- register char *bp;
- int c = '\0';
- bool inputerr = FALSE;
+ register FILE *volatile tf;
+ volatile bool ignrdot = smtpmode ? FALSE : IgnrDot;
+ volatile time_t dbto = smtpmode ? TimeOuts.to_datablock : 0;
+ register char *volatile bp;
+ volatile int c = '\0';
+ volatile bool inputerr = FALSE;
bool headeronly;
- char *buf;
- int buflen;
- int istate;
- int mstate;
- u_char *pbp;
+ char *volatile buf;
+ volatile int buflen;
+ volatile int istate;
+ volatile int mstate;
+ u_char *volatile pbp;
u_char peekbuf[8];
char dfname[20];
char bufbuf[MAXLINE];
@@ -205,7 +205,7 @@ collect(fp, smtpmode, requeueflag, hdrp, e)
{
if (istate == IS_BOL)
fprintf(TrafficLogFile, "%05d <<< ",
- getpid());
+ (int) getpid());
if (c == EOF)
fprintf(TrafficLogFile, "[EOF]\n");
else
@@ -647,7 +647,7 @@ tferror(tf, e)
st.st_size);
else
fprintf(tf, "\n*** Mail of at least %ld bytes could not be accepted\n",
- st.st_size);
+ (long) st.st_size);
fprintf(tf, "*** at %s due to lack of disk space for temp file.\n",
MyHostName);
avail = freediskspace(QueueDir, &bsize);
diff --git a/usr.sbin/sendmail/src/conf.c b/usr.sbin/sendmail/src/conf.c
index 750bad0..eba8181 100644
--- a/usr.sbin/sendmail/src/conf.c
+++ b/usr.sbin/sendmail/src/conf.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)conf.c 8.315 (Berkeley) 11/10/96";
+static char sccsid[] = "@(#)conf.c 8.325 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -1087,34 +1087,83 @@ setsignal(sig, handler)
#endif
}
/*
-** RELEASESIGNAL -- release a held signal
+** BLOCKSIGNAL -- hold a signal to prevent delivery
**
** Parameters:
-** sig -- the signal to release.
+** sig -- the signal to block.
**
** Returns:
-** 0 on success.
+** 1 signal was previously blocked
+** 0 signal was not previously blocked
** -1 on failure.
*/
int
-releasesignal(sig)
+blocksignal(sig)
int sig;
{
#ifdef BSD4_3
# ifndef sigmask
# define sigmask(s) (1 << ((s) - 1))
# endif
- return sigsetmask(sigblock(0) & ~sigmask(sig));
+ return (sigblock(sigmask(sig)) & sigmask(sig)) != 0;
#else
# ifdef ALTOS_SYSTEM_V
- sigrelse(sig) ;
+ sigfunc_t handler;
+
+ handler = sigset(sig, SIG_HOLD);
+ if (handler == SIG_ERR)
+ return -1;
+ else
+ return handler == SIG_HOLD;
# else
- sigset_t sset;
+ sigset_t sset, oset;
sigemptyset(&sset);
sigaddset(&sset, sig);
- return sigprocmask(SIG_UNBLOCK, &sset, NULL);
+ if (sigprocmask(SIG_BLOCK, &sset, &oset) < 0)
+ return -1;
+ else
+ return sigismember(&oset, sig);
+# endif
+#endif
+}
+ /*
+** RELEASESIGNAL -- release a held signal
+**
+** Parameters:
+** sig -- the signal to release.
+**
+** Returns:
+** 1 signal was previously blocked
+** 0 signal was not previously blocked
+** -1 on failure.
+*/
+
+int
+releasesignal(sig)
+ int sig;
+{
+#ifdef BSD4_3
+ return (sigsetmask(sigblock(0) & ~sigmask(sig)) & sigmask(sig)) != 0;
+#else
+# ifdef ALTOS_SYSTEM_V
+ sigfunc_t handler;
+
+ handler = sigset(sig, SIG_HOLD);
+ if (sigrelse(sig) < 0)
+ return -1;
+ else
+ return handler == SIG_HOLD;
+# else
+ sigset_t sset, oset;
+
+ sigemptyset(&sset);
+ sigaddset(&sset, sig);
+ if (sigprocmask(SIG_UNBLOCK, &sset, &oset) < 0)
+ return -1;
+ else
+ return sigismember(&oset, sig);
# endif
#endif
}
@@ -1256,6 +1305,7 @@ init_vendor_macros(e)
#define LA_IRIX6 11 /* special IRIX 6.2 implementation */
#define LA_KSTAT 12 /* special Solaris kstat(3k) implementation */
#define LA_DEVSHORT 13 /* read short from a device */
+#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
/* do guesses based on general OS type */
#ifndef LA_TYPE
@@ -1378,7 +1428,8 @@ getla()
(void) fcntl(kmem, F_SETFD, 1);
}
if (tTd(3, 20))
- printf("getla: symbol address = %#x\n", Nl[X_AVENRUN].n_value);
+ printf("getla: symbol address = %#lx\n",
+ (u_long) Nl[X_AVENRUN].n_value);
if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, SEEK_SET) == -1 ||
read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
{
@@ -1882,6 +1933,37 @@ getla()
#endif /* LA_TYPE == LA_DEVSHORT */
+#if LA_TYPE == LA_ALPHAOSF
+# include <sys/table.h>
+
+int getla()
+{
+ int ave = 0;
+ struct tbl_loadavg tab;
+
+ if (table(TBL_LOADAVG, 0, &tab, 1, sizeof(tab)) == -1)
+ {
+ if (tTd(3, 1))
+ printf("getla: table %s\n", errstring(errno));
+ return (-1);
+ }
+
+ if (tTd(3, 1))
+ printf("getla: scale = %d\n", tab.tl_lscale);
+
+ if (tab.tl_lscale)
+ ave = (tab.tl_avenrun.l[0] + (tab.tl_lscale/2)) / tab.tl_lscale;
+ else
+ ave = (int) (tab.tl_avenrun.d[0] + 0.5);
+
+ if (tTd(3, 1))
+ printf("getla: %d\n", ave);
+
+ return ave;
+}
+
+#endif
+
#if LA_TYPE == LA_ZERO
int
@@ -2058,6 +2140,8 @@ refuseconnections(port)
if (MaxChildren > 0 && CurChildren >= MaxChildren)
{
+ extern void proc_list_probe __P((void));
+
proc_list_probe();
if (CurChildren >= MaxChildren)
{
@@ -2870,7 +2954,7 @@ static void dopr_outch __P(( int c ));
static void
dopr( buffer, format, args )
char *buffer;
- char *format;
+ const char *format;
va_list args;
{
int ch;
@@ -3842,6 +3926,11 @@ vendor_pre_defaults(e)
#ifdef SUN_EXTENSIONS
sun_pre_defaults(e);
#endif
+#ifdef apollo
+ /* stupid domain/os can't even open /etc/sendmail.cf without this */
+ setuserenv("ISP", NULL);
+ setuserenv("SYSTYPE", NULL);
+#endif
}
@@ -3920,6 +4009,7 @@ int allow_severity = LOG_INFO;
int deny_severity = LOG_WARNING;
#endif
+#if DAEMON
bool
validate_connection(sap, hostname, e)
SOCKADDR *sap;
@@ -3935,6 +4025,8 @@ validate_connection(sap, hostname, e)
#endif
return TRUE;
}
+
+#endif
/*
** STRTOL -- convert string to long integer
**
@@ -4184,14 +4276,26 @@ struct passwd *
sm_getpwnam(user)
char *user;
{
+#ifdef _AIX4
+ extern struct passwd *_getpwnam_shadow(const char *, const int);
+
+ return _getpwnam_shadow(user, 0);
+#else
return getpwnam(user);
+#endif
}
struct passwd *
sm_getpwuid(uid)
UID_T uid;
{
+#if defined(_AIX4) && 0
+ extern struct passwd *_getpwuid_shadow(const int, const int);
+
+ return _getpwuid_shadow(uid,0);
+#else
return getpwuid(uid);
+#endif
}
/*
** SECUREWARE_SETUP_SECURE -- Convex SecureWare setup
@@ -4611,9 +4715,6 @@ char *OsCompileOptions[] =
#if HASSETVBUF
"HASSETVBUF",
#endif
-#if HASSIGSETMASK
- "HASSIGSETMASK",
-#endif
#if HASSNPRINTF
"HASSNPRINTF",
#endif
diff --git a/usr.sbin/sendmail/src/conf.h b/usr.sbin/sendmail/src/conf.h
index 0c3729b..5ec2b36 100644
--- a/usr.sbin/sendmail/src/conf.h
+++ b/usr.sbin/sendmail/src/conf.h
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)conf.h 8.272 (Berkeley) 11/16/96
+ * @(#)conf.h 8.279 (Berkeley) 12/1/96
*/
/*
@@ -443,6 +443,7 @@ typedef int pid_t;
# undef WEXITSTATUS
# undef HASUNAME
# define setpgid setpgrp
+# define MODE_T int
typedef int pid_t;
extern char *getenv();
@@ -476,6 +477,7 @@ extern char *getenv();
# define HASINITGROUPS 1 /* has initgroups(3) call */
# define IP_SRCROUTE 0 /* does not have <netinet/ip_var.h> */
# define HASGETUSERSHELL 0 /* does not have getusershell(3) */
+# define HASSNPRINTF 1 /* has snprintf(3) */
# ifndef IDENTPROTO
# define IDENTPROTO 0 /* TCP/IP implementation is broken */
# endif
@@ -574,7 +576,7 @@ extern long dgux_inet_addr();
# ifndef HASFLOCK
# define HASFLOCK 1 /* has flock(2) call */
# endif
-# define LA_TYPE LA_INT
+# define LA_TYPE LA_ALPHAOSF
# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
# define _PATH_VENDOR_CF "/var/adm/sendmail/sendmail.cf"
# ifndef _PATH_SENDMAILPID
@@ -1434,7 +1436,6 @@ extern int syslog(int, char *, ...);
# define HASUNAME 1 /* use System V uname(2) system call */
# define HASINITGROUPS 1 /* has initgroups(3) function */
# define HASSETVBUF 1 /* has setvbuf(3) function */
-# define HASSIGSETMASK 0 /* does not have sigsetmask(2) function */
# ifndef HASGETUSERSHELL
# define HASGETUSERSHELL 0 /* does not have getusershell(3) function */
# endif
@@ -1488,6 +1489,7 @@ extern struct group *getgrent(), *getgrnam(), *getgrgid();
# define setpgid setpgrp
# undef WIFEXITED
# undef WEXITSTATUS
+# define MODE_T int /* system include files have no mode_t */
typedef int pid_t;
typedef int (*sigfunc_t)();
# define SIGFUNC_DEFINED
@@ -1841,15 +1843,6 @@ extern int errno;
# define SECUREWARE 0 /* assume no SecureWare C2 auditing hooks */
#endif
-/* heuristic setting of HASSETSIGMASK; can override above */
-#ifndef HASSIGSETMASK
-# ifdef SIGVTALRM
-# define HASSETSIGMASK 1
-# else
-# define HASSETSIGMASK 0
-# endif
-#endif
-
/*
** If no type for argument two of getgroups call is defined, assume
** it's an integer -- unfortunately, there seem to be several choices
@@ -1917,6 +1910,9 @@ extern int errno;
/* pseudo-code used in server SMTP */
# define EX_QUIT 22 /* drop out of server immediately */
+/* pseudo-code used for mci_setstat */
+# define EX_NOTSTICKY -5 /* don't save persistent status */
+
/*
** These are used in a few cases where we need some special
@@ -1979,9 +1975,15 @@ extern int h_errno;
*/
#if NETINET || NETISO
-# define SMTP 1 /* enable user and server SMTP */
-# define QUEUE 1 /* enable queueing */
-# define DAEMON 1 /* include the daemon (requires IPC & SMTP) */
+# ifndef SMTP
+# define SMTP 1 /* enable user and server SMTP */
+# endif
+# ifndef QUEUE
+# define QUEUE 1 /* enable queueing */
+# endif
+# ifndef DAEMON
+# define DAEMON 1 /* include the daemon (requires IPC & SMTP) */
+# endif
#endif
diff --git a/usr.sbin/sendmail/src/daemon.c b/usr.sbin/sendmail/src/daemon.c
index 283d7e4..c8516fc 100644
--- a/usr.sbin/sendmail/src/daemon.c
+++ b/usr.sbin/sendmail/src/daemon.c
@@ -37,28 +37,29 @@
#ifndef lint
#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.148 (Berkeley) 11/8/96 (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.156 (Berkeley) 12/1/96 (with daemon mode)";
#else
-static char sccsid[] = "@(#)daemon.c 8.148 (Berkeley) 11/8/96 (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c 8.156 (Berkeley) 12/1/96 (without daemon mode)";
#endif
#endif /* not lint */
-#ifdef DAEMON
-
+#if DAEMON || defined(SOCK_STREAM)
# include <arpa/inet.h>
-
-#if NAMED_BIND
-# include <resolv.h>
-# ifndef NO_DATA
-# define NO_DATA NO_ADDRESS
+# if NAMED_BIND
+# include <resolv.h>
+# ifndef NO_DATA
+# define NO_DATA NO_ADDRESS
+# endif
# endif
#endif
-#if IP_SRCROUTE
-# include <netinet/in_systm.h>
-# include <netinet/ip.h>
-# include <netinet/ip_var.h>
-#endif
+#if DAEMON
+
+# if IP_SRCROUTE
+# include <netinet/in_systm.h>
+# include <netinet/ip.h>
+# include <netinet/ip_var.h>
+# endif
/*
** DAEMON.C -- routines to use when running as a daemon.
@@ -195,10 +196,13 @@ getrequests(e)
{
register pid_t pid;
auto int lotherend;
+ int savederrno;
+ int pipefd[2];
extern bool refuseconnections();
extern int getla();
/* see if we are rejecting connections */
+ (void) blocksignal(SIGALRM);
if (refuseconnections(ntohs(DaemonAddr.sin.sin_port)))
{
if (DaemonSocket >= 0)
@@ -254,6 +258,7 @@ getrequests(e)
if (SetNonBlocking(DaemonSocket, FALSE) < 0)
log an error here;
#endif
+ (void) releasesignal(SIGALRM);
do
{
errno = 0;
@@ -261,8 +266,11 @@ getrequests(e)
t = accept(DaemonSocket,
(struct sockaddr *)&RealHostAddr, &lotherend);
} while (t < 0 && errno == EINTR);
+ savederrno = errno;
+ (void) blocksignal(SIGALRM);
if (t < 0)
{
+ errno = savederrno;
syserr("getrequests: accept");
/* arrange to re-open the socket next time around */
@@ -280,10 +288,26 @@ getrequests(e)
if (tTd(15, 2))
printf("getrequests: forking (fd = %d)\n", t);
+ /*
+ ** Create a pipe to keep the child from writing to the
+ ** socket until after the parent has closed it. Otherwise
+ ** the parent may hang if the child has closed it first.
+ */
+
+ if (pipe(pipefd) < 0)
+ pipefd[0] = pipefd[1] = -1;
+
+ blocksignal(SIGCHLD);
pid = fork();
if (pid < 0)
{
syserr("daemon: cannot fork");
+ if (pipefd[0] != -1)
+ {
+ (void) close(pipefd[0]);
+ (void) close(pipefd[1]);
+ }
+ (void) releasesignal(SIGCHLD);
sleep(10);
(void) close(t);
continue;
@@ -302,13 +326,41 @@ getrequests(e)
** Verify calling user id if possible here.
*/
+ (void) releasesignal(SIGALRM);
+ (void) releasesignal(SIGCHLD);
(void) setsignal(SIGCHLD, SIG_DFL);
(void) setsignal(SIGHUP, intsig);
(void) close(DaemonSocket);
+ proc_list_clear();
+
+ /* don't schedule queue runs if we are told to ETRN */
+ QueueIntvl = 0;
setproctitle("startup with %s",
anynet_ntoa(&RealHostAddr));
+ if (pipefd[0] != -1)
+ {
+ auto char c;
+
+ /*
+ ** Wait for the parent to close the write end
+ ** of the pipe, which we will see as an EOF.
+ ** This guarantees that we won't write to the
+ ** socket until after the parent has closed
+ ** the pipe.
+ */
+
+ /* close the write end of the pipe */
+ (void) close(pipefd[1]);
+
+ /* we shouldn't be interrupted, but ... */
+ while (read(pipefd[0], &c, 1) < 0 &&
+ errno == EINTR)
+ continue;
+ (void) close(pipefd[0]);
+ }
+
/* determine host name */
p = hostnamebyanyaddr(&RealHostAddr);
if (strlen(p) > (SIZE_T) MAXNAME)
@@ -350,9 +402,18 @@ getrequests(e)
/* parent -- keep track of children */
proc_list_add(pid);
+ (void) releasesignal(SIGCHLD);
+
+ /* close the read end of the synchronization pipe */
+ if (pipefd[0] != -1)
+ (void) close(pipefd[0]);
/* close the port so that others will hang (for a while) */
(void) close(t);
+
+ /* release the child by closing the read end of the sync pipe */
+ if (pipefd[1] != -1)
+ (void) close(pipefd[1]);
}
if (tTd(15, 2))
printf("getreq: returning (null server)\n");
@@ -585,7 +646,9 @@ setdaemonoptions(p)
case 'P': /* port */
switch (DaemonAddr.sa.sa_family)
{
+#if NETISO
short port;
+#endif
#if NETINET
case AF_INET:
@@ -683,14 +746,14 @@ makeconnection(host, port, mci, e)
register MCI *mci;
ENVELOPE *e;
{
- register int i = 0;
- register int s;
- register struct hostent *hp = (struct hostent *)NULL;
+ register volatile int i = 0;
+ register volatile int s;
+ register struct hostent *volatile hp = (struct hostent *)NULL;
SOCKADDR addr;
int sav_errno;
- int addrlen;
- bool firstconnect;
- EVENT *ev;
+ volatile int addrlen;
+ volatile bool firstconnect;
+ EVENT *volatile ev = NULL;
/*
** Set up the address for the mailer.
@@ -1109,7 +1172,7 @@ getauthinfo(fd)
int fd;
{
int falen;
- register char *p;
+ register char *volatile p = NULL;
SOCKADDR la;
int lalen;
register struct servent *sp;
@@ -1545,6 +1608,94 @@ host_map_lookup(map, name, av, statp)
s->s_namecanon.nc_cname = newstr(cp);
return cp;
}
+
+# else /* DAEMON */
+/* code for systems without sophisticated networking */
+
+/*
+** MYHOSTNAME -- stub version for case of no daemon code.
+**
+** Can't convert to upper case here because might be a UUCP name.
+**
+** Mark, you can change this to be anything you want......
+*/
+
+char **
+myhostname(hostbuf, size)
+ char hostbuf[];
+ int size;
+{
+ register FILE *f;
+
+ hostbuf[0] = '\0';
+ f = fopen("/usr/include/whoami", "r");
+ if (f != NULL)
+ {
+ (void) fgets(hostbuf, size, f);
+ fixcrlf(hostbuf, TRUE);
+ (void) fclose(f);
+ }
+ return (NULL);
+}
+ /*
+** GETAUTHINFO -- get the real host name asociated with a file descriptor
+**
+** Parameters:
+** fd -- the descriptor
+**
+** Returns:
+** The host name associated with this descriptor, if it can
+** be determined.
+** NULL otherwise.
+**
+** Side Effects:
+** none
+*/
+
+char *
+getauthinfo(fd)
+ int fd;
+{
+ return NULL;
+}
+ /*
+** MAPHOSTNAME -- turn a hostname into canonical form
+**
+** Parameters:
+** map -- a pointer to the database map.
+** name -- a buffer containing a hostname.
+** avp -- a pointer to a (cf file defined) argument vector.
+** statp -- an exit status (out parameter).
+**
+** Returns:
+** mapped host name
+** FALSE otherwise.
+**
+** Side Effects:
+** Looks up the host specified in name. If it is not
+** the canonical name for that host, replace it with
+** the canonical name. If the name is unknown, or it
+** is already the canonical name, leave it unchanged.
+*/
+
+/*ARGSUSED*/
+char *
+host_map_lookup(map, name, avp, statp)
+ MAP *map;
+ char *name;
+ char **avp;
+ char *statp;
+{
+ register struct hostent *hp;
+
+ hp = sm_gethostbyname(name);
+ if (hp != NULL)
+ return hp->h_name;
+ *statp = EX_NOHOST;
+ return NULL;
+}
+
+#endif /* DAEMON */
/*
** ANYNET_NTOA -- convert a network address to printable form.
**
@@ -1555,6 +1706,8 @@ host_map_lookup(map, name, av, statp)
** A printable version of that sockaddr.
*/
+#ifdef SOCK_STREAM
+
#if NETLINK
# include <net/if_dl.h>
#endif
@@ -1659,9 +1812,11 @@ hostnamebyanyaddr(sap)
break;
#endif
+#if NETUNIX
case AF_UNIX:
hp = NULL;
break;
+#endif
default:
hp = sm_gethostbyaddr(sap->sa.sa_data,
@@ -1686,90 +1841,4 @@ hostnamebyanyaddr(sap)
}
}
-# else /* DAEMON */
-/* code for systems without sophisticated networking */
-
-/*
-** MYHOSTNAME -- stub version for case of no daemon code.
-**
-** Can't convert to upper case here because might be a UUCP name.
-**
-** Mark, you can change this to be anything you want......
-*/
-
-char **
-myhostname(hostbuf, size)
- char hostbuf[];
- int size;
-{
- register FILE *f;
-
- hostbuf[0] = '\0';
- f = fopen("/usr/include/whoami", "r");
- if (f != NULL)
- {
- (void) fgets(hostbuf, size, f);
- fixcrlf(hostbuf, TRUE);
- (void) fclose(f);
- }
- return (NULL);
-}
- /*
-** GETAUTHINFO -- get the real host name asociated with a file descriptor
-**
-** Parameters:
-** fd -- the descriptor
-**
-** Returns:
-** The host name associated with this descriptor, if it can
-** be determined.
-** NULL otherwise.
-**
-** Side Effects:
-** none
-*/
-
-char *
-getauthinfo(fd)
- int fd;
-{
- return NULL;
-}
- /*
-** MAPHOSTNAME -- turn a hostname into canonical form
-**
-** Parameters:
-** map -- a pointer to the database map.
-** name -- a buffer containing a hostname.
-** avp -- a pointer to a (cf file defined) argument vector.
-** statp -- an exit status (out parameter).
-**
-** Returns:
-** mapped host name
-** FALSE otherwise.
-**
-** Side Effects:
-** Looks up the host specified in name. If it is not
-** the canonical name for that host, replace it with
-** the canonical name. If the name is unknown, or it
-** is already the canonical name, leave it unchanged.
-*/
-
-/*ARGSUSED*/
-char *
-host_map_lookup(map, name, avp, statp)
- MAP *map;
- char *name;
- char **avp;
- char *statp;
-{
- register struct hostent *hp;
-
- hp = sm_gethostbyname(name);
- if (hp != NULL)
- return hp->h_name;
- *statp = EX_NOHOST;
- return NULL;
-}
-
-#endif /* DAEMON */
+#endif /* SOCK_STREAM */
diff --git a/usr.sbin/sendmail/src/deliver.c b/usr.sbin/sendmail/src/deliver.c
index c019d2b..576c166 100644
--- a/usr.sbin/sendmail/src/deliver.c
+++ b/usr.sbin/sendmail/src/deliver.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)deliver.c 8.251 (Berkeley) 11/11/96";
+static char sccsid[] = "@(#)deliver.c 8.260 (Berkeley) 12/1/96";
#endif /* not lint */
#include "sendmail.h"
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)deliver.c 8.251 (Berkeley) 11/11/96";
extern int h_errno;
#endif
-#ifdef SMTP
+#if SMTP
extern char SmtpError[];
#endif
@@ -131,7 +131,7 @@ sendall(e, mode)
if (e->e_hopcount > MaxHopCount)
{
errno = 0;
-#ifdef QUEUE
+#if QUEUE
queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
#endif
e->e_flags |= EF_FATALERRS|EF_PM_NOTIFY|EF_CLRQUEUE;
@@ -422,7 +422,7 @@ sendall(e, mode)
mode = SM_QUEUE;
}
-# ifdef QUEUE
+# if QUEUE
if ((mode == SM_QUEUE || mode == SM_DEFER || mode == SM_FORK ||
(mode != SM_VERIFY && SuperSafe)) &&
(!bitset(EF_INQUEUE, e->e_flags) || splitenv != NULL))
@@ -609,7 +609,7 @@ sendenvelope(e, mode)
bool didany;
if (tTd(13, 10))
- printf("sendenvelope(%s) e_flags=0x%x\n",
+ printf("sendenvelope(%s) e_flags=0x%lx\n",
e->e_id == NULL ? "[NOQUEUE]" : e->e_id,
e->e_flags);
#ifdef LOG
@@ -676,7 +676,7 @@ sendenvelope(e, mode)
{
extern int deliver __P((ENVELOPE *, ADDRESS *));
-# ifdef QUEUE
+# if QUEUE
/*
** Checkpoint the send list every few addresses
*/
@@ -847,7 +847,7 @@ deliver(e, firstto)
host = to->q_host;
CurEnv = e; /* just in case */
e->e_statmsg = NULL;
-#ifdef SMTP
+#if SMTP
SmtpError[0] = '\0';
#endif
xstart = curtime();
@@ -939,7 +939,7 @@ deliver(e, firstto)
if (*mvp == NULL)
{
/* running SMTP */
-# ifdef SMTP
+# if SMTP
clever = TRUE;
*pvp = NULL;
# else /* SMTP */
@@ -1231,7 +1231,7 @@ deliver(e, firstto)
else if (strcmp(m->m_mailer, "[IPC]") == 0 ||
strcmp(m->m_mailer, "[TCP]") == 0)
{
-#ifdef DAEMON
+#if DAEMON
register int i;
if (pv[0] == NULL || pv[1] == NULL || pv[1][0] == '\0')
@@ -1340,7 +1340,7 @@ tryhost:
mci_cache(mci);
if (TrafficLogFile != NULL)
fprintf(TrafficLogFile, "%05d === CONNECT %s\n",
- getpid(), hostbuf);
+ (int) getpid(), hostbuf);
break;
}
else
@@ -1385,7 +1385,7 @@ tryhost:
{
char **av;
- fprintf(TrafficLogFile, "%05d === EXEC", getpid());
+ fprintf(TrafficLogFile, "%05d === EXEC", (int) getpid());
for (av = pv; *av != NULL; av++)
fprintf(TrafficLogFile, " %s", *av);
fprintf(TrafficLogFile, "\n");
@@ -1440,7 +1440,7 @@ tryhost:
#endif
/* if this mailer speaks smtp, create a return pipe */
-#ifdef SMTP
+#if SMTP
if (clever)
{
if (pipe(rpvect) < 0)
@@ -1484,7 +1484,7 @@ tryhost:
shortenstring(e->e_to, 203), m->m_name);
(void) close(mpvect[0]);
(void) close(mpvect[1]);
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[0]);
@@ -1575,13 +1575,10 @@ tryhost:
new_ruid = stb.st_uid;
else if (ctladdr != NULL && ctladdr->q_uid != 0)
new_ruid = ctladdr->q_uid;
- else
- {
- if (m->m_uid == 0)
- new_ruid = DefUid;
- else
- new_ruid = m->m_uid;
- }
+ else if (m->m_uid != 0)
+ new_ruid = m->m_uid;
+ else if (!bitnset(M_SPECIFIC_UID, m->m_flags))
+ new_ruid = DefUid;
if (new_euid != NO_UID)
{
vendor_set_uid(new_euid);
@@ -1611,7 +1608,7 @@ tryhost:
if (tTd(11, 2))
printf("openmailer: running as r/euid=%d/%d\n",
- getuid(), geteuid());
+ (int) getuid(), (int) geteuid());
/* move into some "safe" directory */
if (m->m_execdir != NULL)
@@ -1636,7 +1633,7 @@ tryhost:
}
/* arrange to filter std & diag output of command */
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[0]);
@@ -1718,7 +1715,7 @@ tryhost:
syserr("deliver: cannot create mailer output channel, fd=%d",
mpvect[1]);
(void) close(mpvect[1]);
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[0]);
@@ -1728,7 +1725,7 @@ tryhost:
rcode = EX_OSERR;
goto give_up;
}
-#ifdef SMTP
+#if SMTP
if (clever)
{
(void) close(rpvect[1]);
@@ -1757,9 +1754,9 @@ tryhost:
*/
if (bitnset(M_7BITS, m->m_flags) &&
- (!clever || mci->mci_state == MCIS_CLOSED))
+ (!clever || mci->mci_state == MCIS_OPENING))
mci->mci_flags |= MCIF_7BIT;
-#ifdef SMTP
+#if SMTP
if (clever && mci->mci_state != MCIS_CLOSED)
{
extern void smtpinit __P((MAILER *, MCI *, ENVELOPE *));
@@ -1814,7 +1811,7 @@ tryhost:
mci_dump_all(TRUE);
rcode = EX_SOFTWARE;
}
-#ifdef DAEMON
+#if DAEMON
else if (curhost != NULL && *curhost != '\0')
{
/* try next MX site */
@@ -1836,7 +1833,7 @@ tryhost:
rcode = endmailer(mci, e, pv);
}
else
-#ifdef SMTP
+#if SMTP
{
extern int smtpmailfrom __P((MAILER *, MCI *, ENVELOPE *));
extern int smtprcpt __P((ADDRESS *, MAILER *, MCI *, ENVELOPE *));
@@ -1886,11 +1883,13 @@ tryhost:
rcode = smtpdata(m, mci, e);
}
}
+# if DAEMON
if (rcode == EX_TEMPFAIL && curhost != NULL && *curhost != '\0')
{
/* try next MX site */
goto tryhost;
}
+# endif
}
#else /* not SMTP */
{
@@ -1915,8 +1914,8 @@ tryhost:
*/
give_up:
-#ifdef SMTP
-# if FFR_LMTP
+#if SMTP
+# if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
{
tobuf[0] = '\0';
@@ -1933,8 +1932,8 @@ tryhost:
if (bitset(QBADADDR|QQUEUEUP, to->q_flags))
continue;
-#ifdef SMTP
-# if FFR_LMTP
+#if SMTP
+# if _FFR_LMTP
/* if running LMTP, get the status for each address */
if (bitnset(M_LMTP, m->m_flags))
{
@@ -1988,8 +1987,8 @@ tryhost:
}
}
-#ifdef SMTP
-# if FFR_LMTP
+#if SMTP
+# if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
{
/*
@@ -2013,7 +2012,7 @@ tryhost:
markstats(e, tochain);
mci_store_persistent(mci);
-#ifdef SMTP
+#if SMTP
/* now close the connection */
if (clever && mci->mci_state != MCIS_CLOSED &&
!bitset(MCIF_CACHED, mci->mci_flags))
@@ -2196,7 +2195,7 @@ endmailer(mci, e, pv)
if (mci->mci_pid == 0)
return (EX_OK);
-#ifdef FFR_TIMEOUT_WAIT
+#ifdef _FFR_TIMEOUT_WAIT
put a timeout around the wait
#endif
@@ -2309,7 +2308,7 @@ giveresponse(stat, m, mci, ctladdr, xstart, e)
statmsg = errstring(errno);
else
{
-#ifdef SMTP
+#if SMTP
statmsg = SmtpError;
#else /* SMTP */
statmsg = NULL;
@@ -2465,7 +2464,7 @@ logdelivery(m, mci, stat, ctladdr, xstart, e)
/* relay: max 66 bytes for IPv4 addresses */
if (mci != NULL && mci->mci_host != NULL)
{
-# ifdef DAEMON
+# if DAEMON
extern SOCKADDR CurHostAddr;
# endif
@@ -2473,7 +2472,7 @@ logdelivery(m, mci, stat, ctladdr, xstart, e)
shortenstring(mci->mci_host, 40));
bp += strlen(bp);
-# ifdef DAEMON
+# if DAEMON
if (CurHostAddr.sa.sa_family != 0)
{
snprintf(bp, SPACELEFT(buf, bp), " [%s]",
@@ -2584,14 +2583,14 @@ logdelivery(m, mci, stat, ctladdr, xstart, e)
bp = buf;
if (mci != NULL && mci->mci_host != NULL)
{
-# ifdef DAEMON
+# if DAEMON
extern SOCKADDR CurHostAddr;
# endif
snprintf(bp, SPACELEFT(buf, bp), "relay=%.100s", mci->mci_host);
bp += strlen(bp);
-# ifdef DAEMON
+# if DAEMON
if (CurHostAddr.sa.sa_family != 0)
snprintf(bp, SPACELEFT(buf, bp), " [%.100s]",
anynet_ntoa(&CurHostAddr));
@@ -2787,6 +2786,7 @@ putbody(mci, e, separator)
register char *bp;
register char *pbp;
register int c;
+ register char *xp;
int padc;
char *buflim;
int pos = 0;
@@ -2811,8 +2811,6 @@ putbody(mci, e, separator)
pbp = peekbuf;
while (!ferror(mci->mci_out))
{
- register char *xp;
-
if (pbp > peekbuf)
c = *--pbp;
else if ((c = getc(e->e_dfp)) == EOF)
@@ -2822,6 +2820,11 @@ putbody(mci, e, separator)
switch (ostate)
{
case OS_HEAD:
+#ifdef _FFR_NONULLS
+ if (c == '\0' &&
+ bitnset(M_NONULLS, mci->mci_mailer->m_flags))
+ break;
+#endif
if (c != '\r' && c != '\n' && bp < buflim)
{
*bp++ = c;
@@ -2856,7 +2859,8 @@ putbody(mci, e, separator)
/* now copy out saved line */
if (TrafficLogFile != NULL)
{
- fprintf(TrafficLogFile, "%05d >>> ", getpid());
+ fprintf(TrafficLogFile, "%05d >>> ",
+ (int) getpid());
if (padc != EOF)
putc(padc, TrafficLogFile);
for (xp = buf; xp < bp; xp++)
@@ -2921,6 +2925,11 @@ putbody(mci, e, separator)
ostate = OS_CR;
continue;
}
+#ifdef _FFR_NONULLS
+ if (c == '\0' &&
+ bitnset(M_NONULLS, mci->mci_mailer->m_flags))
+ break;
+#endif
putch:
if (mci->mci_mailer->m_linelimit > 0 &&
pos > mci->mci_mailer->m_linelimit &&
@@ -2937,11 +2946,23 @@ putch:
*pbp++ = c;
continue;
}
- if (TrafficLogFile != NULL)
- putc(c, TrafficLogFile);
- putc(c, mci->mci_out);
- pos++;
- ostate = c == '\n' ? OS_HEAD : OS_INLINE;
+ if (c == '\n')
+ {
+ if (TrafficLogFile != NULL)
+ fputs(mci->mci_mailer->m_eol,
+ TrafficLogFile);
+ fputs(mci->mci_mailer->m_eol, mci->mci_out);
+ pos = 0;
+ ostate = OS_HEAD;
+ }
+ else
+ {
+ if (TrafficLogFile != NULL)
+ putc(c, TrafficLogFile);
+ putc(c, mci->mci_out);
+ pos++;
+ ostate = OS_INLINE;
+ }
break;
}
}
@@ -2949,12 +2970,21 @@ putch:
/* make sure we are at the beginning of a line */
if (bp > buf)
{
- *bp = '\0';
- fputs(buf, mci->mci_out);
+ if (TrafficLogFile != NULL)
+ {
+ for (xp = buf; xp < bp; xp++)
+ putc(*xp, TrafficLogFile);
+ }
+ for (xp = buf; xp < bp; xp++)
+ putc(*xp, mci->mci_out);
pos += bp - buf;
}
if (pos > 0)
+ {
+ if (TrafficLogFile != NULL)
+ fputs(mci->mci_mailer->m_eol, TrafficLogFile);
fputs(mci->mci_mailer->m_eol, mci->mci_out);
+ }
}
if (ferror(e->e_dfp))
diff --git a/usr.sbin/sendmail/src/headers.c b/usr.sbin/sendmail/src/headers.c
index 6ab97e4..7ae2acf 100644
--- a/usr.sbin/sendmail/src/headers.c
+++ b/usr.sbin/sendmail/src/headers.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)headers.c 8.100 (Berkeley) 9/15/96";
+static char sccsid[] = "@(#)headers.c 8.101 (Berkeley) 11/23/96";
#endif /* not lint */
# include <errno.h>
@@ -1267,8 +1267,14 @@ put_vanilla_header(h, v, mci)
{
register char *nlp;
register char *obp;
+ int putflags;
char obuf[MAXLINE];
+ putflags = 0;
+#ifdef _FFR_7BITHDRS
+ if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
+ putflags |= PXLF_STRIP8BIT;
+#endif
(void) snprintf(obuf, sizeof obuf, "%.200s: ", h->h_field);
obp = obuf + strlen(obuf);
while ((nlp = strchr(v, '\n')) != NULL)
@@ -1280,7 +1286,7 @@ put_vanilla_header(h, v, mci)
l = sizeof obuf - (obp - obuf);
snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v);
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
v += l + 1;
obp = obuf;
if (*v != ' ' && *v != '\t')
@@ -1288,7 +1294,7 @@ put_vanilla_header(h, v, mci)
}
snprintf(obp, SPACELEFT(obuf, obp), "%.*s",
sizeof obuf - (obp - obuf) - 1, v);
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
}
/*
** COMMAIZE -- output a header field, making a comma-translated list.
@@ -1319,6 +1325,7 @@ commaize(h, p, oldstyle, mci, e)
int opos;
int omax;
bool firstone = TRUE;
+ int putflags = 0;
char obuf[MAXLINE + 3];
/*
@@ -1329,6 +1336,11 @@ commaize(h, p, oldstyle, mci, e)
if (tTd(14, 2))
printf("commaize(%s: %s)\n", h->h_field, p);
+#ifdef _FFR_7BITHDRS
+ if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
+ putflags |= PXLF_STRIP8BIT;
+#endif
+
obp = obuf;
(void) snprintf(obp, SPACELEFT(obuf, obp), "%.200s: ", h->h_field);
opos = strlen(h->h_field) + 2;
@@ -1425,7 +1437,7 @@ commaize(h, p, oldstyle, mci, e)
if (opos > omax && !firstone)
{
snprintf(obp, SPACELEFT(obuf, obp), ",\n");
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
obp = obuf;
(void) strcpy(obp, " ");
opos = strlen(obp);
@@ -1444,7 +1456,7 @@ commaize(h, p, oldstyle, mci, e)
*p = savechar;
}
*obp = '\0';
- putline(obuf, mci);
+ putxline(obuf, mci, putflags);
}
/*
** COPYHEADER -- copy header list
diff --git a/usr.sbin/sendmail/src/main.c b/usr.sbin/sendmail/src/main.c
index 9da0e32..1b68be1 100644
--- a/usr.sbin/sendmail/src/main.c
+++ b/usr.sbin/sendmail/src/main.c
@@ -39,7 +39,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.215 (Berkeley) 11/16/96";
+static char sccsid[] = "@(#)main.c 8.223 (Berkeley) 12/1/96";
#endif /* not lint */
#define _DEFINE
@@ -103,11 +103,12 @@ static void obsolete();
extern void printmailer __P((MAILER *));
extern void tTflag __P((char *));
-#ifdef DAEMON
-#ifndef SMTP
-ERROR %%%% Cannot have daemon mode without SMTP %%%% ERROR
-#endif /* SMTP */
-#endif /* DAEMON */
+#if DAEMON && !SMTP
+ERROR %%%% Cannot have DAEMON mode without SMTP %%%% ERROR
+#endif /* DAEMON && !SMTP */
+#if SMTP && !QUEUE
+ERROR %%%% Cannot have SMTP mode without QUEUE %%%% ERROR
+#endif /* DAEMON && !SMTP */
#define MAXCONFIGLEVEL 7 /* highest config version level known */
@@ -134,7 +135,7 @@ main(argc, argv, envp)
struct passwd *pw;
struct stat stb;
struct hostent *hp;
- bool nullserver;
+ bool nullserver = FALSE;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
static char rnamebuf[MAXNAME]; /* holds RealUserName */
char *emptyenviron[1];
@@ -519,13 +520,13 @@ main(argc, argv, envp)
{
case MD_DAEMON:
case MD_FGDAEMON:
-# ifndef DAEMON
+# if !DAEMON
usrerr("Daemon mode not implemented");
ExitStat = EX_USAGE;
break;
# endif /* DAEMON */
case MD_SMTP:
-# ifndef SMTP
+# if !SMTP
usrerr("I don't speak SMTP");
ExitStat = EX_USAGE;
break;
@@ -653,7 +654,7 @@ main(argc, argv, envp)
break;
case 'q': /* run queue files at intervals */
-# ifdef QUEUE
+# if QUEUE
FullName = NULL;
queuemode = TRUE;
switch (optarg[0])
@@ -949,7 +950,8 @@ main(argc, argv, envp)
default:
/* arrange to exit cleanly on hangup signal */
- setsignal(SIGHUP, intsig);
+ if (setsignal(SIGHUP, SIG_IGN) == (sigfunc_t) SIG_DFL)
+ setsignal(SIGHUP, intsig);
break;
}
@@ -1046,10 +1048,6 @@ main(argc, argv, envp)
setbitn(M_RUNASRCPT, ProgMailer->m_flags);
if (FileMailer != NULL)
setbitn(M_RUNASRCPT, FileMailer->m_flags);
-
- /* propogate some envariables into children */
- setuserenv("ISP", NULL);
- setuserenv("SYSTYPE", NULL);
}
if (ConfigLevel < 7)
{
@@ -1104,7 +1102,7 @@ main(argc, argv, envp)
HostStatDir = NULL;
}
-# ifdef QUEUE
+# if QUEUE
if (queuemode && RealUid != 0 && bitset(PRIV_RESTRICTQRUN, PrivacyFlags))
{
struct stat stbuf;
@@ -1141,7 +1139,7 @@ main(argc, argv, envp)
{
case MD_PRINT:
/* print the queue */
-#ifdef QUEUE
+#if QUEUE
dropenvelope(CurEnv, TRUE);
printqueue();
endpwent();
@@ -1247,7 +1245,7 @@ main(argc, argv, envp)
}
}
-# ifdef QUEUE
+# if QUEUE
/*
** If collecting stuff from the queue, go start doing that.
*/
@@ -1255,7 +1253,7 @@ main(argc, argv, envp)
if (queuemode && OpMode != MD_DAEMON && QueueIntvl == 0)
{
(void) unsetenv("HOSTALIASES");
- runqueue(FALSE);
+ (void) runqueue(FALSE, Verbose);
finis();
}
# endif /* QUEUE */
@@ -1305,10 +1303,10 @@ main(argc, argv, envp)
xla_create_file();
#endif
-# ifdef QUEUE
+# if QUEUE
if (queuemode)
{
- runqueue(TRUE);
+ (void) runqueue(TRUE, FALSE);
if (OpMode != MD_DAEMON)
for (;;)
pause();
@@ -1316,7 +1314,7 @@ main(argc, argv, envp)
# endif /* QUEUE */
dropenvelope(CurEnv, TRUE);
-#ifdef DAEMON
+#if DAEMON
nullserver = getrequests(CurEnv);
/* drop privileges */
@@ -1337,7 +1335,7 @@ main(argc, argv, envp)
#endif /* DAEMON */
}
-# ifdef SMTP
+# if SMTP
/*
** If running SMTP protocol, start collecting and executing
** commands. This will never return.
@@ -1651,8 +1649,8 @@ disconnect(droplev, e)
int fd;
if (tTd(52, 1))
- printf("disconnect: In %d Out %d, e=%x\n",
- fileno(InChannel), fileno(OutChannel), e);
+ printf("disconnect: In %d Out %d, e=%lx\n",
+ fileno(InChannel), fileno(OutChannel), (u_long) e);
if (tTd(52, 100))
{
printf("don't\n");
@@ -1956,6 +1954,14 @@ sigusr1()
void
sighup()
{
+ if (SaveArgv[0][0] != '/')
+ {
+#ifdef LOG
+ if (LogLevel > 3)
+ syslog(LOG_INFO, "could not restart: need full path");
+#endif
+ exit(EX_OSFILE);
+ }
#ifdef LOG
if (LogLevel > 3)
syslog(LOG_INFO, "restarting %s on signal", SaveArgv[0]);
diff --git a/usr.sbin/sendmail/src/mime.c b/usr.sbin/sendmail/src/mime.c
index 9ee726a..bdb91a2 100644
--- a/usr.sbin/sendmail/src/mime.c
+++ b/usr.sbin/sendmail/src/mime.c
@@ -36,7 +36,7 @@
# include <string.h>
#ifndef lint
-static char sccsid[] = "@(#)mime.c 8.49 (Berkeley) 10/30/96";
+static char sccsid[] = "@(#)mime.c 8.51 (Berkeley) 11/24/96";
#endif /* not lint */
/*
@@ -450,7 +450,7 @@ mime8to7(mci, header, e, boundaries, flags)
if (tTd(43, 8))
{
printf("mime8to7: %ld high bit(s) in %ld byte(s), cte=%s, type=%s/%s\n",
- sectionhighbits, sectionsize,
+ (long) sectionhighbits, (long) sectionsize,
cte == NULL ? "[none]" : cte,
type == NULL ? "[none]" : type,
subtype == NULL ? "[none]" : subtype);
@@ -959,7 +959,7 @@ mime7to8(mci, header, e)
char *cte;
char **pvp;
u_char *obp;
- u_char ch, *fbufp, *obufp;
+ u_char *fbufp;
char buf[MAXLINE];
u_char obuf[MAXLINE + 1];
u_char fbuf[MAXLINE + 1];
@@ -1010,7 +1010,6 @@ mime7to8(mci, header, e)
if (strcasecmp(cte, "base64") == 0)
{
- int nchar = 0;
int c1, c2, c3, c4;
fbufp = fbuf;
diff --git a/usr.sbin/sendmail/src/parseaddr.c b/usr.sbin/sendmail/src/parseaddr.c
index 3b466f9..a10c329 100644
--- a/usr.sbin/sendmail/src/parseaddr.c
+++ b/usr.sbin/sendmail/src/parseaddr.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)parseaddr.c 8.114 (Berkeley) 9/20/96";
+static char sccsid[] = "@(#)parseaddr.c 8.115 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -1045,7 +1045,7 @@ rewrite(pvp, ruleset, reclevel, e)
pp = m->first;
while (pp <= m->last)
{
- printf(" %x=\"", *pp);
+ printf(" %lx=\"", (u_long) *pp);
(void) fflush(stdout);
printf("%s\"", *pp++);
}
@@ -1873,7 +1873,7 @@ printaddr(a, follow)
while (a != NULL)
{
- printf("%x=", a);
+ printf("%lx=", (u_long) a);
(void) fflush(stdout);
/* find the mailer -- carefully */
@@ -1892,8 +1892,9 @@ printaddr(a, follow)
printf("\tuser `%s', ruser `%s'\n",
a->q_user,
a->q_ruser == NULL ? "<null>" : a->q_ruser);
- printf("\tnext=%x, alias %x, uid %d, gid %d\n",
- a->q_next, a->q_alias, a->q_uid, a->q_gid);
+ printf("\tnext=%lx, alias %lx, uid %d, gid %d\n",
+ (u_long) a->q_next, (u_long) a->q_alias,
+ (int) a->q_uid, (int) a->q_gid);
printf("\tflags=%lx<", a->q_flags);
firstone = TRUE;
for (qfp = AddressFlags; qfp->qf_name != NULL; qfp++)
diff --git a/usr.sbin/sendmail/src/readcf.c b/usr.sbin/sendmail/src/readcf.c
index 9313f0f..9e2c156 100644
--- a/usr.sbin/sendmail/src/readcf.c
+++ b/usr.sbin/sendmail/src/readcf.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)readcf.c 8.176 (Berkeley) 11/10/96";
+static char sccsid[] = "@(#)readcf.c 8.181 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -1298,7 +1298,7 @@ printmailer(m)
m->m_mno, m->m_name,
m->m_mailer, m->m_se_rwset, m->m_sh_rwset,
m->m_re_rwset, m->m_rh_rwset, m->m_maxsize,
- m->m_uid, m->m_gid);
+ (int) m->m_uid, (int) m->m_gid);
for (j = '\0'; j <= '\177'; j++)
if (bitnset(j, m->m_flags))
(void) putchar(j);
@@ -1423,7 +1423,7 @@ struct optioninfo
{ "DefaultUser", 'u', FALSE },
{ "FallbackMXhost", 'V', FALSE },
{ "Verbose", 'v', TRUE },
- { "TryNullMXList", 'w', TRUE },
+ { "TryNullMXList", 'w', FALSE },
{ "QueueLA", 'x', FALSE },
{ "RefuseLA", 'X', FALSE },
{ "RecipientFactor", 'y', FALSE },
@@ -1465,7 +1465,7 @@ struct optioninfo
#define O_OPCHARS 0x92
{ "OperatorChars", O_OPCHARS, FALSE },
#define O_DONTINITGRPS 0x93
- { "DontInitGroups", O_DONTINITGRPS, TRUE },
+ { "DontInitGroups", O_DONTINITGRPS, FALSE },
#define O_SLFH 0x94
{ "SingleLineFromHeader", O_SLFH, TRUE },
#define O_ABH 0x95
@@ -1728,7 +1728,7 @@ setoption(opt, val, safe, sticky, e)
case SM_QUEUE: /* queue only */
case SM_DEFER: /* queue only and defer map lookups */
-#ifndef QUEUE
+#if !QUEUE
syserr("need QUEUE to set -odqueue or -oddefer");
#endif /* QUEUE */
/* fall through..... */
@@ -1849,7 +1849,7 @@ setoption(opt, val, safe, sticky, e)
}
if (tTd(8, 2))
printf("_res.options = %x, HasWildcardMX = %d\n",
- _res.options, HasWildcardMX);
+ (u_int) _res.options, HasWildcardMX);
#else
usrerr("name server (I option) specified but BIND not compiled in");
#endif
@@ -1906,7 +1906,7 @@ setoption(opt, val, safe, sticky, e)
/* 'N' available -- was "net name" */
case 'O': /* daemon options */
-#ifdef DAEMON
+#if DAEMON
setdaemonoptions(val);
#else
syserr("DaemonPortOptions (O option) set but DAEMON not compiled in");
diff --git a/usr.sbin/sendmail/src/recipient.c b/usr.sbin/sendmail/src/recipient.c
index dae5156..92e6bc3 100644
--- a/usr.sbin/sendmail/src/recipient.c
+++ b/usr.sbin/sendmail/src/recipient.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)recipient.c 8.116 (Berkeley) 8/17/96";
+static char sccsid[] = "@(#)recipient.c 8.118 (Berkeley) 12/1/96";
#endif /* not lint */
# include "sendmail.h"
@@ -474,8 +474,8 @@ recipient(a, sendq, aliaslevel, e)
if (tTd(29, 5))
{
- printf("recipient: testing local? cl=%d, rr5=%x\n\t",
- ConfigLevel, RewriteRules[5]);
+ printf("recipient: testing local? cl=%d, rr5=%lx\n\t",
+ ConfigLevel, (u_long) RewriteRules[5]);
printaddr(a, FALSE);
}
if (!bitset(QNOTREMOTE|QDONTSEND|QQUEUEUP|QVERIFIED, a->q_flags) &&
@@ -601,7 +601,7 @@ recipient(a, sendq, aliaslevel, e)
if (aliaslevel == 0)
{
int nrcpts = 0;
- ADDRESS *only;
+ ADDRESS *only = NULL;
for (q = *sendq; q != NULL; q = q->q_next)
{
@@ -907,7 +907,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
volatile gid_t savedgid, gid;
char *volatile uname;
int rval = 0;
- int sfflags = SFF_REGONLY;
+ volatile int sfflags = SFF_REGONLY;
struct stat st;
char buf[MAXLINE];
#ifdef _POSIX_CHOWN_RESTRICTED
@@ -932,7 +932,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
if (tTd(27, 2))
printf("include(%s)\n", fname);
if (tTd(27, 4))
- printf(" ruid=%d euid=%d\n", getuid(), geteuid());
+ printf(" ruid=%d euid=%d\n", (int) getuid(), (int) geteuid());
if (tTd(27, 14))
{
printf("ctladdr ");
@@ -940,7 +940,8 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
}
if (tTd(27, 9))
- printf("include: old uid = %d/%d\n", getuid(), geteuid());
+ printf("include: old uid = %d/%d\n",
+ (int) getuid(), (int) geteuid());
if (forwarding)
sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOSLINK;
@@ -985,7 +986,8 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
#endif
if (tTd(27, 9))
- printf("include: new uid = %d/%d\n", getuid(), geteuid());
+ printf("include: new uid = %d/%d\n",
+ (int) getuid(), (int) geteuid());
/*
** If home directory is remote mounted but server is down,
@@ -1013,7 +1015,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
/* don't use this :include: file */
if (tTd(27, 4))
printf("include: not safe (uid=%d): %s\n",
- uid, errstring(rval));
+ (int) uid, errstring(rval));
}
else
{
@@ -1053,7 +1055,8 @@ resetuid:
#endif
if (tTd(27, 9))
- printf("include: reset uid = %d/%d\n", getuid(), geteuid());
+ printf("include: reset uid = %d/%d\n",
+ (int) getuid(), (int) geteuid());
if (rval == EOPENTIMEOUT)
usrerr("451 open timeout on %s", fname);
@@ -1083,7 +1086,7 @@ resetuid:
ctladdr->q_flags |= ca->q_flags & QBOGUSSHELL;
ctladdr->q_ruser = ca->q_ruser;
}
- else
+ else if (!forwarding)
{
register struct passwd *pw;
diff --git a/usr.sbin/sendmail/src/savemail.c b/usr.sbin/sendmail/src/savemail.c
index baa1a04..9fb1c24 100644
--- a/usr.sbin/sendmail/src/savemail.c
+++ b/usr.sbin/sendmail/src/savemail.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.100 (Berkeley) 9/27/96";
+static char sccsid[] = "@(#)savemail.c 8.101 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -481,8 +481,8 @@ returntosender(msg, returnq, flags, e)
if (tTd(6, 1))
{
- printf("\n*** Return To Sender: msg=\"%s\", depth=%d, e=%x, returnq=",
- msg, returndepth, e);
+ printf("\n*** Return To Sender: msg=\"%s\", depth=%d, e=%lx, returnq=",
+ msg, returndepth, (u_long) e);
printaddr(returnq, TRUE);
if (tTd(6, 20))
{
diff --git a/usr.sbin/sendmail/src/sendmail.h b/usr.sbin/sendmail/src/sendmail.h
index 2dc30e4..6aba9ab 100644
--- a/usr.sbin/sendmail/src/sendmail.h
+++ b/usr.sbin/sendmail/src/sendmail.h
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)sendmail.h 8.209 (Berkeley) 11/8/96
+ * @(#)sendmail.h 8.216 (Berkeley) 12/1/96
*/
/*
@@ -41,7 +41,7 @@
# ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.209 11/8/96";
+static char SmailSccsId[] = "@(#)sendmail.h 8.216 12/1/96";
# endif
# else /* _DEFINE */
# define EXTERN extern
@@ -68,7 +68,7 @@ static char SmailSccsId[] = "@(#)sendmail.h 8.209 11/8/96";
# include <syslog.h>
# endif /* LOG */
-# ifdef DAEMON
+# if NETINET || NETUNIX || NETISO || NETNS || NETX25
# include <sys/socket.h>
# endif
# if NETUNIX
@@ -277,8 +277,10 @@ struct mailer
# define M_XDOT 'X' /* use hidden-dot algorithm */
# define M_LMTP 'z' /* run Local Mail Transport Protocol */
# define M_NOMX '0' /* turn off MX lookups */
+# define M_NONULLS '1' /* don't send null bytes */
# define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
# define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
+# define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
# define M_7BITS '7' /* use 7-bit path */
# define M_8BITS '8' /* force "just send 8" behaviour */
# define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */
@@ -984,7 +986,7 @@ extern int safefile __P((char *, UID_T, GID_T, char *, int, int, struct stat *))
** we are forced to declare a supertype here.
*/
-#ifdef DAEMON
+# if NETINET || NETUNIX || NETISO || NETNS || NETX25
union bigsockaddr
{
struct sockaddr sa; /* general version */
@@ -1011,6 +1013,9 @@ EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */
extern char *hostnamebyanyaddr __P((SOCKADDR *));
extern char *anynet_ntoa __P((SOCKADDR *));
+# if DAEMON
+extern bool validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
+# endif
#endif
@@ -1160,6 +1165,7 @@ EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */
EXTERN bool UserSubmission; /* initial (user) mail submission */
EXTERN uid_t RunAsUid; /* UID to become for bulk of run */
EXTERN gid_t RunAsGid; /* GID to become for bulk of run */
+EXTERN bool IgnoreHostStatus; /* ignore long term host status files */
EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */
EXTERN bool UnsafeGroupWrites; /* group-writable files are unsafe */
EXTERN bool SingleLineFromHeader; /* force From: header to be one line */
@@ -1315,6 +1321,7 @@ extern void shorten_hostname __P((char []));
extern int waitfor __P((pid_t));
extern void proc_list_add __P((pid_t));
extern void proc_list_drop __P((pid_t));
+extern void proc_list_clear __P((void));
extern void buffer_errors __P((void));
extern void flush_errors __P((bool));
extern void putline __P((char *, MCI *));
@@ -1336,7 +1343,7 @@ extern void stripquotes __P((char *));
extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
extern void unlockqueue __P((ENVELOPE *));
extern void xunlink __P((char *));
-extern void runqueue __P((bool));
+extern bool runqueue __P((bool, bool));
extern int getla __P((void));
extern void sendall __P((ENVELOPE *, int));
extern void queueup __P((ENVELOPE *, bool));
@@ -1349,12 +1356,12 @@ extern int mailfile __P((char *, ADDRESS *, int, ENVELOPE *));
extern void loseqfile __P((ENVELOPE *, char *));
extern int prog_open __P((char **, int *, ENVELOPE *));
extern bool getcanonname __P((char *, int, bool));
-extern bool validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
extern bool path_is_dir __P((char *, bool));
extern pid_t dowork __P((char *, bool, bool, ENVELOPE *));
extern const char *errstring __P((int));
extern sigfunc_t setsignal __P((int, sigfunc_t));
+extern int blocksignal __P((int));
extern int releasesignal __P((int));
extern struct hostent *sm_gethostbyname __P((char *));
extern struct hostent *sm_gethostbyaddr __P((char *, int, int));
diff --git a/usr.sbin/sendmail/src/srvrsmtp.c b/usr.sbin/sendmail/src/srvrsmtp.c
index 9c78859..fcc1e94 100644
--- a/usr.sbin/sendmail/src/srvrsmtp.c
+++ b/usr.sbin/sendmail/src/srvrsmtp.c
@@ -35,16 +35,16 @@
# include "sendmail.h"
#ifndef lint
-#ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.125 (Berkeley) 11/8/96 (with SMTP)";
+#if SMTP
+static char sccsid[] = "@(#)srvrsmtp.c 8.131 (Berkeley) 12/1/96 (with SMTP)";
#else
-static char sccsid[] = "@(#)srvrsmtp.c 8.125 (Berkeley) 11/8/96 (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.131 (Berkeley) 12/1/96 (without SMTP)";
#endif
#endif /* not lint */
# include <errno.h>
-# ifdef SMTP
+# if SMTP
/*
** SMTP -- run the SMTP protocol.
@@ -128,7 +128,7 @@ smtp(nullserver, e)
bool nullserver;
register ENVELOPE *volatile e;
{
- register char *p;
+ register char *volatile p;
register struct cmd *c;
char *cmd;
auto ADDRESS *vrfyqueue;
@@ -146,6 +146,7 @@ smtp(nullserver, e)
volatile int badcommands = 0; /* count of bad commands */
volatile int nverifies = 0; /* count of VRFY/EXPN commands */
volatile int n_etrn = 0; /* count of ETRN commands */
+ bool ok;
char inp[MAXLINE];
char cmdbuf[MAXLINE];
extern ENVELOPE BlankEnvelope;
@@ -169,7 +170,7 @@ smtp(nullserver, e)
CurSmtpClient = CurHostName;
setproctitle("server %s startup", CurSmtpClient);
-#ifdef LOG
+#if defined(LOG) && DAEMON
if (LogLevel > 11)
{
/* log connection information */
@@ -880,9 +881,10 @@ smtp(nullserver, e)
shortenstring(id, 203));
#endif
QueueLimitRecipient = id;
- runqueue(TRUE);
+ ok = runqueue(TRUE, TRUE);
QueueLimitRecipient = NULL;
- message("250 Queuing for node %s started", p);
+ if (ok)
+ message("250 Queuing for node %s started", p);
break;
case CMDHELP: /* help -- give user info */
@@ -929,7 +931,7 @@ doquit:
message("250 Initial submission");
break;
-# ifdef SMTPDEBUG
+# if SMTPDEBUG
case CMDDBGQSHOW: /* show queues */
printf("Send Queue=");
printaddr(e->e_sendqueue, TRUE);
@@ -1271,23 +1273,21 @@ runinchild(label, e)
register ENVELOPE *e;
{
pid_t childpid;
- sigfunc_t chldsig;
if (!OneXact)
{
/*
** Disable child process reaping, in case ETRN has preceeded
- ** MAIL command.
+ ** MAIL command, and then fork.
*/
-#ifdef SIGCHLD
- chldsig = setsignal(SIGCHLD, SIG_IGN);
-#endif
+ (void) blocksignal(SIGCHLD);
childpid = dofork();
if (childpid < 0)
{
syserr("451 %s: cannot fork", label);
+ (void) releasesignal(SIGCHLD);
return (1);
}
if (childpid > 0)
@@ -1310,10 +1310,8 @@ runinchild(label, e)
finis();
}
-#ifdef SIGCHLD
/* restore the child signal */
- (void) setsignal(SIGCHLD, chldsig);
-#endif
+ (void) releasesignal(SIGCHLD);
return (1);
}
@@ -1323,6 +1321,8 @@ runinchild(label, e)
InChild = TRUE;
QuickAbort = FALSE;
clearenvelope(e, FALSE);
+ (void) setsignal(SIGCHLD, SIG_DFL);
+ (void) releasesignal(SIGCHLD);
}
}
diff --git a/usr.sbin/sendmail/src/udb.c b/usr.sbin/sendmail/src/udb.c
index 075f197..8e52303 100644
--- a/usr.sbin/sendmail/src/udb.c
+++ b/usr.sbin/sendmail/src/udb.c
@@ -36,9 +36,9 @@
#ifndef lint
#if USERDB
-static char sccsid [] = "@(#)udb.c 8.42 (Berkeley) 9/18/96 (with USERDB)";
+static char sccsid [] = "@(#)udb.c 8.46 (Berkeley) 12/1/96 (with USERDB)";
#else
-static char sccsid [] = "@(#)udb.c 8.42 (Berkeley) 9/18/96 (without USERDB)";
+static char sccsid [] = "@(#)udb.c 8.46 (Berkeley) 12/1/96 (without USERDB)";
#endif
#endif
@@ -210,6 +210,7 @@ udbexpand(a, sendq, aliaslevel, e)
#endif
user = userbuf;
+ userbuf[0] = '\0';
usersize = sizeof userbuf;
userleft = sizeof userbuf - 1;
@@ -240,7 +241,8 @@ udbexpand(a, sendq, aliaslevel, e)
}
if (tTd(28, 80))
printf("udbexpand: match %.*s: %.*s\n",
- key.size, key.data, info.size, info.data);
+ (int) key.size, (char *) key.data,
+ (int) info.size, (char *) info.data);
a->q_flags &= ~QSELFREF;
while (i == 0 && key.size == keylen &&
@@ -272,7 +274,7 @@ udbexpand(a, sendq, aliaslevel, e)
*p++ = ',';
userleft--;
}
- bcopy(info.data, user, info.size);
+ bcopy(info.data, p, info.size);
user[info.size] = '\0';
userleft -= info.size;
@@ -817,6 +819,7 @@ _udbx_init()
{
char *spec;
int nopts;
+ int l;
# if 0
auto int rcode;
int nmx;
@@ -934,9 +937,20 @@ _udbx_init()
#ifdef NEWDB
case '/': /* look up remote name */
- up->udb_dbname = spec;
+ l = strlen(spec);
+ if (l > 3 && strcmp(&spec[l - 3], ".db") == 0)
+ {
+ up->udb_dbname = spec;
+ }
+ else
+ {
+ up->udb_dbname = xalloc(l + 4);
+ strcpy(up->udb_dbname, spec);
+ strcat(up->udb_dbname, ".db");
+ }
errno = 0;
- up->udb_dbp = dbopen(spec, O_RDONLY, 0644, DB_BTREE, NULL);
+ up->udb_dbp = dbopen(up->udb_dbname, O_RDONLY,
+ 0644, DB_BTREE, NULL);
if (up->udb_dbp == NULL)
{
if (tTd(28, 1))
@@ -944,7 +958,8 @@ _udbx_init()
int saveerrno = errno;
printf("dbopen(%s): %s",
- spec, errstring(errno));
+ up->udb_dbname,
+ errstring(errno));
errno = saveerrno;
}
if (errno != ENOENT && errno != EACCES)
@@ -952,11 +967,16 @@ _udbx_init()
#ifdef LOG
if (LogLevel > 2)
syslog(LOG_ERR, "dbopen(%s): %s",
- spec, errstring(errno));
+ up->udb_dbname,
+ errstring(errno));
#endif
up->udb_type = UDB_EOLIST;
+ if (up->udb_dbname != spec)
+ free(up->udb_dbname);
goto tempfail;
}
+ if (up->udb_dbname != spec)
+ free(up->udb_dbname);
break;
}
up->udb_type = UDB_DBFETCH;
@@ -978,7 +998,7 @@ badspec:
{
switch (up->udb_type)
{
-#ifdef DAEMON
+#if DAEMON
case UDB_REMOTE:
printf("REMOTE: addr %s, timeo %d\n",
anynet_ntoa((SOCKADDR *) &up->udb_addr),
diff --git a/usr.sbin/sendmail/src/usersmtp.c b/usr.sbin/sendmail/src/usersmtp.c
index 9724859..af6adc2 100644
--- a/usr.sbin/sendmail/src/usersmtp.c
+++ b/usr.sbin/sendmail/src/usersmtp.c
@@ -35,17 +35,17 @@
# include "sendmail.h"
#ifndef lint
-#ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.75 (Berkeley) 11/6/96 (with SMTP)";
+#if SMTP
+static char sccsid[] = "@(#)usersmtp.c 8.79 (Berkeley) 12/1/96 (with SMTP)";
#else
-static char sccsid[] = "@(#)usersmtp.c 8.75 (Berkeley) 11/6/96 (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 8.79 (Berkeley) 12/1/96 (without SMTP)";
#endif
#endif /* not lint */
# include <sysexits.h>
# include <errno.h>
-# ifdef SMTP
+# if SMTP
/*
** USERSMTP -- run SMTP protocol from the user end.
@@ -155,7 +155,7 @@ smtpinit(m, mci, e)
** My mother taught me to always introduce myself.
*/
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitnset(M_ESMTP, m->m_flags) || bitnset(M_LMTP, m->m_flags))
#else
if (bitnset(M_ESMTP, m->m_flags))
@@ -163,7 +163,7 @@ smtpinit(m, mci, e)
mci->mci_flags |= MCIF_ESMTP;
tryhelo:
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
{
smtpmessage("LHLO %s", m, mci, MyHostName);
@@ -188,7 +188,7 @@ tryhelo:
goto tempfail1;
else if (REPLYTYPE(r) == 5)
{
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitset(MCIF_ESMTP, mci->mci_flags) &&
!bitnset(M_LMTP, m->m_flags))
#else
@@ -214,7 +214,7 @@ tryhelo:
if (p != NULL)
*p = '\0';
if (!bitnset(M_NOLOOPCHECK, m->m_flags) &&
-#if FFR_LMTP
+#if _FFR_LMTP
!bitnset(M_LMTP, m->m_flags) &&
#endif
strcasecmp(&SmtpReplyBuffer[4], MyHostName) == 0)
@@ -418,7 +418,7 @@ smtpmailfrom(m, mci, e)
extern char MsgBuf[];
usrerr("%s does not support 8BITMIME", mci->mci_host);
- mci_setstat(mci, EX_DATAERR, "5.6.3", MsgBuf);
+ mci_setstat(mci, EX_NOTSTICKY, "5.6.3", MsgBuf);
return EX_DATAERR;
}
@@ -505,25 +505,25 @@ smtpmailfrom(m, mci, e)
else if (r == 501)
{
/* syntax error in arguments */
- mci_setstat(mci, EX_DATAERR, "5.5.2", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.5.2", SmtpReplyBuffer);
return EX_DATAERR;
}
else if (r == 553)
{
/* mailbox name not allowed */
- mci_setstat(mci, EX_DATAERR, "5.1.3", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.1.3", SmtpReplyBuffer);
return EX_DATAERR;
}
else if (r == 552)
{
/* exceeded storage allocation */
- mci_setstat(mci, EX_UNAVAILABLE, "5.2.2", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.2.2", SmtpReplyBuffer);
return EX_UNAVAILABLE;
}
else if (REPLYTYPE(r) == 5)
{
/* unknown error */
- mci_setstat(mci, EX_UNAVAILABLE, "5.0.0", SmtpReplyBuffer);
+ mci_setstat(mci, EX_NOTSTICKY, "5.0.0", SmtpReplyBuffer);
return EX_UNAVAILABLE;
}
@@ -654,6 +654,7 @@ smtprcpt(to, m, mci, e)
}
#endif
+ mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
return EX_PROTOCOL;
}
/*
@@ -719,6 +720,7 @@ smtpdata(m, mci, e)
}
#endif
smtprset(m, mci, e);
+ mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
return (EX_PROTOCOL);
}
@@ -770,14 +772,14 @@ smtpdata(m, mci, e)
/* terminate the message */
fprintf(mci->mci_out, ".%s", m->m_eol);
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> .\n", getpid());
+ fprintf(TrafficLogFile, "%05d >>> .\n", (int) getpid());
if (Verbose)
nmessage(">>> .");
/* check for the results of the transaction */
SmtpPhase = mci->mci_phase = "client DATA status";
setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
-#if FFR_LMTP
+#if _FFR_LMTP
if (bitnset(M_LMTP, m->m_flags))
return EX_OK;
#endif
@@ -833,7 +835,7 @@ datatimeout()
** The exit status corresponding to the reply code.
*/
-#if FFR_LMTP
+#if _FFR_LMTP
int
smtpgetstat(m, mci, e)
@@ -1183,7 +1185,8 @@ smtpmessage(f, m, mci, va_alist)
if (tTd(18, 1) || Verbose)
nmessage(">>> %s", SmtpMsgBuffer);
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(), SmtpMsgBuffer);
+ fprintf(TrafficLogFile, "%05d >>> %s\n",
+ (int) getpid(), SmtpMsgBuffer);
if (mci->mci_out != NULL)
{
fprintf(mci->mci_out, "%s%s", SmtpMsgBuffer,
diff --git a/usr.sbin/sendmail/src/util.c b/usr.sbin/sendmail/src/util.c
index c3eb822..0eee2f2 100644
--- a/usr.sbin/sendmail/src/util.c
+++ b/usr.sbin/sendmail/src/util.c
@@ -33,7 +33,7 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)util.c 8.109 (Berkeley) 11/16/96";
+static char sccsid[] = "@(#)util.c 8.113 (Berkeley) 11/24/96";
#endif /* not lint */
# include "sendmail.h"
@@ -215,7 +215,7 @@ printav(av)
while (*av != NULL)
{
if (tTd(0, 44))
- printf("\n\t%08x=", *av);
+ printf("\n\t%08lx=", (u_long) *av);
else
(void) putchar(' ');
xputs(*av++);
@@ -423,7 +423,6 @@ buildfname(gecos, login, buf, buflen)
{
register char *p;
register char *bp = buf;
- int l;
if (*gecos == '*')
gecos++;
@@ -507,7 +506,7 @@ safefile(fn, uid, gid, uname, flags, mode, st)
if (tTd(44, 4))
printf("safefile(%s, uid=%d, gid=%d, flags=%x, mode=%o):\n",
- fn, uid, gid, flags, mode);
+ fn, (int) uid, (int) gid, flags, mode);
errno = 0;
if (st == NULL)
st = &fstbuf;
@@ -635,8 +634,8 @@ safefile(fn, uid, gid, uname, flags, mode, st)
}
ret = errno;
if (tTd(44, 4))
- printf("\t[final dir %s uid %d mode %o] %s\n",
- fn, stbuf.st_uid, stbuf.st_mode,
+ printf("\t[final dir %s uid %d mode %lo] %s\n",
+ fn, (int) stbuf.st_uid, (u_long) stbuf.st_mode,
errstring(ret));
*p = '/';
st->st_mode = ST_MODE_NOFILE;
@@ -664,6 +663,12 @@ safefile(fn, uid, gid, uname, flags, mode, st)
printf("\t[exec bits %o]\tEPERM]\n", st->st_mode);
return EPERM;
}
+ if (st->st_nlink > 1)
+ {
+ if (tTd(44, 4))
+ printf("\t[link count %d]\tEPERM\n", st->st_nlink);
+ return EPERM;
+ }
if (uid == 0 && !bitset(SFF_ROOTOK, flags))
mode >>= 6;
@@ -690,8 +695,9 @@ safefile(fn, uid, gid, uname, flags, mode, st)
mode >>= 3;
}
if (tTd(44, 4))
- printf("\t[uid %d, stat %o, mode %o] ",
- st->st_uid, st->st_mode, mode);
+ printf("\t[uid %d, nlink %d, stat %lo, mode %lo] ",
+ (int) st->st_uid, (int) st->st_nlink,
+ (u_long) st->st_mode, (u_long) mode);
if ((st->st_uid == uid || st->st_uid == 0 ||
!bitset(SFF_MUSTOWN, flags)) &&
(st->st_mode & mode) == mode)
@@ -966,7 +972,7 @@ putxline(l, mci, pxflags)
p = &l[strlen(l)];
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> ", getpid());
+ fprintf(TrafficLogFile, "%05d >>> ", (int) getpid());
/* check for line overflow */
while (mci->mci_mailer->m_linelimit > 0 &&
@@ -998,7 +1004,7 @@ putxline(l, mci, pxflags)
(void) putc(' ', mci->mci_out);
if (TrafficLogFile != NULL)
fprintf(TrafficLogFile, "%s!\n%05d >>> ",
- l, getpid());
+ l, (int) getpid());
*q = svchar;
l = q;
slop = 1;
@@ -1087,7 +1093,7 @@ xfclose(fp, a, b)
char *a, *b;
{
if (tTd(53, 99))
- printf("xfclose(%x) %s %s\n", fp, a, b);
+ printf("xfclose(%lx) %s %s\n", (u_long) fp, a, b);
#if XDEBUG
if (fileno(fp) == 1)
syserr("xfclose(%s %s): fd = 1", a, b);
@@ -1178,11 +1184,11 @@ sfgets(buf, siz, fp, timeout, during)
{
buf[0] = '\0';
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< [EOF]\n", getpid());
+ fprintf(TrafficLogFile, "%05d <<< [EOF]\n", (int) getpid());
return (NULL);
}
if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< %s", getpid(), buf);
+ fprintf(TrafficLogFile, "%05d <<< %s", (int) getpid(), buf);
if (SevenBitInput)
{
for (p = buf; *p != '\0'; p++)
@@ -2273,6 +2279,25 @@ proc_list_drop(pid)
CurChildren--;
}
/*
+** PROC_LIST_CLEAR -- clear the process list
+**
+** Parameters:
+** none.
+**
+** Returns:
+** none.
+*/
+
+void
+proc_list_clear()
+{
+ int i;
+
+ for (i = 0; i < ProcListSize; i++)
+ ProcListVec[i] = NO_PID;
+ CurChildren = 0;
+}
+ /*
** PROC_LIST_PROBE -- probe processes in the list to see if they still exist
**
** Parameters:
OpenPOWER on IntegriCloud