summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2001-08-01 01:33:27 +0000
committergshapiro <gshapiro@FreeBSD.org>2001-08-01 01:33:27 +0000
commite147a0c4ede93cc9e8a78357d38ea4c6183f45ae (patch)
tree18a1edd91ee0b43a66b413b2e9efffbc1a9575f8 /contrib/sendmail/src
parentcceec8d18104db04cf807557e3517e2bc2437b10 (diff)
parent1164bba81c60839834c20d6e34983b4cfb9c05b4 (diff)
downloadFreeBSD-src-e147a0c4ede93cc9e8a78357d38ea4c6183f45ae.zip
FreeBSD-src-e147a0c4ede93cc9e8a78357d38ea4c6183f45ae.tar.gz
This commit was generated by cvs2svn to compensate for changes in r80785,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/README43
-rw-r--r--contrib/sendmail/src/clock.c49
-rw-r--r--contrib/sendmail/src/collect.c5
-rw-r--r--contrib/sendmail/src/daemon.c95
-rw-r--r--contrib/sendmail/src/deliver.c46
-rw-r--r--contrib/sendmail/src/main.c13
-rw-r--r--contrib/sendmail/src/map.c5
-rw-r--r--contrib/sendmail/src/milter.c50
-rw-r--r--contrib/sendmail/src/queue.c50
-rw-r--r--contrib/sendmail/src/readcf.c13
-rw-r--r--contrib/sendmail/src/sendmail.h10
-rw-r--r--contrib/sendmail/src/sfsasl.c16
-rw-r--r--contrib/sendmail/src/srvrsmtp.c6
-rw-r--r--contrib/sendmail/src/usersmtp.c7
-rw-r--r--contrib/sendmail/src/util.c77
-rw-r--r--contrib/sendmail/src/version.c4
16 files changed, 400 insertions, 89 deletions
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index 53380d5..3b9f0f9 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.35 2001/05/09 20:58:32 gshapiro Exp $
+# $Id: README,v 8.263.2.1.2.37 2001/06/03 03:41:12 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -82,7 +82,6 @@ Porting to a new Unix-based system should be a matter of creating
an appropriate configuration file in the devtools/OS/ directory.
-
+----------------------+
| DATABASE DEFINITIONS |
+----------------------+
@@ -178,6 +177,7 @@ addresses, so "^[0-9]+$" would match this. By using such a map in a
check_* rule-set, you can block a certain range of addresses that would
otherwise be considered valid.
+
+---------------+
| COMPILE FLAGS |
+---------------+
@@ -463,6 +463,7 @@ NEEDSGETIPNODE Set this if your system supports IPv6 but doesn't include
the getipnodeby{name,addr}() functions. Set automatically
for Linux's glibc.
+
+-----------------------+
| COMPILE-TIME FEATURES |
+-----------------------+
@@ -600,6 +601,13 @@ SFIO Uses sfio instead of stdio. sfio is available from AT&T
OPERATING SYSTEM AND COMPILE QUIRKS.
+Generic notice: If you enable a compile time option that needs
+libraries or include files that don't come with sendmail or are
+installed in a location that your C compiler doesn't use by default
+you should set confINCDIRS and confLIBDIRS as explained in the
+first section: BUILDING SENDMAIL.
+
+
+---------------------+
| DNS/RESOLVER ISSUES |
+---------------------+
@@ -639,6 +647,7 @@ ResolverOptions setting. However, instead, we recommend catching the
problem and reporting it to the name server administrator so we can rid the
world of broken name servers.
+
+----------------------------------------+
| STARTTLS COMPILATION AND CONFIGURATION |
+----------------------------------------+
@@ -649,11 +658,16 @@ sendmail. See devtools/README how to set the correct compile time
parameters; you should at least set the following variables:
define(`confSTDIO_TYPE', `portable')
-APPENDDEF(`confENVDEF', `-DSFIO')
-APPENDDEF(`confLIBS', `-lsfio')
+APPENDDEF(`conf_sendmail_ENVDEF', `-DSFIO')
+APPENDDEF(`conf_sendmail_LIBS', `-lsfio')
APPENDDEF(`conf_sendmail_ENVDEF', `-DSTARTTLS')
APPENDDEF(`conf_sendmail_LIBS', `-lssl -lcrypto')
+If you have installed the OpenSSL libraries and include files in
+a location that your C compiler doesn't use by default you should
+set confINCDIRS and confLIBDIRS as explained in the first section:
+BUILDING SENDMAIL.
+
Configuration information can be found in doc/op/op.me (required
certificates) and cf/README (how to tell sendmail about certificates).
@@ -667,10 +681,8 @@ there are any problems listed about permissions (unsafe files)
or the validity of X.509 certificates.
Note: sfio must be used in all libraries with which sendmail exchanges
-file pointers. That is, libsmutil must be compiled with sfio, which
-is accomplished by the above config parameters. Another example is
-PH map support. This does not apply to the usual libraries, e.g.,
-OpenSSL, Berkeley DB, Cyrus SASL.
+file pointers. An example is PH map support. This does not apply to the
+usual libraries, e.g., OpenSSL, Berkeley DB, Cyrus SASL.
Further information can be found via:
http://www.sendmail.org/tips/
@@ -682,7 +694,17 @@ http://www.sendmail.org/tips/
Please read the docs accompanying the library (INSTALL and README).
If you use Berkeley DB for Cyrus SASL then you must compile sendmail
-with the same version of Berkeley DB.
+with the same version of Berkeley DB. See devtools/README how to
+set the correct compile time parameters; you should at least set
+the following variables:
+
+APPENDDEF(`conf_sendmail_ENVDEF', `-DSASL')
+APPENDDEF(`conf_sendmail_LIBS', `-lsasl')
+
+If you have installed the Cyrus SASL library and include files in
+a location that your C compiler doesn't use by default you should
+set confINCDIRS and confLIBDIRS as explained in the first section:
+BUILDING SENDMAIL.
You have to select and install authentication mechanisms and tell
sendmail where to find the sasl library and the include files (see
@@ -1599,6 +1621,7 @@ Regular Expressions (MAP_REGEX)
The manual pages have been written against the -man macros, and
should format correctly with any reasonable *roff.
+
+-----------------+
| DEBUGGING HOOKS |
+-----------------+
@@ -1706,4 +1729,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.35 $, last update $Date: 2001/05/09 20:58:32 $ )
+(Version $Revision: 8.263.2.1.2.37 $, last update $Date: 2001/06/03 03:41:12 $ )
diff --git a/contrib/sendmail/src/clock.c b/contrib/sendmail/src/clock.c
index bf5ef1c..1a36478 100644
--- a/contrib/sendmail/src/clock.c
+++ b/contrib/sendmail/src/clock.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: clock.c,v 8.52.18.14 2001/05/17 18:12:28 gshapiro Exp $";
+static char id[] = "@(#)$Id: clock.c,v 8.52.18.17 2001/07/31 23:04:59 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -21,8 +21,8 @@ static char id[] = "@(#)$Id: clock.c,v 8.52.18.14 2001/05/17 18:12:28 gshapiro E
# define sigmask(s) (1 << ((s) - 1))
#endif /* ! sigmask */
-static SIGFUNC_DECL tick __P((int));
-static void endsleep __P((void));
+static SIGFUNC_DECL sm_tick __P((int));
+static void endsleep __P((void));
/*
@@ -119,7 +119,7 @@ sigsafe_setevent(intvl, func, arg)
** This shouldn't happen. If called from setevent(),
** we have just malloced a FreeEventList entry. If
** called from a signal handler, it should have been
- ** from an existing event which tick() just added to the
+ ** from an existing event which sm_tick() just added to the
** FreeEventList.
*/
@@ -143,7 +143,7 @@ sigsafe_setevent(intvl, func, arg)
*evp = ev;
LEAVE_CRITICAL();
- (void) setsignal(SIGALRM, tick);
+ (void) setsignal(SIGALRM, sm_tick);
intvl = EventQueue->ev_time - now;
(void) alarm((unsigned) intvl < 1 ? 1 : intvl);
if (wasblocked == 0)
@@ -247,7 +247,7 @@ clear_events()
(void) releasesignal(SIGALRM);
}
/*
-** TICK -- take a clock tick
+** SM_TICK -- take a clock sm_tick
**
** Called by the alarm clock. This routine runs events as needed.
** Always called as a signal handler, so we assume that SIGALRM
@@ -268,8 +268,8 @@ clear_events()
*/
/* ARGSUSED */
-SIGFUNC_DECL
-tick(sig)
+static SIGFUNC_DECL
+sm_tick(sig)
int sig;
{
register time_t now;
@@ -279,7 +279,7 @@ tick(sig)
(void) alarm(0);
- FIX_SYSV_SIGNAL(sig, tick);
+ FIX_SYSV_SIGNAL(sig, sm_tick);
errno = save_errno;
CHECK_CRITICAL(sig);
@@ -287,8 +287,8 @@ tick(sig)
mypid = getpid();
while (PendingSignal != 0)
{
- int sigbit;
- int sig;
+ int sigbit = 0;
+ int sig = 0;
if (bitset(PEND_SIGHUP, PendingSignal))
{
@@ -321,7 +321,7 @@ tick(sig)
now = curtime();
if (tTd(5, 4))
- dprintf("tick: now=%ld\n", (long) now);
+ dprintf("sm_tick: now=%ld\n", (long) now);
while ((ev = EventQueue) != NULL &&
(ev->ev_time <= now || ev->ev_pid != mypid))
@@ -336,7 +336,7 @@ tick(sig)
EventQueue = EventQueue->ev_link;
LEAVE_CRITICAL();
if (tTd(5, 6))
- dprintf("tick: ev=%lx, func=%lx, arg=%d, pid=%d\n",
+ dprintf("sm_tick: ev=%lx, func=%lx, arg=%d, pid=%d\n",
(u_long) ev, (u_long) ev->ev_func,
ev->ev_arg, ev->ev_pid);
@@ -431,11 +431,32 @@ pend_signal(sig)
if (sigbit != 0)
PendingSignal |= sigbit;
- (void) setsignal(SIGALRM, tick);
+ (void) setsignal(SIGALRM, sm_tick);
(void) alarm(1);
errno = save_errno;
}
/*
+** SM_SIGNAL_NOOP -- A signal no-op function
+**
+** Parameters:
+** sig -- signal received
+**
+** Returns:
+** SIGFUNC_RETURN
+*/
+
+/* ARGSUSED */
+SIGFUNC_DECL
+sm_signal_noop(sig)
+ int sig;
+{
+ int save_errno = errno;
+
+ FIX_SYSV_SIGNAL(sig, sm_signal_noop);
+ errno = save_errno;
+ return SIGFUNC_RETURN;
+}
+ /*
** SLEEP -- a version of sleep that works with this stuff
**
** Because sleep uses the alarm facility, I must reimplement
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index e9a2006..fcf3117 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.21 2001/05/17 18:10:14 gshapiro Exp $";
+static char id[] = "@(#)$Id: collect.c,v 8.136.4.22 2001/06/07 21:01:02 ca Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -352,7 +352,8 @@ bufferchar:
{
*bp++ = c;
hdrslen++;
- if (MaxHeadersLength > 0 &&
+ if (!headeronly &&
+ MaxHeadersLength > 0 &&
hdrslen > MaxHeadersLength)
{
sm_syslog(LOG_NOTICE, e->e_id,
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 1fdd3d7..954d253 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.61 2001/05/27 22:14:40 gshapiro Exp $ (with daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.68 2001/07/20 18:45:58 gshapiro Exp $ (with daemon mode)";
# else /* DAEMON */
-static char id[] = "@(#)$Id: daemon.c,v 8.401.4.61 2001/05/27 22:14:40 gshapiro Exp $ (without daemon mode)";
+static char id[] = "@(#)$Id: daemon.c,v 8.401.4.68 2001/07/20 18:45:58 gshapiro Exp $ (without daemon mode)";
# endif /* DAEMON */
#endif /* ! lint */
@@ -702,7 +702,6 @@ getrequests(e)
(void) setsignal(SIGHUP, SIG_DFL);
(void) setsignal(SIGTERM, intsig);
-
if (!control)
{
define(macid("{daemon_addr}", NULL),
@@ -718,6 +717,7 @@ getrequests(e)
{
if (Daemons[idx].d_socket >= 0)
(void) close(Daemons[idx].d_socket);
+ Daemons[idx].d_socket = -1;
}
clrcontrol();
@@ -2481,15 +2481,26 @@ sighup(sig)
** restarts the daemon or exits if restart fails.
*/
+/* Make a non-DFL/IGN signal a noop */
+#define SM_NOOP_SIGNAL(sig, old) \
+do \
+{ \
+ (old) = setsignal((sig), sm_signal_noop); \
+ if ((old) == SIG_IGN || (old) == SIG_DFL) \
+ (void) setsignal((sig), (old)); \
+} while (0)
+
static void
restart_daemon()
{
int i;
int save_errno;
char *reason;
- sigfunc_t oalrm, ochld, ohup, oint, opipe, oterm, ousr1;
+ sigfunc_t ignore, oalrm, ousr1;
extern int DtableSize;
+ /* clear the events to turn off SIGALRMs */
+ clear_events();
allsignals(TRUE);
reason = RestartRequest;
@@ -2527,28 +2538,37 @@ restart_daemon()
(void) fcntl(i, F_SETFD, j | FD_CLOEXEC);
}
- /* need to allow signals before execve() so make them harmless */
- oalrm = setsignal(SIGALRM, SIG_DFL);
- ochld = setsignal(SIGCHLD, SIG_DFL);
- ohup = setsignal(SIGHUP, SIG_DFL);
- oint = setsignal(SIGINT, SIG_DFL);
- opipe = setsignal(SIGPIPE, SIG_DFL);
- oterm = setsignal(SIGTERM, SIG_DFL);
- ousr1 = setsignal(SIGUSR1, SIG_DFL);
+ /*
+ ** Need to allow signals before execve() to make them "harmless".
+ ** However, the default action can be "terminate", so it isn't
+ ** really harmless. Setting signals to IGN will cause them to be
+ ** ignored in the new process to, so that isn't a good alternative.
+ */
+
+ SM_NOOP_SIGNAL(SIGALRM, oalrm);
+ SM_NOOP_SIGNAL(SIGCHLD, ignore);
+ SM_NOOP_SIGNAL(SIGHUP, ignore);
+ SM_NOOP_SIGNAL(SIGINT, ignore);
+ SM_NOOP_SIGNAL(SIGPIPE, ignore);
+ SM_NOOP_SIGNAL(SIGTERM, ignore);
+#ifdef SIGUSR1
+ SM_NOOP_SIGNAL(SIGUSR1, ousr1);
+#endif /* SIGUSR1 */
allsignals(FALSE);
(void) execve(SaveArgv[0], (ARGV_T) SaveArgv, (ARGV_T) ExternalEnviron);
save_errno = errno;
- /* restore signals */
+ /* block signals again and restore needed signals */
allsignals(TRUE);
+
+ /* For finis() events */
(void) setsignal(SIGALRM, oalrm);
- (void) setsignal(SIGCHLD, ochld);
- (void) setsignal(SIGHUP, ohup);
- (void) setsignal(SIGINT, oint);
- (void) setsignal(SIGPIPE, opipe);
- (void) setsignal(SIGTERM, oterm);
+
+#ifdef SIGUSR1
+ /* For debugging finis() */
(void) setsignal(SIGUSR1, ousr1);
+#endif /* SIGUSR1 */
errno = save_errno;
if (LogLevel > 0)
@@ -2580,6 +2600,19 @@ myhostname(hostbuf, size)
if (gethostname(hostbuf, size) < 0 || hostbuf[0] == '\0')
(void) strlcpy(hostbuf, "localhost", size);
hp = sm_gethostbyname(hostbuf, InetMode);
+# if NETINET && NETINET6
+ if (hp == NULL && InetMode == AF_INET6)
+ {
+ /*
+ ** It's possible that this IPv6 enabled machine doesn't
+ ** actually have any IPv6 interfaces and, therefore, no
+ ** IPv6 addresses. Fall back to AF_INET.
+ */
+
+ hp = sm_gethostbyname(hostbuf, AF_INET);
+ }
+# endif /* NETINET && NETINET6 */
+
if (hp == NULL)
return NULL;
if (strchr(hp->h_name, '.') != NULL || strchr(hostbuf, '.') == NULL)
@@ -2793,10 +2826,30 @@ getauthinfo(fd, may_be_forged)
}
else
{
- /* try to match the reverse against the forward lookup */
- hp = sm_gethostbyname(RealHostName,
- RealHostAddr.sa.sa_family);
+ int family;
+
+ family = RealHostAddr.sa.sa_family;
+# if NETINET6 && NEEDSGETIPNODE
+ /*
+ ** If RealHostAddr is an IPv6 connection with an
+ ** IPv4-mapped address, we need RealHostName's IPv4
+ ** address(es) for addrcmp() to compare against
+ ** RealHostAddr.
+ **
+ ** Actually, we only need to do this for systems
+ ** which NEEDSGETIPNODE since the real getipnodebyname()
+ ** already does V4MAPPED address via the AI_V4MAPPEDCFG
+ ** flag. A better fix to this problem is to add this
+ ** functionality to our stub getipnodebyname().
+ */
+ if (family == AF_INET6 &&
+ IN6_IS_ADDR_V4MAPPED(&RealHostAddr.sin6.sin6_addr))
+ family = AF_INET;
+# endif /* NETINET6 && NEEDSGETIPNODE */
+
+ /* try to match the reverse against the forward lookup */
+ hp = sm_gethostbyname(RealHostName, family);
if (hp == NULL)
*may_be_forged = TRUE;
else
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 347b7a5..70b774d 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.81 2001/05/23 02:15:42 ca Exp $";
+static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.86 2001/07/20 21:52:55 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -1927,6 +1927,9 @@ tryhost:
struct stat stb;
extern int DtableSize;
+ /* clear the events to turn off SIGALRMs */
+ clear_events();
+
/* Reset global flags */
RestartRequest = NULL;
ShutdownRequest = NULL;
@@ -1936,9 +1939,14 @@ tryhost:
(void) close(fileno(e->e_lockfp));
/* child -- set up input & exec mailer */
- (void) setsignal(SIGINT, SIG_IGN);
+ (void) setsignal(SIGALRM, sm_signal_noop);
+ (void) setsignal(SIGCHLD, SIG_DFL);
(void) setsignal(SIGHUP, SIG_IGN);
+ (void) setsignal(SIGINT, SIG_IGN);
(void) setsignal(SIGTERM, SIG_DFL);
+# ifdef SIGUSR1
+ (void) setsignal(SIGUSR1, sm_signal_noop);
+# endif /* SIGUSR1 */
if (m != FileMailer || stat(tochain->q_user, &stb) < 0)
stb.st_mode = 0;
@@ -2071,7 +2079,19 @@ tryhost:
/* reset user id */
endpwent();
if (bitnset(M_SPECIFIC_UID, m->m_flags))
+ {
new_euid = m->m_uid;
+
+ /*
+ ** Undo the effects of the uid change in main
+ ** for signal handling. The real uid may
+ ** be used by mailer in adding a "From "
+ ** line.
+ */
+
+ if (RealUid != 0 && RealUid != getuid())
+ new_ruid = RealUid;
+ }
else if (bitset(S_ISUID, stb.st_mode))
new_ruid = stb.st_uid;
else if (ctladdr != NULL && ctladdr->q_uid != 0)
@@ -2091,6 +2111,22 @@ tryhost:
vendor_set_uid(new_euid);
# if MAILER_SETUID_METHOD == USE_SETEUID
+# if HASSETREUID
+ /*
+ ** Undo the effects of the uid change in main
+ ** for signal handling. The real uid may
+ ** be used by mailer in adding a "From "
+ ** line.
+ */
+
+ if (new_ruid != NO_UID &&
+ setreuid(RealUid, geteuid()) < 0)
+ {
+ syserr("openmailer: setreuid(%d, %d) failed",
+ (int) new_ruid, (int) geteuid());
+ exit(EX_OSERR);
+ }
+# endif /* HASSETREUID */
if (seteuid(new_euid) < 0 && suidwarn)
{
syserr("openmailer: seteuid(%ld) failed",
@@ -3045,7 +3081,7 @@ markfailure(e, q, mci, rcode, ovr)
** and if it represents an error, we print it.
**
** Parameters:
-** pid -- pid of mailer.
+** mci -- the mailer connection info.
** e -- the current envelope.
** pv -- the parameter vector that invoked the mailer
** (for error messages).
@@ -4925,11 +4961,13 @@ hostsignature(m, host)
nmx = getmxrr(hp, mxhosts, mxprefs, TRUE, &rcode);
if (nmx <= 0)
{
+ int save_errno;
register MCI *mci;
/* update the connection info for this host */
+ save_errno = errno;
mci = mci_get(hp, m);
- mci->mci_errno = errno;
+ mci->mci_errno = save_errno;
mci->mci_herrno = h_errno;
mci->mci_lastuse = now;
if (rcode == EX_NOHOST)
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index 34d5041..c09daa5 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.60 2001/05/27 22:00:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: main.c,v 8.485.4.65 2001/07/20 00:53:00 gshapiro Exp $";
#endif /* ! lint */
#define _DEFINE
@@ -35,7 +35,9 @@ static char id[] = "@(#)$Id: main.c,v 8.485.4.60 2001/05/27 22:00:26 gshapiro Ex
static SIGFUNC_DECL intindebug __P((int));
static SIGFUNC_DECL quiesce __P((int));
+#ifdef SIGUSR1
static SIGFUNC_DECL sigusr1 __P((int));
+# endif /* SIGUSR1 */
static SIGFUNC_DECL term_daemon __P((int));
static void dump_class __P((STAB *, int));
static void obsolete __P((char **));
@@ -2156,7 +2158,7 @@ finis(drop, exitstat)
{
/* Still want to process new timeouts added below */
clear_events();
- releasesignal(SIGALRM);
+ (void) releasesignal(SIGALRM);
if (tTd(2, 1))
{
@@ -2272,7 +2274,8 @@ shutdown_daemon()
PendingSignal = 0;
if (LogLevel > 79)
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "interrupt");
+ sm_syslog(LOG_DEBUG, CurEnv->e_id, "interrupt (%s)",
+ reason == NULL ? "implicit call" : reason);
FileName = NULL;
closecontrolsocket(TRUE);
@@ -2347,7 +2350,7 @@ intsig(sig)
drop = TRUE;
}
- else
+ else if (OpMode != MD_TEST)
unlockqueue(CurEnv);
finis(drop, EX_OK);
@@ -2758,6 +2761,7 @@ dumpstate(when)
}
sm_syslog(LOG_DEBUG, CurEnv->e_id, "--- end of state dump ---");
}
+#ifdef SIGUSR1
/*
** SIGUSR1 -- Signal a request to dump state.
**
@@ -2788,6 +2792,7 @@ sigusr1(sig)
errno = save_errno;
return SIGFUNC_RETURN;
}
+# endif /* SIGUSR1 */
/*
** DROP_PRIVILEGES -- reduce privileges to those of the RunAsUser option
**
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index fc0d07f..04b040f 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.53 2001/05/04 01:29:00 gshapiro Exp $";
+static char id[] = "@(#)$Id: map.c,v 8.414.4.54 2001/06/01 08:23:24 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -126,9 +126,6 @@ static bool text_getcanonname __P((char *, int, int *));
# define LOCK_ON_OPEN 0 /* no such luck -- bend over backwards */
#endif /* O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL */
-#ifndef O_ACCMODE
-# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-#endif /* ! O_ACCMODE */
/*
** MAP_PARSEARGS -- parse config line arguments for database lookup
**
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index f4ce5b8..5d5d260 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.46 2001/05/11 18:11:36 gshapiro Exp $";
+static char id[] = "@(#)$Id: milter.c,v 8.50.4.51 2001/07/20 00:53:01 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -26,6 +26,7 @@ static char id[] = "@(#)$Id: milter.c,v 8.50.4.46 2001/05/11 18:11:36 gshapiro E
# define SM_FD_ISSET FD_ISSET
# define SM_FD_SETSIZE FD_SETSIZE
+static void milter_connect_timeout __P((void));
static void milter_error __P((struct milter *));
static int milter_open __P((struct milter *, bool, ENVELOPE *));
static void milter_parse_timeouts __P((char *, struct milter *));
@@ -511,6 +512,8 @@ milter_write(m, cmd, buf, len, to, e)
** -1 otherwise.
*/
+static jmp_buf MilterConnectTimeout;
+
static int
milter_open(m, parseonly, e)
struct milter *m;
@@ -950,8 +953,23 @@ milter_open(m, parseonly, e)
return -1;
}
- if (connect(sock, (struct sockaddr *) &addr, addrlen) >= 0)
- break;
+ if (setjmp(MilterConnectTimeout) == 0)
+ {
+ EVENT *ev = NULL;
+ int i;
+
+ if (m->mf_timeout[SMFTO_CONNECT] > 0)
+ ev = setevent(m->mf_timeout[SMFTO_CONNECT],
+ milter_connect_timeout, 0);
+
+ i = connect(sock, (struct sockaddr *) &addr, addrlen);
+ save_errno = errno;
+ if (ev != NULL)
+ clrevent(ev);
+ errno = save_errno;
+ if (i >= 0)
+ break;
+ }
/* couldn't connect.... try next address */
save_errno = errno;
@@ -1006,6 +1024,8 @@ milter_open(m, parseonly, e)
}
continue;
}
+ p = CurHostName;
+ CurHostName = at;
if (tTd(64, 5))
dprintf("X%s: error connecting to filter: %s\n",
m->mf_name, errstring(save_errno));
@@ -1013,6 +1033,7 @@ milter_open(m, parseonly, e)
sm_syslog(LOG_ERR, e->e_id,
"X%s: error connecting to filter: %s",
m->mf_name, errstring(save_errno));
+ CurHostName = p;
milter_error(m);
# if _FFR_FREEHOSTENT && NETINET6
if (hp != NULL)
@@ -1030,6 +1051,19 @@ milter_open(m, parseonly, e)
# endif /* _FFR_FREEHOSTENT && NETINET6 */
return sock;
}
+
+static void
+milter_connect_timeout()
+{
+ /*
+ ** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
+ ** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
+ ** DOING.
+ */
+
+ errno = ETIMEDOUT;
+ longjmp(MilterConnectTimeout, 1);
+}
/*
** MILTER_SETUP -- setup structure for a mail filter
**
@@ -1066,6 +1100,7 @@ milter_setup(line)
m->mf_name = newstr(line);
m->mf_state = SMFS_READY;
m->mf_sock = -1;
+ m->mf_timeout[SMFTO_CONNECT] = (time_t) 0;
m->mf_timeout[SMFTO_WRITE] = (time_t) 10;
m->mf_timeout[SMFTO_READ] = (time_t) 10;
m->mf_timeout[SMFTO_EOM] = (time_t) 300;
@@ -1097,6 +1132,10 @@ milter_setup(line)
/* install the field into the filter struct */
switch (fcode)
{
+ case 'C':
+ m->mf_timeout[SMFTO_CONNECT] = convtime(p, 's');
+ break;
+
case 'S': /* socket */
if (p == NULL)
m->mf_conn = NULL;
@@ -2851,7 +2890,10 @@ milter_connect(hostname, addr, e, state)
# if NETINET6
case AF_INET6:
- family = SMFIA_INET6;
+ if (IN6_IS_ADDR_V4MAPPED(&addr.sin6.sin6_addr))
+ family = SMFIA_INET;
+ else
+ family = SMFIA_INET6;
port = htons(addr.sin6.sin6_port);
sockinfo = anynet_ntop(&addr.sin6.sin6_addr, buf6,
sizeof buf6);
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index 6a66cf6..aeed7f9 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.55 2001/05/03 23:37:11 gshapiro Exp $ (with queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.62 2001/07/20 00:53:01 gshapiro Exp $ (with queueing)";
# else /* QUEUE */
-static char id[] = "@(#)$Id: queue.c,v 8.343.4.55 2001/05/03 23:37:11 gshapiro Exp $ (without queueing)";
+static char id[] = "@(#)$Id: queue.c,v 8.343.4.62 2001/07/20 00:53:01 gshapiro Exp $ (without queueing)";
# endif /* QUEUE */
#endif /* ! lint */
@@ -68,6 +68,35 @@ static int workcmpf2();
static int workcmpf3();
static int workcmpf4();
+/*
+** Current qf file field assignments:
+**
+** A AUTH= parameter
+** B body type
+** C controlling user
+** D data file name
+** E error recipient
+** F flag bits
+** G queue delay algorithm
+** H header
+** I data file's inode number
+** K time of last delivery attempt
+** L Solaris Content-Length: header (obsolete)
+** M message (obsolete)
+** N number of delivery attempts
+** P message priority
+** Q original recipient (ORCPT=)
+** R recipient
+** S sender
+** T init time
+** V queue file version
+** X character set (_FFR_SAVE_CHARSET)
+** Y current delay
+** Z original envelope id from ESMTP
+** $ define macro
+** . terminate file
+*/
+
/*
** QUEUEUP -- queue a message up for future transmission.
**
@@ -374,6 +403,7 @@ queueup(e, announce)
if (q->q_orcpt != NULL)
fprintf(tfp, "Q%s\n",
denlstring(q->q_orcpt, TRUE, FALSE));
+
(void) putc('R', tfp);
if (bitset(QPRIMARY, q->q_flags))
(void) putc('P', tfp);
@@ -2151,15 +2181,15 @@ readqf(e)
/* regenerated below */
break;
- case 'K': /* time of last delivery attempt */
+ case 'K': /* time of last delivery attempt */
e->e_dtime = atol(&buf[1]);
break;
# if _FFR_QUEUEDELAY
- case 'G': /* queue delay algorithm */
+ case 'G': /* queue delay algorithm */
e->e_queuealg = atoi(&buf[1]);
break;
- case 'Y': /* current delay */
+ case 'Y': /* current delay */
e->e_queuedelay = (time_t) atol(&buf[1]);
break;
# endif /* _FFR_QUEUEDELAY */
@@ -2933,7 +2963,15 @@ setctluser(user, qfver)
if ((p = strtok(NULL, ":")) != NULL)
a->q_gid = atoi(p);
if ((p = strtok(NULL, ":")) != NULL)
+ {
+ char *o;
+
a->q_flags |= QGOODUID;
+
+ /* if there is another ':': restore it */
+ if ((o = strtok(NULL, ":")) != NULL && o > p)
+ o[-1] = ':';
+ }
}
else if ((pw = sm_getpwnam(user)) != NULL)
{
@@ -3086,7 +3124,7 @@ setnewqueue(e)
return;
}
- if (NumQueues == 1)
+ if (NumQueues <= 1)
idx = 0;
else
{
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index f8aefd1..cb1923b 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.40 2001/05/03 17:24:13 gshapiro Exp $";
+static char id[] = "@(#)$Id: readcf.c,v 8.382.4.42 2001/07/31 22:30:24 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -3380,6 +3380,7 @@ settimeout(name, val, sticky)
{
register struct timeoutinfo *to;
int i;
+ int addopts;
time_t toval;
if (tTd(37, 2))
@@ -3413,6 +3414,7 @@ settimeout(name, val, sticky)
dprintf("\n");
toval = convtime(val, 'm');
+ addopts = 0;
switch (to->to_code)
{
@@ -3481,6 +3483,7 @@ settimeout(name, val, sticky)
TimeOuts.to_q_warning[TOC_NORMAL] = toval;
TimeOuts.to_q_warning[TOC_URGENT] = toval;
TimeOuts.to_q_warning[TOC_NONURGENT] = toval;
+ addopts = 2;
break;
case TO_QUEUEWARN_NORMAL:
@@ -3503,6 +3506,7 @@ settimeout(name, val, sticky)
TimeOuts.to_q_return[TOC_NORMAL] = toval;
TimeOuts.to_q_return[TOC_URGENT] = toval;
TimeOuts.to_q_return[TOC_NONURGENT] = toval;
+ addopts = 2;
break;
case TO_QUEUERETURN_NORMAL:
@@ -3530,6 +3534,7 @@ settimeout(name, val, sticky)
TimeOuts.res_retrans[RES_TO_DEFAULT] = toval;
TimeOuts.res_retrans[RES_TO_FIRST] = toval;
TimeOuts.res_retrans[RES_TO_NORMAL] = toval;
+ addopts = 2;
break;
case TO_RESOLVER_RETRY:
@@ -3537,6 +3542,7 @@ settimeout(name, val, sticky)
TimeOuts.res_retry[RES_TO_DEFAULT] = i;
TimeOuts.res_retry[RES_TO_FIRST] = i;
TimeOuts.res_retry[RES_TO_NORMAL] = i;
+ addopts = 2;
break;
case TO_RESOLVER_RETRANS_NORMAL:
@@ -3565,7 +3571,10 @@ settimeout(name, val, sticky)
}
if (sticky)
- setbitn(to->to_code, StickyTimeoutOpt);
+ {
+ for (i = 0; i <= addopts; i++)
+ setbitn(to->to_code + i, StickyTimeoutOpt);
+ }
}
/*
** INITTIMEOUTS -- parse and set timeout values
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 17f379f..1ead2de 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.64 2001/05/23 17:49:13 ca Exp $";
+static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.69 2001/07/20 18:46:01 gshapiro Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
@@ -1360,8 +1360,9 @@ extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
#define SMFTO_WRITE 0 /* Timeout for sending information */
#define SMFTO_READ 1 /* Timeout waiting for a response */
#define SMFTO_EOM 2 /* Timeout for ACK/NAK to EOM */
+#define SMFTO_CONNECT 3 /* Timeout for connect() */
-#define SMFTO_NUM_TO 3 /* Total number of timeouts */
+#define SMFTO_NUM_TO 4 /* Total number of timeouts */
struct milter
{
@@ -1649,13 +1650,14 @@ do \
} while (0)
#define CHECK_CRITICAL(sig) \
+do \
{ \
if (InCriticalSection > 0 && (sig) != 0) \
{ \
pend_signal((sig)); \
return SIGFUNC_RETURN; \
} \
-}
+} while (0)
/* reset signal in case System V semantics */
#ifdef SYS5SIGNALS
@@ -2114,6 +2116,7 @@ extern SIGFUNC_DECL reapchild __P((int));
extern int releasesignal __P((int));
extern void resetlimits __P((void));
extern bool rfc822_string __P((char *));
+extern FILE *safefopen __P((char *, int, int, long));
extern void savemail __P((ENVELOPE *, bool));
extern void seed_random __P((void));
extern void sendtoargv __P((char **, ENVELOPE *));
@@ -2139,6 +2142,7 @@ extern int sm_getla __P((ENVELOPE *));
extern struct passwd *sm_getpwnam __P((char *));
extern struct passwd *sm_getpwuid __P((UID_T));
extern void sm_setproctitle __P((bool, ENVELOPE *, const char *, ...));
+extern SIGFUNC_DECL sm_signal_noop __P((int));
extern int sm_strcasecmp __P((const char *, const char *));
extern void stop_sendmail __P((void));
extern bool strcontainedin __P((char *, char *));
diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c
index 17e90be..8ac3428 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.14 2001/05/03 17:24:16 gshapiro Exp $";
+static char id[] = "@(#)$Id: sfsasl.c,v 8.17.4.15 2001/07/11 17:37:07 gshapiro Exp $";
#endif /* ! lint */
#if SFIO
@@ -168,18 +168,19 @@ sfdcsasl(fin, fout, conn)
# include "sfsasl.h"
# include <openssl/err.h>
-static ssize_t
# if SFIO
+static ssize_t
tls_read(f, buf, size, disc)
Sfio_t *f;
Void_t *buf;
size_t size;
Sfdisc_t *disc;
# else /* SFIO */
+static int
tls_read(disc, buf, size)
void *disc;
- void *buf;
- size_t size;
+ char *buf;
+ int size;
# endif /* SFIO */
{
int r;
@@ -226,18 +227,19 @@ tls_read(disc, buf, size)
return r;
}
-static ssize_t
# if SFIO
+static ssize_t
tls_write(f, buf, size, disc)
Sfio_t *f;
const Void_t *buf;
size_t size;
Sfdisc_t *disc;
# else /* SFIO */
+static int
tls_write(disc, buf, size)
void *disc;
- const void *buf;
- size_t size;
+ const char *buf;
+ int size;
# endif /* SFIO */
{
int r;
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index f655565..89bcb0c 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -16,9 +16,9 @@
#ifndef lint
# if SMTP
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.77 2001/05/27 22:20:30 gshapiro Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.78 2001/06/26 18:52:21 gshapiro Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.77 2001/05/27 22:20:30 gshapiro Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.78 2001/06/26 18:52:21 gshapiro Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -768,7 +768,7 @@ smtp(nullserver, d_flags, e)
if (bitnset(D_ETRNONLY, d_flags) &&
nullserver == NULL)
break;
- continue;
+ /* FALLTHROUGH */
default:
if (++badcommands > MAXBADCOMMANDS)
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index a1aeac5..a9476fe 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.33 2001/05/23 18:53:09 ca Exp $ (with SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.34 2001/06/26 21:55:23 gshapiro Exp $ (with SMTP)";
# else /* SMTP */
-static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.33 2001/05/23 18:53:09 ca Exp $ (without SMTP)";
+static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.34 2001/06/26 21:55:23 gshapiro Exp $ (without SMTP)";
# endif /* SMTP */
#endif /* ! lint */
@@ -1873,6 +1873,9 @@ smtpdata(m, mci, e)
if (Verbose)
nmessage(">>> .");
+ sm_syslog(LOG_CRIT, e->e_id,
+ "%.100s: SMTP DATA-1 protocol error: remote server returned response before final dot",
+ CurHostName);
mci->mci_errno = EIO;
mci->mci_state = MCIS_ERROR;
mci_setstat(mci, EX_PROTOCOL, "5.5.0", NULL);
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index f023865..2017211 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.23 2001/05/17 18:10:18 gshapiro Exp $";
+static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.26 2001/06/01 08:23:25 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -2529,6 +2529,81 @@ proc_list_display(out)
}
}
/*
+** SAFEFOPEN -- do a file open with extra checking
+**
+** Parameters:
+** fn -- the file name to open.
+** omode -- the open-style mode flags.
+** cmode -- the create-style mode flags.
+** sff -- safefile flags.
+**
+** Returns:
+** Same as fopen.
+*/
+
+FILE *
+safefopen(fn, omode, cmode, sff)
+ char *fn;
+ int omode;
+ int cmode;
+ long sff;
+{
+ int fd;
+ int save_errno;
+ FILE *fp;
+ char *fmode;
+
+ switch (omode & O_ACCMODE)
+ {
+ case O_RDONLY:
+ fmode = "r";
+ break;
+
+ case O_WRONLY:
+ if (bitset(O_APPEND, omode))
+ fmode = "a";
+ else
+ fmode = "w";
+ break;
+
+ case O_RDWR:
+ if (bitset(O_TRUNC, omode))
+ fmode = "w+";
+ else if (bitset(O_APPEND, omode))
+ fmode = "a+";
+ else
+ fmode = "r+";
+ break;
+
+ default:
+ syserr("554 5.3.5 safefopen: unknown omode %o", omode);
+ fmode = "x";
+ }
+ fd = safeopen(fn, omode, cmode, sff);
+ if (fd < 0)
+ {
+ save_errno = errno;
+ if (tTd(44, 10))
+ dprintf("safefopen: safeopen failed: %s\n",
+ errstring(errno));
+ errno = save_errno;
+ return NULL;
+ }
+ fp = fdopen(fd, fmode);
+ if (fp != NULL)
+ return fp;
+
+ save_errno = errno;
+ if (tTd(44, 10))
+ {
+ dprintf("safefopen: fdopen(%s, %s) failed: omode=%x, sff=%lx, err=%s\n",
+ fn, fmode, omode, sff, errstring(errno));
+ }
+ (void) close(fd);
+ errno = save_errno;
+ return NULL;
+}
+ /*
** SM_STRCASECMP -- 8-bit clean version of strcasecmp
**
** Thank you, vendors, for making this all necessary.
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 3b4c4e8..ac05788 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.33 2001/05/27 21:39:21 gshapiro Exp $";
+static char id[] = "@(#)$Id: version.c,v 8.43.4.37 2001/07/31 22:34:20 gshapiro Exp $";
#endif /* ! lint */
-char Version[] = "8.11.4";
+char Version[] = "8.11.5";
OpenPOWER on IntegriCloud