summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2000-10-01 01:49:02 +0000
committergshapiro <gshapiro@FreeBSD.org>2000-10-01 01:49:02 +0000
commitf84ac9120cb7d9f087e5dcb863c4bf25ba2985e6 (patch)
tree1965ed8ab83d1520308eb01c0471d69de74d7653 /contrib/sendmail/src
parent4332139a9a11f773ffe5109bed871561e3c290a1 (diff)
downloadFreeBSD-src-f84ac9120cb7d9f087e5dcb863c4bf25ba2985e6.zip
FreeBSD-src-f84ac9120cb7d9f087e5dcb863c4bf25ba2985e6.tar.gz
Import of sendmail version 8.11.1 into vendor branch SENDMAIL with
release tag v8_11_1. Obtained from: ftp://ftp.sendmail.org/pub/sendmail/
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/Makefile.m44
-rw-r--r--contrib/sendmail/src/README10
-rw-r--r--contrib/sendmail/src/alias.c6
-rw-r--r--contrib/sendmail/src/bf_torek.c4
-rw-r--r--contrib/sendmail/src/clock.c4
-rw-r--r--contrib/sendmail/src/collect.c37
-rw-r--r--contrib/sendmail/src/conf.c19
-rw-r--r--contrib/sendmail/src/conf.h20
-rw-r--r--contrib/sendmail/src/control.c4
-rw-r--r--contrib/sendmail/src/daemon.c29
-rw-r--r--contrib/sendmail/src/deliver.c80
-rw-r--r--contrib/sendmail/src/envelope.c16
-rw-r--r--contrib/sendmail/src/headers.c8
-rw-r--r--contrib/sendmail/src/helpfile4
-rw-r--r--contrib/sendmail/src/macro.c4
-rw-r--r--contrib/sendmail/src/mailq.16
-rw-r--r--contrib/sendmail/src/main.c26
-rw-r--r--contrib/sendmail/src/map.c92
-rw-r--r--contrib/sendmail/src/milter.c17
-rw-r--r--contrib/sendmail/src/parseaddr.c7
-rw-r--r--contrib/sendmail/src/queue.c20
-rw-r--r--contrib/sendmail/src/readcf.c22
-rw-r--r--contrib/sendmail/src/recipient.c29
-rw-r--r--contrib/sendmail/src/savemail.c6
-rw-r--r--contrib/sendmail/src/sendmail.813
-rw-r--r--contrib/sendmail/src/sendmail.h19
-rw-r--r--contrib/sendmail/src/sfsasl.c15
-rw-r--r--contrib/sendmail/src/srvrsmtp.c95
-rw-r--r--contrib/sendmail/src/stats.c4
-rw-r--r--contrib/sendmail/src/trace.c4
-rw-r--r--contrib/sendmail/src/usersmtp.c10
-rw-r--r--contrib/sendmail/src/version.c4
32 files changed, 449 insertions, 189 deletions
diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4
index c59701b..3fe0703 100644
--- a/contrib/sendmail/src/Makefile.m4
+++ b/contrib/sendmail/src/Makefile.m4
@@ -37,11 +37,11 @@ ifdef(`confNO_HELPFILE_INSTALL',, `bldPUSH_INSTALL_TARGET(`install-hf')')
ifdef(`confNO_STATISTICS_INSTALL',, `bldPUSH_INSTALL_TARGET(`install-st')')
divert(bldTARGETS_SECTION)
install-hf:
- if [ ! -d ${DESTDIR}${HFDIR} ]; then mkdir -p ${DESTDIR}${HFDIR}; fi
+ if [ ! -d ${DESTDIR}${HFDIR} ]; then mkdir -p ${DESTDIR}${HFDIR}; else :; fi
${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -m 444 helpfile ${DESTDIR}${HFFILE}
install-st: statistics
- if [ ! -d ${DESTDIR}${STDIR} ]; then mkdir -p ${DESTDIR}${STDIR}; fi
+ if [ ! -d ${DESTDIR}${STDIR} ]; then mkdir -p ${DESTDIR}${STDIR}; else :; fi
${INSTALL} -c -o ${SBINOWN} -g ${UBINGRP} -m 644 statistics ${DESTDIR}${STFILE}
divert(0)
bldPRODUCT_END
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index 0f9285c..fe9f308 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.263.2.1.2.19 2000/07/15 17:35:18 gshapiro Exp $
+# $Id: README,v 8.263.2.1.2.21 2000/09/27 16:36:26 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -580,6 +580,8 @@ EGD Define this if your system has EGD installed, see
seed the PRNG for STARTTLS if HASURANDOMDEV is not defined.
STARTTLS Enables SMTP STARTTLS (RFC 2487). This requires OpenSSL
(http://www.OpenSSL.org/) and sfio (see below).
+ Use OpenSSL 0.9.5a or later (if compatible with this
+ version), do not use 0.9.3.
See STARTTLS COMPILATION AND CONFIGURATION for further
information.
TLS_NO_RSA Turn off support for RSA algorithms in STARTTLS.
@@ -1236,7 +1238,7 @@ AIX 4.3.3
Date: Sun, 02 Jul 2000 03:58:02 -0400
Under AIX 4.3.3, after applying bos.adt.include 4.3.3.12 to close the
- BIND 8.2.2 security holes, you can no lonber build with -DNETINET6
+ BIND 8.2.2 security holes, you can no longer build with -DNETINET6
because they changed the value of __RES in resolv.h but failed to
actually provide the API changes that the change implied.
@@ -1465,6 +1467,8 @@ OpenSSL
OpenSSL versions prior to 0.9.6 use a macro named Free which
conflicts with existing macro names on some platforms, such as
AIX.
+ Do not use 0.9.3, but OpenSSL 0.9.5a or later if compatible with
+ 0.9.5a.
PH
PH support is provided by Mark Roth <roth@uiuc.edu>. The map is
@@ -1619,4 +1623,4 @@ util.c Some general purpose routines used by sendmail.
version.c The version number and information about this
version of sendmail.
-(Version $Revision: 8.263.2.1.2.19 $, last update $Date: 2000/07/15 17:35:18 $ )
+(Version $Revision: 8.263.2.1.2.21 $, last update $Date: 2000/09/27 16:36:26 $ )
diff --git a/contrib/sendmail/src/alias.c b/contrib/sendmail/src/alias.c
index 4d3c4a6..6a0b17c 100644
--- a/contrib/sendmail/src/alias.c
+++ b/contrib/sendmail/src/alias.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
#ifndef lint
-static char id[] = "@(#)$Id: alias.c,v 8.142.4.1 2000/05/25 18:56:12 gshapiro Exp $";
+static char id[] = "@(#)$Id: alias.c,v 8.142.4.3 2000/09/21 21:52:16 ca Exp $";
#endif /* ! lint */
# define SEPARATOR ':'
@@ -837,11 +837,11 @@ readaliases(map, af, announcestats, logstats)
CurEnv->e_to = NULL;
FileName = NULL;
if (Verbose || announcestats)
- message("%s: %d aliases, longest %d bytes, %d bytes total",
+ message("%s: %ld aliases, longest %ld bytes, %ld bytes total",
map->map_file, naliases, longest, bytes);
if (LogLevel > 7 && logstats)
sm_syslog(LOG_INFO, NOQID,
- "%s: %d aliases, longest %d bytes, %d bytes total",
+ "%s: %ld aliases, longest %ld bytes, %ld bytes total",
map->map_file, naliases, longest, bytes);
}
/*
diff --git a/contrib/sendmail/src/bf_torek.c b/contrib/sendmail/src/bf_torek.c
index fb05368..ab129d4 100644
--- a/contrib/sendmail/src/bf_torek.c
+++ b/contrib/sendmail/src/bf_torek.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: bf_torek.c,v 8.19.18.1 2000/07/18 16:52:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: bf_torek.c,v 8.19.18.2 2000/09/17 17:04:26 gshapiro Exp $";
#endif /* ! lint */
#if SFIO
diff --git a/contrib/sendmail/src/clock.c b/contrib/sendmail/src/clock.c
index 33b38f4..8788291 100644
--- a/contrib/sendmail/src/clock.c
+++ b/contrib/sendmail/src/clock.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: clock.c,v 8.52.18.2 2000/05/25 23:33:30 gshapiro Exp $";
+static char id[] = "@(#)$Id: clock.c,v 8.52.18.3 2000/09/17 17:04:26 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index f6c3682..f6ba02c 100644
--- a/contrib/sendmail/src/collect.c
+++ b/contrib/sendmail/src/collect.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: collect.c,v 8.136.4.3 2000/06/22 22:13:45 geir Exp $";
+static char id[] = "@(#)$Id: collect.c,v 8.136.4.6 2000/09/21 21:52:16 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -195,9 +195,14 @@ collect(fp, smtpmode, hdrp, e)
{
errno = 0;
c = getc(fp);
- if (errno != EINTR)
- break;
- clearerr(fp);
+
+ if (c == EOF && errno == EINTR)
+ {
+ /* Interrupted, retry */
+ clearerr(fp);
+ continue;
+ }
+ break;
}
CollectProgress = TRUE;
if (TrafficLogFile != NULL && !headeronly)
@@ -286,13 +291,22 @@ collect(fp, smtpmode, hdrp, e)
bufferchar:
if (!headeronly)
- e->e_msgsize++;
+ {
+ /* no overflow? */
+ if (e->e_msgsize >= 0)
+ {
+ e->e_msgsize++;
+ if (MaxMessageSize > 0 &&
+ !bitset(EF_TOOBIG, e->e_flags) &&
+ e->e_msgsize > MaxMessageSize)
+ e->e_flags |= EF_TOOBIG;
+ }
+ }
switch (mstate)
{
case MS_BODY:
/* just put the character out */
- if (MaxMessageSize <= 0 ||
- e->e_msgsize <= MaxMessageSize)
+ if (!bitset(EF_TOOBIG, e->e_flags))
(void) putc(c, df);
/* FALLTHROUGH */
@@ -384,7 +398,7 @@ nextstate:
clearerr(fp);
errno = 0;
c = getc(fp);
- } while (errno == EINTR);
+ } while (c == EOF && errno == EINTR);
if (c != EOF)
(void) ungetc(c, fp);
if (c == ' ' || c == '\t')
@@ -436,8 +450,7 @@ nextstate:
}
/* if not a blank separator, write it out */
- if (MaxMessageSize <= 0 ||
- e->e_msgsize <= MaxMessageSize)
+ if (!bitset(EF_TOOBIG, e->e_flags))
{
while (*bp != '\0')
(void) putc(*bp++, df);
@@ -504,7 +517,7 @@ readerr:
st.st_size = -1;
errno = EEXIST;
syserr("collect: bfcommit(%s): already on disk, size = %ld",
- dfile, st.st_size);
+ dfile, (long) st.st_size);
dfd = fileno(df);
if (dfd >= 0)
dumpfd(dfd, TRUE, TRUE);
@@ -650,7 +663,7 @@ readerr:
}
/* check for message too large */
- if (MaxMessageSize > 0 && e->e_msgsize > MaxMessageSize)
+ if (bitset(EF_TOOBIG, e->e_flags))
{
e->e_flags |= EF_NO_BODY_RETN|EF_CLRQUEUE;
e->e_status = "5.2.3";
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index 30b41a4..6bebd2c 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 */
#include <sendmail.h>
@@ -197,6 +197,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 }
};
@@ -2145,7 +2151,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;
@@ -2984,7 +2990,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 */
@@ -4917,7 +4923,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:
@@ -4932,7 +4938,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;
}
@@ -4993,6 +4999,7 @@ load_if_names()
if (tTd(0, 4))
dprintf("SIOCGIFCONF failed: %s\n", errstring(errno));
(void) close(s);
+ free(ifc.ifc_buf);
return;
}
@@ -5099,7 +5106,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;
# endif /* NETINET6 */
diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h
index 00953e9..88b5183 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 $
*/
/*
@@ -525,6 +525,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
@@ -534,9 +536,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 */
@@ -2789,9 +2791,15 @@ 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/control.c b/contrib/sendmail/src/control.c
index 287391a..7865b0e 100644
--- a/contrib/sendmail/src/control.c
+++ b/contrib/sendmail/src/control.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: control.c,v 8.44.14.7 2000/07/03 21:49:05 geir Exp $";
+static char id[] = "@(#)$Id: control.c,v 8.44.14.8 2000/09/17 17:04:26 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 50da6c4..6ef2b2f 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -16,9 +16,9 @@
#ifndef lint
# ifdef DAEMON
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.14 2000/07/14 04:15:00 gshapiro Exp $ (with daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.18 2000/09/21 21:52:16 ca Exp $ (with daemon mode)";
# else /* DAEMON */
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.14 2000/07/14 04:15:00 gshapiro Exp $ (without daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.18 2000/09/21 21:52:16 ca Exp $ (without daemon mode)";
# endif /* DAEMON */
#endif /* ! lint */
@@ -39,6 +39,10 @@ static char id[] = "@(#)$Id: daemon.c,v 8.401.4.14 2000/07/14 04:15:00 gshapiro
#if DAEMON
+# if STARTTLS
+# include <openssl/rand.h>
+# endif /* STARTTLS */
+
# include <sys/time.h>
# if IP_SRCROUTE && NETINET
@@ -221,6 +225,10 @@ getrequests(e)
bool control = FALSE;
int save_errno;
int pipefd[2];
+# if STARTTLS
+ long seed;
+ time_t timenow;
+# endif /* STARTTLS */
/* see if we are rejecting connections */
(void) blocksignal(SIGALRM);
@@ -264,10 +272,10 @@ getrequests(e)
/* log only if not logged before */
if (LogLevel >= 9)
sm_syslog(LOG_INFO, NOQID,
- "rejecting new messages: min free: %d",
+ "rejecting new messages: min free: %ld",
MinBlocksFree);
sm_setproctitle(TRUE, e,
- "rejecting new messages: min free: %d",
+ "rejecting new messages: min free: %ld",
MinBlocksFree);
setbitn(D_ETRNONLY, Daemons[idx].d_flags);
}
@@ -509,7 +517,16 @@ getrequests(e)
** of a queue directory (and other things, e.g., MX selection)
** are not "really" random.
*/
+# if STARTTLS
+ seed = get_random();
+ RAND_seed((void *) &last_disk_space_check,
+ sizeof last_disk_space_check);
+ timenow = curtime();
+ RAND_seed((void *) &timenow, sizeof timenow);
+ RAND_seed((void *) &seed, sizeof seed);
+# else /* STARTTLS */
(void) get_random();
+# endif /* STARTTLS */
/*
** Create a pipe to keep the child from writing to the
@@ -1252,7 +1269,7 @@ setsockaddroptions(p, d)
if (!(isascii(*h) && isspace(*h)))
{
if (flags != d->d_mflags)
- *f++ = ' ';
+ *flags++ = ' ';
*flags++ = *h;
if (isupper(*h))
*flags++ = *h;
@@ -2399,7 +2416,7 @@ getauthinfo(fd, may_be_forged)
int fd;
bool *may_be_forged;
{
- u_short port = 0;
+ volatile u_short port = 0;
SOCKADDR_LEN_T falen;
register char *volatile p = NULL;
SOCKADDR la;
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index d1907d4..35a4505 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.31 2000/07/18 02:24:43 gshapiro Exp $";
+static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.44 2000/09/21 21:52:17 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -484,10 +484,16 @@ sendall(e, mode)
(mode != SM_VERIFY && SuperSafe)) &&
(!bitset(EF_INQUEUE, e->e_flags) || splitenv != NULL))
{
- /* be sure everything is instantiated in the queue */
- queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
+ /*
+ ** Be sure everything is instantiated in the queue.
+ ** Split envelopes first in case the machine crashes.
+ ** If the original were done first, we may lose
+ ** recipients.
+ */
+
for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
queueup(ee, mode == SM_QUEUE || mode == SM_DEFER);
+ queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
}
#endif /* QUEUE */
@@ -627,6 +633,15 @@ sendall(e, mode)
return;
}
+ /*
+ ** Since we have accepted responsbility for the message,
+ ** change the SIGTERM handler. intsig() (the old handler)
+ ** would remove the envelope if this was a command line
+ ** message submission.
+ */
+
+ (void) setsignal(SIGTERM, SIG_DFL);
+
/* double fork to avoid zombies */
pid = fork();
if (pid > 0)
@@ -787,7 +802,8 @@ sendenvelope(e, mode)
** Checkpoint the send list every few addresses
*/
- if (e->e_nsent >= CheckpointInterval)
+ if (CheckpointInterval > 0 &&
+ e->e_nsent >= CheckpointInterval)
{
queueup(e, FALSE);
e->e_nsent = 0;
@@ -1196,9 +1212,11 @@ deliver(e, firstto)
/*
** Check to see that these people are allowed to
** talk to each other.
+ ** Check also for overflow of e_msgsize.
*/
- if (m->m_maxsize != 0 && e->e_msgsize > m->m_maxsize)
+ if (m->m_maxsize != 0 &&
+ (e->e_msgsize > m->m_maxsize || e->e_msgsize < 0))
{
e->e_flags |= EF_NO_BODY_RETN;
if (bitnset(M_LOCALMAILER, to->q_mailer->m_flags))
@@ -2254,10 +2272,30 @@ reconnect: /* after switching to an authenticated connection */
bool usetls;
bool saveQuickAbort = QuickAbort;
bool saveSuprErrs = SuprErrs;
+# if _FFR_TLS_CLT1
+ char *p;
+# endif /* _FFR_TLS_CLT1 */
extern SOCKADDR CurHostAddr;
rcode = EX_OK;
usetls = bitset(MCIF_TLS, mci->mci_flags);
+# if _FFR_TLS_CLT1
+ if (usetls &&
+ (p = macvalue(macid("{client_flags}", NULL), e))
+ != NULL)
+ {
+ for (; *p != '\0'; p++)
+ {
+ /* look for just this one flag */
+ if (*p == D_CLTNOTLS)
+ {
+ usetls = FALSE;
+ break;
+ }
+ }
+ }
+# endif /* _FFR_TLS_CLT1 */
+
hasdot = CurHostName[strlen(CurHostName) - 1] == '.';
if (hasdot)
CurHostName[strlen(CurHostName) - 1] = '\0';
@@ -2667,20 +2705,23 @@ do_transfer:
rcode = smtpgetstat(m, mci, e);
if (rcode == EX_OK)
{
-#if !_FFR_DYNAMIC_TOBUF
+#if _FFR_DYNAMIC_TOBUF
+ (void) strlcat(tobuf, ",", tobufsize);
+ (void) strlcat(tobuf, to->q_paddr, tobufsize);
+#else /* _FFR_DYNAMIC_TOBUF */
if (strlen(to->q_paddr) +
strlen(tobuf) + 2 > sizeof tobuf)
{
syserr("LMTP tobuf overflow");
}
else
-#endif /* !_FFR_DYNAMIC_TOBUF */
{
(void) strlcat(tobuf, ",",
sizeof tobuf);
(void) strlcat(tobuf, to->q_paddr,
sizeof tobuf);
}
+#endif /* _FFR_DYNAMIC_TOBUF */
anyok = TRUE;
}
else
@@ -2716,7 +2757,7 @@ do_transfer:
** Checkpoint the send list every few addresses
*/
- if (e->e_nsent >= CheckpointInterval)
+ if (CheckpointInterval > 0 && e->e_nsent >= CheckpointInterval)
{
queueup(e, FALSE);
e->e_nsent = 0;
@@ -3012,9 +3053,9 @@ endmailer(mci, e, pv)
endwaittimeout, 0);
else
{
- syserr("endmailer %s: wait timeout (%d)",
+ syserr("endmailer %s: wait timeout (%ld)",
mci->mci_mailer->m_name,
- mci->mci_mailer->m_wait);
+ (long) mci->mci_mailer->m_wait);
return EX_TEMPFAIL;
}
}
@@ -3454,7 +3495,7 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
sm_syslog(LOG_INFO, e->e_id,
"to=%.*s [more]%s",
- ++q - p, p, buf);
+ (int) (++q - p), p, buf);
p = q;
}
#if _FFR_DYNAMIC_TOBUF
@@ -3487,7 +3528,7 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
sm_syslog(LOG_INFO, e->e_id,
"to=%.*s [more]",
- ++q - p, p);
+ (int) (++q - p), p);
p = q;
}
#if _FFR_DYNAMIC_TOBUF
@@ -4997,9 +5038,12 @@ starttls(m, mci, e)
ENVELOPE *e;
{
int smtpresult;
- int result;
+ int result = 0;
+ int rfd, wfd;
SSL *clt_ssl = NULL;
+ if (clt_ctx == NULL && !initclttls())
+ return EX_TEMPFAIL;
smtpmessage("STARTTLS", m, mci);
/* get the reply */
@@ -5018,8 +5062,6 @@ starttls(m, mci, e)
if (LogLevel > 13)
sm_syslog(LOG_INFO, e->e_id, "TLS: start client");
- if (clt_ctx == NULL && !initclttls())
- return EX_SOFTWARE;
/* start connection */
if ((clt_ssl = SSL_new(clt_ctx)) == NULL)
@@ -5034,9 +5076,13 @@ starttls(m, mci, e)
return EX_SOFTWARE;
}
+ rfd = fileno(mci->mci_in);
+ wfd = fileno(mci->mci_out);
+
/* SSL_clear(clt_ssl); ? */
- if ((result = SSL_set_rfd(clt_ssl, fileno(mci->mci_in))) != 1 ||
- (result = SSL_set_wfd(clt_ssl, fileno(mci->mci_out))) != 1)
+ if (rfd < 0 || wfd < 0 ||
+ (result = SSL_set_rfd(clt_ssl, rfd)) <= 0 ||
+ (result = SSL_set_wfd(clt_ssl, wfd)) <= 0)
{
if (LogLevel > 5)
{
diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c
index 1e8bfdc..1a6136e 100644
--- a/contrib/sendmail/src/envelope.c
+++ b/contrib/sendmail/src/envelope.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: envelope.c,v 8.180.14.3 2000/06/29 05:30:23 gshapiro Exp $";
+static char id[] = "@(#)$Id: envelope.c,v 8.180.14.4 2000/08/22 18:22:39 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -811,7 +811,9 @@ setsender(from, e, delimptr, delimchar, internal)
*/
/* extract home directory */
- if (strcmp(pw->pw_dir, "/") == 0)
+ if (*pw->pw_dir == '\0')
+ e->e_from.q_home = NULL;
+ else if (strcmp(pw->pw_dir, "/") == 0)
e->e_from.q_home = newstr("");
else
e->e_from.q_home = newstr(pw->pw_dir);
@@ -844,9 +846,13 @@ setsender(from, e, delimptr, delimchar, internal)
if (e->e_from.q_home == NULL)
{
e->e_from.q_home = getenv("HOME");
- if (e->e_from.q_home != NULL &&
- strcmp(e->e_from.q_home, "/") == 0)
- e->e_from.q_home++;
+ if (e->e_from.q_home != NULL)
+ {
+ if (*e->e_from.q_home == '\0')
+ e->e_from.q_home = NULL;
+ else if (strcmp(e->e_from.q_home, "/") == 0)
+ e->e_from.q_home++;
+ }
}
e->e_from.q_uid = RealUid;
e->e_from.q_gid = RealGid;
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index 8f19197..824b333 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 */
#include <sendmail.h>
@@ -51,9 +51,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.
**
@@ -414,7 +412,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/helpfile b/contrib/sendmail/src/helpfile
index 2563d2e..5731626 100644
--- a/contrib/sendmail/src/helpfile
+++ b/contrib/sendmail/src/helpfile
@@ -1,6 +1,6 @@
#vers 2
cpyr
-cpyr Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+cpyr Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
cpyr All rights reserved.
cpyr Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
cpyr Copyright (c) 1988, 1993
@@ -11,7 +11,7 @@ cpyr By using this file, you agree to the terms and conditions set
cpyr forth in the LICENSE file which can be found at the top level of
cpyr the sendmail distribution.
cpyr
-cpyr $$Id: helpfile,v 8.31.16.3 2000/07/19 18:54:55 gshapiro Exp $$
+cpyr $$Id: helpfile,v 8.31.16.4 2000/09/17 14:21:00 ca Exp $$
cpyr
smtp This is sendmail version $v
smtp Topics:
diff --git a/contrib/sendmail/src/macro.c b/contrib/sendmail/src/macro.c
index f0e1db2..007a6eb 100644
--- a/contrib/sendmail/src/macro.c
+++ b/contrib/sendmail/src/macro.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: macro.c,v 8.40.16.1 2000/05/25 18:56:15 gshapiro Exp $";
+static char id[] = "@(#)$Id: macro.c,v 8.40.16.2 2000/09/17 17:04:26 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1
index 20be6a0..f261b0f 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,9 +9,9 @@
.\" 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 $
.\"
-.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/main.c b/contrib/sendmail/src/main.c
index 7b66e0c..58f49c4 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -21,7 +21,7 @@ static char copyright[] =
#endif /* ! lint */
#ifndef lint
-static char id[] = "@(#)$Id: main.c,v 8.485.4.19 2000/06/29 01:31:02 gshapiro Exp $";
+static char id[] = "@(#)$Id: main.c,v 8.485.4.27 2000/09/26 01:30:38 gshapiro Exp $";
#endif /* ! lint */
#define _DEFINE
@@ -99,6 +99,7 @@ static sasl_callback_t srvcallbacks[] =
{ SASL_CB_PROXY_POLICY, &proxy_policy, NULL },
{ SASL_CB_LIST_END, NULL, NULL }
};
+
#endif /* SASL */
int SubmitMode;
@@ -134,6 +135,9 @@ main(argc, argv, envp)
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
static char rnamebuf[MAXNAME]; /* holds RealUserName */
char *emptyenviron[1];
+# if STARTTLS
+ bool tls_ok;
+# endif /* STARTTLS */
QUEUE_CHAR *new;
extern int DtableSize;
extern int optind;
@@ -308,7 +312,6 @@ main(argc, argv, envp)
#endif /* LOG */
}
-
/* set up the blank envelope */
BlankEnvelope.e_puthdr = putheader;
BlankEnvelope.e_putbody = putbody;
@@ -697,13 +700,13 @@ main(argc, argv, envp)
break;
case 'B': /* body type */
- CurEnv->e_bodytype = optarg;
+ CurEnv->e_bodytype = newstr(optarg);
break;
case 'C': /* select configuration file (already done) */
if (RealUid != 0)
warn_C_flag = TRUE;
- ConfFile = optarg;
+ ConfFile = newstr(optarg);
dp = drop_privileges(TRUE);
setstat(dp);
safecf = FALSE;
@@ -1451,6 +1454,7 @@ main(argc, argv, envp)
milter_parse_list(InputFilterList, InputFilters, MAXFILTERS);
#endif /* _FFR_MILTER */
+
/* if we've had errors so far, exit now */
if (ExitStat != EX_OK && OpMode != MD_TEST)
finis(FALSE, ExitStat);
@@ -1577,7 +1581,7 @@ main(argc, argv, envp)
# endif /* 0 */
/* initialize PRNG */
- tls_rand_init(RandFile, 7);
+ tls_ok = tls_rand_init(RandFile, 7);
# endif /* STARTTLS */
#endif /* SMTP */
@@ -1591,6 +1595,8 @@ main(argc, argv, envp)
{
# if SMTP
# if STARTTLS
+ if (tls_ok
+ )
{
/* init TLS for client, ignore result for now */
(void) initclttls();
@@ -1756,8 +1762,9 @@ main(argc, argv, envp)
#if SASL
/* give a syserr or just disable AUTH ? */
- if (sasl_server_init(srvcallbacks, "Sendmail") != SASL_OK)
- syserr("!sasl_server_init failed!");
+ if ((i = sasl_server_init(srvcallbacks, "Sendmail")) != SASL_OK)
+ syserr("!sasl_server_init failed! [%s]",
+ sasl_errstring(i, NULL, NULL));
#endif /* SASL */
if (OpMode == MD_DAEMON)
@@ -2755,6 +2762,11 @@ testmodeline(line, e)
#if _FFR_ADDR_TYPE
define(macid("{addr_type}", NULL), "e r", e);
#endif /* _FFR_ADDR_TYPE */
+
+ /* skip leading spaces */
+ while (*line == ' ')
+ line++;
+
switch (line[0])
{
case '#':
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index 3908966..3676d44 100644
--- a/contrib/sendmail/src/map.c
+++ b/contrib/sendmail/src/map.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: map.c,v 8.414.4.13 2000/07/14 16:48:21 ca Exp $";
+static char id[] = "@(#)$Id: map.c,v 8.414.4.24 2000/09/27 04:11:29 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -568,6 +568,7 @@ openmap(map)
map->map_class = &BogusMapClass;
map->map_mflags |= MF_OPEN;
map->map_pid = getpid();
+ MapOpenErr = TRUE;
}
else
{
@@ -626,7 +627,6 @@ map_close(s, unused)
if (!bitset(MF_VALID, map->map_mflags) ||
!bitset(MF_OPEN, map->map_mflags) ||
- bitset(MF_SHARED, map->map_mflags) ||
map->map_pid != getpid())
return;
@@ -2810,7 +2810,7 @@ ldapmap_open(map, mode)
STAB *s;
if (tTd(38, 2))
- dprintf("ldapmap_open(%s, %d)\n", map->map_mname, mode);
+ dprintf("ldapmap_open(%s, %d): ", map->map_mname, mode);
mode &= O_ACCMODE;
@@ -2841,10 +2841,14 @@ ldapmap_open(map, mode)
{
/* Already have a connection open to this LDAP server */
lmap->ldap_ld = s->s_ldap;
- map->map_mflags |= MF_SHARED;
+ if (tTd(38, 2))
+ dprintf("using cached connection\n");
return TRUE;
}
+ if (tTd(38, 2))
+ dprintf("opening new connection\n");
+
/* No connection yet, connect */
if (!ldapmap_start(map))
return FALSE;
@@ -3142,7 +3146,7 @@ ldapmap_lookup(map, name, av, statp)
if (q[1] == 's')
{
snprintf(fp, SPACELEFT(filter, fp), "%.*s%s",
- q - p, p, keybuf);
+ (int) (q - p), p, keybuf);
fp += strlen(fp);
p = q + 2;
}
@@ -3151,7 +3155,7 @@ ldapmap_lookup(map, name, av, statp)
char *k = keybuf;
snprintf(fp, SPACELEFT(filter, fp), "%.*s",
- q - p, p);
+ (int) (q - p), p);
fp += strlen(fp);
p = q + 2;
@@ -3179,7 +3183,7 @@ ldapmap_lookup(map, name, av, statp)
else
{
snprintf(fp, SPACELEFT(filter, fp), "%.*s",
- q - p + 1, p);
+ (int) (q - p + 1), p);
p = q + (q[1] == '%' ? 2 : 1);
fp += strlen(fp);
}
@@ -3200,13 +3204,24 @@ ldapmap_lookup(map, name, av, statp)
if (!bitset(MF_OPTIONAL, map->map_mflags))
{
if (bitset(MF_NODEFER, map->map_mflags))
- syserr("Error in ldap_search_st using %s in map %s",
+ syserr("Error in ldap_search using %s in map %s",
filter, map->map_mname);
else
- syserr("421 4.0.0 Error in ldap_search_st using %s in map %s",
+ syserr("421 4.0.0 Error in ldap_search using %s in map %s",
filter, map->map_mname);
}
*statp = EX_TEMPFAIL;
+#ifdef LDAP_SERVER_DOWN
+ if (errno == LDAP_SERVER_DOWN)
+ {
+ int save_errno = errno;
+
+ /* server disappeared, try reopen on next search */
+ map->map_class->map_close(map);
+ map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
+ errno = save_errno;
+ }
+#endif /* LDAP_SERVER_DOWN */
return NULL;
}
@@ -3309,7 +3324,7 @@ ldapmap_lookup(map, name, av, statp)
}
*statp = EX_TEMPFAIL;
# if USING_NETSCAPE_LDAP
- ldap_mem_free(attr);
+ ldap_memfree(attr);
# endif /* USING_NETSCAPE_LDAP */
if (lmap->ldap_res != NULL)
{
@@ -3355,7 +3370,7 @@ ldapmap_lookup(map, name, av, statp)
{
vp = newstr(attr);
# if USING_NETSCAPE_LDAP
- ldap_mem_free(attr);
+ ldap_memfree(attr);
# endif /* USING_NETSCAPE_LDAP */
break;
}
@@ -3364,7 +3379,7 @@ ldapmap_lookup(map, name, av, statp)
{
ldap_value_free(vals);
# if USING_NETSCAPE_LDAP
- ldap_mem_free(attr);
+ ldap_memfree(attr);
# endif /* USING_NETSCAPE_LDAP */
continue;
}
@@ -3372,7 +3387,7 @@ ldapmap_lookup(map, name, av, statp)
vp = newstr(vals[0]);
ldap_value_free(vals);
# if USING_NETSCAPE_LDAP
- ldap_mem_free(attr);
+ ldap_memfree(attr);
# endif /* USING_NETSCAPE_LDAP */
break;
}
@@ -3394,7 +3409,7 @@ ldapmap_lookup(map, name, av, statp)
vp = tmp;
}
# if USING_NETSCAPE_LDAP
- ldap_mem_free(attr);
+ ldap_memfree(attr);
# endif /* USING_NETSCAPE_LDAP */
continue;
}
@@ -3424,7 +3439,7 @@ ldapmap_lookup(map, name, av, statp)
ldap_value_free(vals);
# if USING_NETSCAPE_LDAP
- ldap_mem_free(attr);
+ ldap_memfree(attr);
# endif /* USING_NETSCAPE_LDAP */
if (vp == NULL)
{
@@ -3595,8 +3610,10 @@ ldapmap_lookup(map, name, av, statp)
** LDAPMAP_FINDCONN -- find an LDAP connection to the server
**
** Cache LDAP connections based on the host, port, bind DN,
-** and secret so we don't have multiple connections open to
-** the same server for different maps.
+** secret, and PID so we don't have multiple connections open to
+** the same server for different maps. Need a separate connection
+** per PID since a parent process may close the map before the
+** child is done with it.
**
** Parameters:
** lmap -- LDAP map information
@@ -3619,16 +3636,17 @@ ldapmap_findconn(lmap)
(lmap->ldap_binddn == NULL ? 0 : strlen(lmap->ldap_binddn)) +
1 +
(lmap->ldap_secret == NULL ? 0 : strlen(lmap->ldap_secret)) +
- 1;
+ 8 + 1;
nbuf = xalloc(len);
- snprintf(nbuf, len, "%s%c%d%c%s%c%s",
+ snprintf(nbuf, len, "%s%c%d%c%s%c%s%d",
(lmap->ldap_host == NULL ? "localhost" : lmap->ldap_host),
CONDELSE,
lmap->ldap_port,
CONDELSE,
(lmap->ldap_binddn == NULL ? "" : lmap->ldap_binddn),
CONDELSE,
- (lmap->ldap_secret == NULL ? "" : lmap->ldap_secret));
+ (lmap->ldap_secret == NULL ? "" : lmap->ldap_secret),
+ getpid());
s = stab(nbuf, ST_LDAP, ST_ENTER);
free(nbuf);
return s;
@@ -4127,7 +4145,8 @@ ldapmap_parseargs(map, args)
return FALSE;
}
lmap->ldap_secret = sfgets(m_tmp, LDAPMAP_MAX_PASSWD,
- sfd, 0, "ldapmap_parseargs");
+ sfd, TimeOuts.to_fileopen,
+ "ldapmap_parseargs");
(void) fclose(sfd);
if (lmap->ldap_secret != NULL &&
strlen(m_tmp) > 0)
@@ -4607,6 +4626,23 @@ ph_map_open(map, mode)
return FALSE;
}
+ if (CurEnv != NULL && CurEnv->e_sendmode == SM_DEFER &&
+ bitset(MF_DEFER, map->map_mflags))
+ {
+ if (tTd(9, 1))
+ dprintf("ph_map_open(%s) => DEFERRED\n",
+ map->map_mname);
+
+ /*
+ ** Unset MF_DEFER here so that map_lookup() returns
+ ** a temporary failure using the bogus map and
+ ** map->map_tapp instead of the default permanent error.
+ */
+
+ map->map_mflags &= ~MF_DEFER;
+ return FALSE;
+ }
+
pmap = (PH_MAP_STRUCT *)map->map_db1;
hostlist = newstr(pmap->ph_servers);
@@ -4626,7 +4662,7 @@ ph_map_open(map, mode)
# ifdef ETIMEDOUT
errno = ETIMEDOUT;
# else /* ETIMEDOUT */
- errno = 0;
+ errno = EAGAIN;
# endif /* ETIMEDOUT */
goto ph_map_open_abort;
}
@@ -4683,15 +4719,17 @@ ph_map_open(map, mode)
#if !_FFR_PHMAP_TIMEOUT
errno = save_errno;
#endif /* !_FFR_PHMAP_TIMEOUT */
- if (!bitset(MF_OPTIONAL, map->map_mflags))
+ if (bitset(MF_NODEFER, map->map_mflags))
{
- if (errno == 0 && !bitset(MF_NODEFER,map->map_mflags))
+ if (errno == 0)
errno = EAGAIN;
- syserr("ph_map_open: cannot connect to PH server");
+ syserr("ph_map_open: %s: cannot connect to PH server",
+ map->map_mname);
}
- else if (LogLevel > 1)
+ else if (!bitset(MF_OPTIONAL, map->map_mflags) && LogLevel > 1)
sm_syslog(LOG_NOTICE, CurEnv->e_id,
- "ph_map_open: cannot connect to PH server");
+ "ph_map_open: %s: cannot connect to PH server",
+ map->map_mname);
free(hostlist);
return FALSE;
}
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index 82f1574..248cba7 100644
--- a/contrib/sendmail/src/milter.c
+++ b/contrib/sendmail/src/milter.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: milter.c,v 8.50.4.30 2000/07/18 07:24:51 gshapiro Exp $";
+static char id[] = "@(#)$Id: milter.c,v 8.50.4.33 2000/09/19 19:40:15 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -208,7 +208,7 @@ milter_sysread(m, buf, sz, to, e)
time_t to;
ENVELOPE *e;
{
- time_t readstart;
+ time_t readstart = 0;
ssize_t len, curl;
curl = 0;
@@ -288,7 +288,7 @@ milter_read(m, cmd, rlen, to, e)
time_t to;
ENVELOPE *e;
{
- time_t readstart;
+ time_t readstart = 0;
ssize_t expl;
mi_int32 i;
char *buf;
@@ -939,6 +939,8 @@ milter_open(m, parseonly, e)
/* couldn't connect.... try next address */
save_errno = errno;
+ p = CurHostName;
+ CurHostName = at;
if (tTd(64, 5))
dprintf("milter_open(%s): %s failed: %s\n",
m->mf_name, at, errstring(save_errno));
@@ -946,6 +948,7 @@ milter_open(m, parseonly, e)
sm_syslog(LOG_INFO, e->e_id,
"milter_open(%s): %s failed: %s",
m->mf_name, at, errstring(save_errno));
+ CurHostName = p;
(void) close(sock);
/* try next address */
@@ -1016,7 +1019,7 @@ milter_setup(line)
register struct milter *m;
STAB *s;
- /* collect the mailer name */
+ /* collect the filter name */
for (p = line;
*p != '\0' && *p != ',' && !(isascii(*p) && isspace(*p));
p++)
@@ -1061,7 +1064,7 @@ milter_setup(line)
/* p now points to the field body */
p = munchstring(p, &delimptr, ',');
- /* install the field into the mailer struct */
+ /* install the field into the filter struct */
switch (fcode)
{
case 'S': /* socket */
@@ -1094,7 +1097,7 @@ milter_setup(line)
/* early check for errors */
(void) milter_open(m, TRUE, CurEnv);
- /* enter the mailer into the symbol table */
+ /* enter the filter into the symbol table */
s = stab(m->mf_name, ST_MILTER, ST_ENTER);
if (s->s_milter != NULL)
syserr("X%s: duplicate filter definition", m->mf_name);
@@ -1206,7 +1209,7 @@ milter_parse_timeouts(spec, m)
/* p now points to the field body */
p = munchstring(p, &delimptr, ';');
- /* install the field into the mailer struct */
+ /* install the field into the filter struct */
switch (fcode)
{
case 'S':
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index ad4ed9a..eb63223 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.1 2000/05/25 18:56:16 gshapiro Exp $";
+static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.5 2000/09/25 07:53:29 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -2721,7 +2721,12 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl)
*/
goto finis;
}
+
+ MapOpenErr = FALSE;
(void) rewrite(pvp, rsno, 0, e);
+ if (MapOpenErr)
+ usrerrenh("4.3.0", "451 Temporary failure");
+
if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET ||
pvp[1] == NULL || (strcmp(pvp[1], "error") != 0 &&
strcmp(pvp[1], "discard") != 0))
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index 209d5b7..a91a988 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -16,9 +16,9 @@
#ifndef lint
# if QUEUE
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.11 2000/07/14 05:55:51 gshapiro Exp $ (with queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.17 2000/09/15 03:34:51 gshapiro Exp $ (with queueing)";
# else /* QUEUE */
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.11 2000/07/14 05:55:51 gshapiro Exp $ (without queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.17 2000/09/15 03:34:51 gshapiro Exp $ (without queueing)";
# endif /* QUEUE */
#endif /* ! lint */
@@ -1056,7 +1056,7 @@ orderq(queuedir, doall)
WorkQ = nw;
free(w->w_name);
- if (w->w_host)
+ if (w->w_host != NULL)
free(w->w_host);
free((char *) w);
w = nw;
@@ -1149,7 +1149,9 @@ orderq(queuedir, doall)
}
/* avoid work if possible */
- if (QueueSortOrder == QSO_BYFILENAME)
+ if (QueueSortOrder == QSO_BYFILENAME &&
+ QueueLimitSender == NULL &&
+ QueueLimitRecipient == NULL)
{
w->w_name = newstr(d->d_name);
w->w_host = NULL;
@@ -2034,7 +2036,7 @@ readqf(e)
break;
case 'H': /* header */
- (void) chompheader(&bp[1], 0, NULL, e);
+ (void) chompheader(&bp[1], CHHDR_QUEUE, NULL, e);
hdrsize += strlen(&bp[1]);
break;
@@ -2840,7 +2842,9 @@ setctluser(user, qfver)
}
else if ((pw = sm_getpwnam(user)) != NULL)
{
- if (strcmp(pw->pw_dir, "/") == 0)
+ if (*pw->pw_dir == '\0')
+ a->q_home = NULL;
+ else if (strcmp(pw->pw_dir, "/") == 0)
a->q_home = "";
else
a->q_home = newstr(pw->pw_dir);
@@ -3029,6 +3033,10 @@ chkqdir(name, sff)
struct stat statb;
int i;
+ /* skip over . and .. directories */
+ if (name[0] == '.' &&
+ (name[1] == '\0' || (name[2] == '.' && name[3] == '\0')))
+ return FALSE;
# if HASLSTAT
if (lstat(name, &statb) < 0)
# else /* HASLSTAT */
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index 2521435..8235883 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: readcf.c,v 8.382.4.14 2000/07/12 00:00:27 geir Exp $";
+static char id[] = "@(#)$Id: readcf.c,v 8.382.4.27 2000/09/28 01:31:16 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -1134,18 +1134,18 @@ makemailer(line)
if (strcmp(m->m_mailer, "[TCP]") == 0)
{
-#if _FFR_REMOVE_TCP_PATH
+#if _FFR_REMOVE_TCP_MAILER_PATH
syserr("M%s: P=[TCP] is deprecated, use P=[IPC] instead\n",
m->m_name);
-#else /* _FFR_REMOVE_TCP_PATH */
+#else /* _FFR_REMOVE_TCP_MAILER_PATH */
printf("M%s: Warning: P=[TCP] is deprecated, use P=[IPC] instead\n",
m->m_name);
-#endif /* _FFR_REMOVE_TCP_PATH */
+#endif /* _FFR_REMOVE_TCP_MAILER_PATH */
}
- if (strcmp(m->m_mailer, "[IPC]") == 0 ||
+ if (strcmp(m->m_mailer, "[IPC]") == 0
#if !_FFR_REMOVE_TCP_MAILER_PATH
- strcmp(m->m_mailer, "[TCP]") == 0
+ || strcmp(m->m_mailer, "[TCP]") == 0
#endif /* !_FFR_REMOVE_TCP_MAILER_PATH */
)
{
@@ -1156,12 +1156,12 @@ makemailer(line)
syserr("M%s: too few parameters for %s mailer",
m->m_name, m->m_mailer);
}
- if (strcmp(m->m_argv[0], "TCP") != 0 &&
+ if (strcmp(m->m_argv[0], "TCP") != 0
#if NETUNIX
- strcmp(m->m_argv[0], "FILE") != 0 &&
+ && strcmp(m->m_argv[0], "FILE") != 0
#endif /* NETUNIX */
#if !_FFR_DEPRECATE_IPC_MAILER_ARG
- strcmp(m->m_argv[0], "IPC") != 0
+ && strcmp(m->m_argv[0], "IPC") != 0
#endif /* !_FFR_DEPRECATE_IPC_MAILER_ARG */
)
{
@@ -2190,9 +2190,13 @@ setoption(opt, val, safe, sticky, e)
case 'Q': /* queue directory */
if (val[0] == '\0')
+ {
QueueDir = "mqueue";
+ }
else
+ {
QueueDir = newstr(val);
+ }
if (RealUid != 0 && !safe)
Warn_Q_option = TRUE;
break;
diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c
index 3d6e632..d144792 100644
--- a/contrib/sendmail/src/recipient.c
+++ b/contrib/sendmail/src/recipient.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: recipient.c,v 8.231.14.5 2000/06/27 20:15:46 gshapiro Exp $";
+static char id[] = "@(#)$Id: recipient.c,v 8.231.14.8 2000/09/14 23:32:27 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -718,7 +718,9 @@ recipient(a, sendq, aliaslevel, e)
(void) strlcpy(buf, pw->pw_name, buflen);
goto trylocaluser;
}
- if (strcmp(pw->pw_dir, "/") == 0)
+ if (*pw->pw_dir == '\0')
+ a->q_home = NULL;
+ else if (strcmp(pw->pw_dir, "/") == 0)
a->q_home = "";
else
a->q_home = newstr(pw->pw_dir);
@@ -1134,6 +1136,23 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
dprintf("include: old uid = %d/%d\n",
(int) getuid(), (int) geteuid());
+#if _FFR_UNSAFE_WRITABLE_INCLUDE
+ if (forwarding)
+ {
+ if (!bitnset(DBS_GROUPWRITABLEFORWARDFILE, DontBlameSendmail))
+ sfflags |= SFF_NOGWFILES;
+ if (!bitnset(DBS_WORLDWRITABLEFORWARDFILE, DontBlameSendmail))
+ sfflags |= SFF_NOWWFILES;
+ }
+ else
+ {
+ if (!bitnset(DBS_GROUPWRITABLEINCLUDEFILE, DontBlameSendmail))
+ sfflags |= SFF_NOGWFILES;
+ if (!bitnset(DBS_WORLDWRITABLEINCLUDEFILE, DontBlameSendmail))
+ sfflags |= SFF_NOWWFILES;
+ }
+#endif /* _FFR_UNSAFE_WRITABLE_INCLUDE */
+
if (forwarding)
sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOWLINK;
@@ -1497,7 +1516,11 @@ resetuid:
isascii(p[-1]) && isspace(p[-1]) &&
(p[3] == '\0' || (isascii(p[3]) && isspace(p[3]))))
{
- p[-1] = '\0';
+ --p;
+ while (p > buf && isascii(p[-1]) &&
+ isspace(p[-1]))
+ --p;
+ p[0] = '\0';
break;
}
}
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index 0478e359..f297ef9 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 */
#include <sendmail.h>
@@ -332,7 +332,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)
@@ -445,6 +446,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 eb70b7d..845b1a6 100644
--- a/contrib/sendmail/src/sendmail.8
+++ b/contrib/sendmail/src/sendmail.8
@@ -9,9 +9,9 @@
.\" 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 $
.\"
-.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
@@ -170,6 +170,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 .
@@ -672,8 +679,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
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index e199d66..1748a73 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -20,7 +20,7 @@
#ifdef _DEFINE
# define EXTERN
# ifndef lint
-static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.28 2000/07/18 02:24:44 gshapiro Exp $";
+static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.37 2000/09/25 07:53:29 gshapiro Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
@@ -542,6 +542,7 @@ extern struct hdrinfo HdrInfo[];
#define CHHDR_DEF 0x0001 /* default header */
#define CHHDR_CHECK 0x0002 /* call ruleset for header */
#define CHHDR_USER 0x0004 /* header from user */
+#define CHHDR_QUEUE 0x0008 /* header from qf file */
/* functions */
extern void addheader __P((char *, char *, int, HDR **));
@@ -589,6 +590,12 @@ struct envelope
char **e_fromdomain; /* the domain part of the sender */
ADDRESS *e_sendqueue; /* list of message recipients */
ADDRESS *e_errorqueue; /* the queue for error responses */
+
+ /*
+ ** Overflow detection is based on < 0, so don't change this
+ ** to unsigned. We don't use unsigned and == ULONG_MAX because
+ ** some libc's don't have strtoul(), see mail_esmtp_args().
+ */
long e_msgsize; /* size of the message in bytes */
long e_flags; /* flags, see below */
int e_nrcpts; /* number of recipients */
@@ -656,6 +663,7 @@ struct envelope
#define EF_IS_MIME 0x0400000L /* really is a MIME message */
#define EF_DONT_MIME 0x0800000L /* never MIME this message */
#define EF_DISCARD 0x1000000L /* discard the message */
+#define EF_TOOBIG 0x2000000L /* message is too big */
/* values for e_if_macros */
#define EIF_ADDR 0 /* ${if_addr} */
@@ -868,7 +876,6 @@ MAP
#define MF_DEFER 0x00080000 /* don't lookup map in defer mode */
#define MF_SINGLEMATCH 0x00100000 /* successful only if match one key */
#define MF_NOREWRITE 0x00200000 /* don't rewrite result, return as-is */
-#define MF_SHARED 0x00400000 /* map connection is shared */
#define DYNOPENMAP(map) if (!bitset(MF_OPEN, (map)->map_mflags)) \
{ \
@@ -1421,12 +1428,15 @@ struct termescape
*/
/* d_flags, see daemon.c */
-/* generic rule: lower case: required, upper case: No */
+/* general rule: lower case: required, upper case: No */
#define D_AUTHREQ 'a' /* authentication required */
#define D_BINDIF 'b' /* use if_addr for outgoing connection */
#define D_CANONREQ 'c' /* canonification required (cf) */
#define D_IFNHELO 'h' /* use if name for HELO */
#define D_FQMAIL 'f' /* fq sender address required (cf) */
+#if _FFR_TLS_CLT1
+#define D_CLTNOTLS 'S' /* don't use STARTTLS in client */
+#endif /* _FFR_TLS_CLT1 */
#define D_FQRCPT 'r' /* fq recipient address required (cf) */
#define D_UNQUALOK 'u' /* unqualified address is ok (cf) */
#define D_NOCANON 'C' /* no canonification (cf) */
@@ -1664,6 +1674,7 @@ EXTERN bool IgnoreHostStatus; /* ignore long term host status files */
EXTERN bool IgnrDot; /* don't let dot end messages */
EXTERN bool InChild; /* true if running in an SMTP subprocess */
EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */
+EXTERN bool MapOpenErr; /* error opening a non-optional map */
EXTERN bool MatchGecos; /* look for user names in gecos field */
EXTERN bool MeToo; /* send to the sender also */
EXTERN bool NoAlias; /* suppress aliasing */
@@ -1863,7 +1874,7 @@ extern int tls_get_info __P((SSL *, ENVELOPE *, bool, char *));
extern int endtls __P((SSL *, char *));
extern int endtlsclt __P((MCI *));
extern void tlslogerr __P((void));
-extern void tls_rand_init __P((char *, int));
+extern bool tls_rand_init __P((char *, int));
#endif /* STARTTLS */
/* Transcript file */
diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c
index 43a65d1..582a064 100644
--- a/contrib/sendmail/src/sfsasl.c
+++ b/contrib/sendmail/src/sfsasl.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: sfsasl.c,v 8.17.4.7 2000/07/18 18:44:51 gshapiro Exp $";
+static char id[] = "@(#)$Id: sfsasl.c,v 8.17.4.8 2000/09/14 00:14:13 ca Exp $";
#endif /* ! lint */
#if SFIO
@@ -297,6 +297,8 @@ sfdctls(fin, fout, con)
Tlsdisc_t *tlsin, *tlsout;
# if !SFIO
FILE *fp;
+# else /* !SFIO */
+ int rfd, wfd;
# endif /* !SFIO */
if (con == NULL)
@@ -323,8 +325,15 @@ sfdctls(fin, fout, con)
tlsout->disc.exceptf = NULL;
tlsout->con = con;
- SSL_set_rfd(con, fileno(fin)); /* fileno or sffileno? XXX */
- SSL_set_wfd(con, fileno(fout));
+ rfd = fileno(fin);
+ wfd = fileno(fout);
+ if (rfd < 0 || wfd < 0 ||
+ SSL_set_rfd(con, rfd) <= 0 || SSL_set_wfd(con, wfd) <= 0)
+ {
+ free(tlsin);
+ free(tlsout);
+ return -1;
+ }
if (sfdisc(fin, (Sfdisc_t *) tlsin) != (Sfdisc_t *) tlsin ||
sfdisc(fout, (Sfdisc_t *) tlsout) != (Sfdisc_t *) tlsout)
{
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 52ea42f..9989c75 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -16,14 +16,16 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.40 2000/07/18 02:24:45 gshapiro Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.58 2000/09/21 21:52:18 ca Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.40 2000/07/18 02:24:45 gshapiro Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.58 2000/09/21 21:52:18 ca Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
#if SMTP
-# include "sfsasl.h"
+# if SASL || STARTTLS
+# include "sfsasl.h"
+# endif /* SASL || STARTTLS */
# if SASL
# define ENC64LEN(l) (((l) + 2) * 4 / 3 + 1)
static int saslmechs __P((sasl_conn_t *, char **));
@@ -112,6 +114,11 @@ struct cmd
# define CMDDBGQSHOW 24 /* showq -- show send queue */
# define CMDDBGDEBUG 25 /* debug -- set debug mode */
+/*
+** Note: If you change this list,
+** remember to update 'helpfile'
+*/
+
static struct cmd CmdTab[] =
{
{ "mail", CMDMAIL },
@@ -232,6 +239,7 @@ smtp(nullserver, d_flags, e)
# endif /* SASL */
# if STARTTLS
int r;
+ int rfd, wfd;
volatile bool usetls = TRUE;
volatile bool tls_active = FALSE;
bool saveQuickAbort;
@@ -435,7 +443,7 @@ smtp(nullserver, d_flags, e)
else
snprintf(cmdbuf, sizeof cmdbuf,
"%s-%%.*s ESMTP%%s", greetcode);
- message(cmdbuf, id - inp, inp, id);
+ message(cmdbuf, (int) (id - inp), inp, id);
/* output remaining lines */
while ((id = p) != NULL && (p = strchr(id, '\n')) != NULL)
@@ -1001,8 +1009,11 @@ smtp(nullserver, d_flags, e)
message("454 4.3.3 TLS not available: error generating SSL handle");
break;
}
- if (SSL_set_rfd(srv_ssl, fileno(InChannel)) <= 0 ||
- SSL_set_wfd(srv_ssl, fileno(OutChannel)) <= 0)
+ rfd = fileno(InChannel);
+ wfd = fileno(OutChannel);
+ if (rfd < 0 || wfd < 0 ||
+ SSL_set_rfd(srv_ssl, rfd) <= 0 ||
+ SSL_set_wfd(srv_ssl, wfd) <= 0)
{
message("454 4.3.3 TLS not available: error set fd");
SSL_free(srv_ssl);
@@ -1252,7 +1263,14 @@ smtp(nullserver, d_flags, e)
break;
}
- /* print EHLO features list */
+ /*
+ ** print EHLO features list
+ **
+ ** Note: If you change this list,
+ ** remember to update 'helpfile'
+ */
+
+
message("250-ENHANCEDSTATUSCODES");
if (!bitset(PRIV_NOEXPN, PrivacyFlags))
{
@@ -1506,7 +1524,8 @@ smtp(nullserver, d_flags, e)
Errors > 0)
goto undo_subproc_no_pm;
- if (MaxMessageSize > 0 && e->e_msgsize > MaxMessageSize)
+ if (MaxMessageSize > 0 &&
+ (e->e_msgsize > MaxMessageSize || e->e_msgsize < 0))
{
usrerr("552 5.2.3 Message size exceeds fixed maximum message size (%ld)",
MaxMessageSize);
@@ -1544,7 +1563,7 @@ smtp(nullserver, d_flags, e)
break;
case SMFIR_TEMPFAIL:
- usrerr("451 4.7.1 Try again later");
+ usrerr("451 4.7.1 Please try again later");
break;
}
if (response != NULL)
@@ -1722,7 +1741,7 @@ smtp(nullserver, d_flags, e)
break;
case SMFIR_TEMPFAIL:
- usrerr("451 4.7.1 Try again later");
+ usrerr("451 4.7.1 Please try again later");
break;
}
if (response != NULL)
@@ -1824,7 +1843,7 @@ smtp(nullserver, d_flags, e)
break;
case SMFIR_TEMPFAIL:
- usrerr("451 4.7.1 Try again later");
+ usrerr("451 4.7.1 Please try again later");
break;
}
if (response != NULL)
@@ -2079,7 +2098,7 @@ smtp(nullserver, d_flags, e)
/* see if there is more in the vrfy list */
a = vrfyqueue;
while ((a = a->q_next) != NULL &&
- (!QS_IS_UNDELIVERED(vrfyqueue->q_state)))
+ (!QS_IS_UNDELIVERED(a->q_state)))
continue;
printvrfyaddr(vrfyqueue, a == NULL, vrfy);
vrfyqueue = a;
@@ -2429,11 +2448,12 @@ mail_esmtp_args(kp, vp, e)
/* NOTREACHED */
}
define(macid("{msg_size}", NULL), newstr(vp), e);
-# if defined(__STDC__) && !defined(BROKEN_ANSI_LIBRARY)
- e->e_msgsize = strtoul(vp, (char **) NULL, 10);
-# else /* defined(__STDC__) && !defined(BROKEN_ANSI_LIBRARY) */
- e->e_msgsize = strtol(vp, (char **) NULL, 10);
-# endif /* defined(__STDC__) && !defined(BROKEN_ANSI_LIBRARY) */
+ e->e_msgsize = strtol(vp, (char **) NULL, 10);
+ if (e->e_msgsize == LONG_MAX && errno == ERANGE)
+ {
+ usrerr("552 5.2.3 Message size exceeds maximum value");
+ /* NOTREACHED */
+ }
}
else if (strcasecmp(kp, "body") == 0)
{
@@ -2587,7 +2607,7 @@ mail_esmtp_args(kp, vp, e)
# endif /* SASL */
else
{
- usrerr("501 5.5.4 %s parameter unrecognized", kp);
+ usrerr("555 5.5.4 %s parameter unrecognized", kp);
/* NOTREACHED */
}
}
@@ -2676,7 +2696,7 @@ rcpt_esmtp_args(a, kp, vp, e)
}
else
{
- usrerr("501 5.5.4 %s parameter unrecognized", kp);
+ usrerr("555 5.5.4 %s parameter unrecognized", kp);
/* NOTREACHED */
}
}
@@ -2949,7 +2969,7 @@ get_dh512()
** logl -- loglevel
**
** Returns:
-** None. (not yet, maybe it should return success/failure?)
+** success/failure
**
** Side Effects:
** initializes PRNG for tls library.
@@ -2957,26 +2977,37 @@ get_dh512()
#define MIN_RAND_BYTES 16 /* 128 bits */
-void
+bool
tls_rand_init(randfile, logl)
char *randfile;
int logl;
{
-# ifndef HASURANDOMDEV
+# ifndef HASURANDOMDEV
/* not required if /dev/urandom exists, OpenSSL does it internally */
#define RF_OK 0 /* randfile OK */
#define RF_MISS 1 /* randfile == NULL || *randfile == '\0' */
#define RF_UNKNOWN 2 /* unknown prefix for randfile */
+#define RI_NONE 0 /* no init yet */
+#define RI_SUCCESS 1 /* init was successful */
+#define RI_FAIL 2 /* init failed */
+
bool ok;
int randdef;
+ static int done = RI_NONE;
/*
** initialize PRNG
*/
+ /* did we try this before? if yes: return old value */
+ if (done != RI_NONE)
+ return done == RI_SUCCESS;
+
+ /* set default values */
ok = FALSE;
+ done = RI_FAIL;
randdef = (randfile == NULL || *randfile == '\0') ? RF_MISS : RF_OK;
# if EGD
if (randdef == RF_OK && strncasecmp(randfile, "egd:", 4) == 0)
@@ -3104,8 +3135,13 @@ tls_rand_init(randfile, logl)
if (LogLevel > logl)
sm_syslog(LOG_WARNING, NOQID,
"TLS: Warning: random number generator not properly seeded");
+ ok = TRUE;
}
-# endif /* !HASURANDOMDEV */
+ done = ok ? RI_SUCCESS : RI_FAIL;
+ return ok;
+# else /* !HASURANDOMDEV */
+ return TRUE;
+# endif /* !HASURANDOMDEV */
}
/*
@@ -3288,6 +3324,12 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
/* already initialized? (we could re-init...) */
if (*ctx != NULL)
return TRUE;
+
+ /* PRNG seeded? */
+ if (!tls_rand_init(RandFile, 10))
+ return FALSE;
+
+ /* let's start with the assumption it will work */
ok = TRUE;
# if _FFR_TLS_1
@@ -3362,12 +3404,11 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
sm_syslog(LOG_WARNING, NOQID,
"TLS: error: illegal value '%s' for DHParam",
dhparam);
- free(dhparam);
dhparam = NULL;
}
}
if (dhparam == NULL)
- dhparam = srv ? newstr("1") : newstr("5");
+ dhparam = srv ? "1" : "5";
else if (*dhparam == '/')
{
TLS_OK_F(dhparam, "DHParameters",
@@ -3810,9 +3851,9 @@ tls_get_info(ssl, e, srv, host)
cert = SSL_get_peer_certificate(ssl);
if (LogLevel >= 14)
sm_syslog(LOG_INFO, e->e_id,
- "TLS: get_verify in %s: %d get_peer: 0x%x",
+ "TLS: get_verify in %s: %ld get_peer: 0x%lx",
srv ? "srv" : "clt",
- SSL_get_verify_result(ssl), cert);
+ SSL_get_verify_result(ssl), (u_long) cert);
if (cert != NULL)
{
char buf[MAXNAME];
diff --git a/contrib/sendmail/src/stats.c b/contrib/sendmail/src/stats.c
index 383cb37..880f3d9 100644
--- a/contrib/sendmail/src/stats.c
+++ b/contrib/sendmail/src/stats.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: stats.c,v 8.36.14.2 2000/05/25 23:33:34 gshapiro Exp $";
+static char id[] = "@(#)$Id: stats.c,v 8.36.14.3 2000/09/17 17:04:27 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/trace.c b/contrib/sendmail/src/trace.c
index f117598..6f08dea 100644
--- a/contrib/sendmail/src/trace.c
+++ b/contrib/sendmail/src/trace.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: trace.c,v 8.20.22.1 2000/05/25 18:56:18 gshapiro Exp $";
+static char id[] = "@(#)$Id: trace.c,v 8.20.22.2 2000/09/17 17:04:27 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index 4254e58..0a9c287 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -15,9 +15,9 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.12 2000/07/17 19:55:08 ca Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.13 2000/09/26 00:46:21 gshapiro Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.12 2000/07/17 19:55:08 ca Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.13 2000/09/26 00:46:21 gshapiro Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -906,13 +906,13 @@ saslgetrealm(context, id, availrealms, result)
{
if (LogLevel > 12)
sm_syslog(LOG_INFO, NOQID, "saslgetrealm: realm %s available realms %s",
- context,
- availrealms == NULL ? "<No Realms>" : *availrealms);
+ context == NULL ? "<No Context>" : (char *) context,
+ (availrealms == NULL || *availrealms == NULL) ? "<No Realms>" : *availrealms);
if (context == NULL)
return SASL_FAIL;
/* check whether context is in list? */
- if (availrealms != NULL)
+ if (availrealms != NULL && *availrealms != NULL)
{
if (iteminlist(context, (char *)(*availrealms + 1), " ,}") ==
NULL)
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 1a57cda..f3a25f4 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: version.c,v 8.43.4.11 2000/07/19 20:40:59 gshapiro Exp $";
+static char id[] = "@(#)$Id: version.c,v 8.43.4.16 2000/09/21 04:12:23 geir Exp $";
#endif /* ! lint */
-char Version[] = "8.11.0";
+char Version[] = "8.11.1";
OpenPOWER on IntegriCloud