summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2006-06-14 16:23:02 +0000
committergshapiro <gshapiro@FreeBSD.org>2006-06-14 16:23:02 +0000
commit1024e3943e17bd4407f0cf3a799cfa05d59f1059 (patch)
tree6f072dad611b3ce7872008bf9d66b23a34c28039 /contrib/sendmail/src
parentef9770707c0f88e94a0c4a409f8fb74cea250716 (diff)
downloadFreeBSD-src-1024e3943e17bd4407f0cf3a799cfa05d59f1059.zip
FreeBSD-src-1024e3943e17bd4407f0cf3a799cfa05d59f1059.tar.gz
Import sendmail 8.13.7
Security: FreeBSD-SA-06:17.sendmail
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/README16
-rw-r--r--contrib/sendmail/src/bf.c7
-rw-r--r--contrib/sendmail/src/collect.c4
-rw-r--r--contrib/sendmail/src/conf.c4
-rw-r--r--contrib/sendmail/src/daemon.c27
-rw-r--r--contrib/sendmail/src/deliver.c25
-rw-r--r--contrib/sendmail/src/domain.c14
-rw-r--r--contrib/sendmail/src/envelope.c9
-rw-r--r--contrib/sendmail/src/headers.c8
-rw-r--r--contrib/sendmail/src/helpfile18
-rw-r--r--contrib/sendmail/src/main.c26
-rw-r--r--contrib/sendmail/src/map.c6
-rw-r--r--contrib/sendmail/src/mci.c10
-rw-r--r--contrib/sendmail/src/mime.c42
-rw-r--r--contrib/sendmail/src/parseaddr.c16
-rw-r--r--contrib/sendmail/src/queue.c20
-rw-r--r--contrib/sendmail/src/savemail.c10
-rw-r--r--contrib/sendmail/src/sendmail.h7
-rw-r--r--contrib/sendmail/src/sfsasl.c17
-rw-r--r--contrib/sendmail/src/sfsasl.h8
-rw-r--r--contrib/sendmail/src/srvrsmtp.c39
-rw-r--r--contrib/sendmail/src/tls.c45
-rw-r--r--contrib/sendmail/src/util.c14
-rw-r--r--contrib/sendmail/src/version.c4
24 files changed, 276 insertions, 120 deletions
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index b393613..1ed29b1 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.388 2005/07/26 05:45:39 ca Exp $
+# $Id: README,v 8.389 2006/05/02 16:58:50 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -1716,6 +1716,18 @@ Regular Expressions (MAP_REGEX)
Make sure, your compiler reads regex.h from the distribution,
not from /usr/include, otherwise sendmail will dump a core.
+Fedora Core 5, 64 bit version
+ If the ld stage fails with undefined functions like
+ __res_querydomain, __dn_expand
+ then add these lines to devtools/Site/site.config.m4
+
+ APPENDDEF(`confLIBDIRS', `-L/usr/lib64')
+ APPENDDEF(`confINCDIRS', `-I/usr/include/bind9')
+
+ and rebuild (sh ./Build -c).
+
+ Problem noted by Daniel Krones, solution suggested by
+ Anthony Howe.
+--------------+
| MANUAL PAGES |
@@ -1832,4 +1844,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.388 $, last update $Date: 2005/07/26 05:45:39 $ )
+(Version $Revision: 8.389 $, last update $Date: 2006/05/02 16:58:50 $ )
diff --git a/contrib/sendmail/src/bf.c b/contrib/sendmail/src/bf.c
index 87bef77..b31ce7e 100644
--- a/contrib/sendmail/src/bf.c
+++ b/contrib/sendmail/src/bf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2002, 2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2002, 2004, 2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -18,7 +18,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: bf.c,v 8.61 2004/08/03 23:59:02 ca Exp $")
+SM_RCSID("@(#)$Id: bf.c,v 8.62 2006/03/31 18:45:56 ca Exp $")
#include <sys/types.h>
#include <sys/stat.h>
@@ -540,13 +540,16 @@ sm_bfwrite(fp, buf, nbytes)
if (!bfp->bf_ondisk)
{
MODE_T omask;
+ int save_errno;
/* Clear umask as bf_filemode are the true perms */
omask = umask(0);
retval = OPEN(bfp->bf_filename,
O_RDWR | O_CREAT | O_TRUNC | QF_O_EXTRA,
bfp->bf_filemode, bfp->bf_flags);
+ save_errno = errno;
(void) umask(omask);
+ errno = save_errno;
/* Couldn't create file: failure */
if (retval < 0)
diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c
index 0bfe3f2..534ce9c 100644
--- a/contrib/sendmail/src/collect.c
+++ b/contrib/sendmail/src/collect.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: collect.c,v 8.272 2006/03/02 19:09:26 ca Exp $")
+SM_RCSID("@(#)$Id: collect.c,v 8.273 2006/03/31 18:51:47 ca Exp $")
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
@@ -857,6 +857,8 @@ readerr:
q->q_state = QS_FATALERR;
}
+ (void) sm_io_close(df, SM_TIME_DEFAULT);
+ df = NULL;
finis(true, true, ExitStat);
/* NOTREACHED */
}
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index f8cd300..1cf447d 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: conf.c,v 8.1081 2006/02/24 02:21:53 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.1082 2006/03/22 22:49:33 ca Exp $")
#include <sendmail/pathnames.h>
#if NEWDB
@@ -2197,7 +2197,7 @@ shouldqueue(pri, ct)
memfree < QueueLowMem)
{
if (tTd(3, 30))
- sm_dprintf("true (memfree=%ld < QueueLowMem)\n",
+ sm_dprintf("true (memfree=%ld < QueueLowMem=%ld)\n",
memfree, QueueLowMem);
return true;
}
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 9bbde39..6d366d9 100644
--- a/contrib/sendmail/src/daemon.c
+++ b/contrib/sendmail/src/daemon.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: daemon.c,v 8.665 2006/03/02 19:12:00 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.666 2006/04/18 01:23:42 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -520,18 +520,22 @@ getrequests(e)
syserr("getrequests: accept");
- /* arrange to re-open the socket next time around */
- (void) close(Daemons[curdaemon].d_socket);
- Daemons[curdaemon].d_socket = -1;
+ if (curdaemon >= 0)
+ {
+ /* arrange to re-open socket next time around */
+ (void) close(Daemons[curdaemon].d_socket);
+ Daemons[curdaemon].d_socket = -1;
#if SO_REUSEADDR_IS_BROKEN
- /*
- ** Give time for bound socket to be released.
- ** This creates a denial-of-service if you can
- ** force accept() to fail on affected systems.
- */
+ /*
+ ** Give time for bound socket to be released.
+ ** This creates a denial-of-service if you can
+ ** force accept() to fail on affected systems.
+ */
- Daemons[curdaemon].d_refuse_connections_until = curtime() + 15;
+ Daemons[curdaemon].d_refuse_connections_until =
+ curtime() + 15;
#endif /* SO_REUSEADDR_IS_BROKEN */
+ }
continue;
}
@@ -2083,7 +2087,7 @@ makeconnection(host, port, mci, e, enough)
SOCKADDR clt_addr;
int save_errno = 0;
volatile SOCKADDR_LEN_T addrlen;
- volatile bool firstconnect;
+ volatile bool firstconnect = true;
SM_EVENT *volatile ev = NULL;
#if NETINET6
volatile bool v6found = false;
@@ -2486,7 +2490,6 @@ gothostent:
}
#endif /* XLA */
- firstconnect = true;
for (;;)
{
if (tTd(16, 1))
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 0458047..6454da7 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/time.h>
-SM_RCSID("@(#)$Id: deliver.c,v 8.1000 2006/03/02 01:37:39 ca Exp $")
+SM_RCSID("@(#)$Id: deliver.c,v 8.1003.2.1 2006/05/23 01:32:08 ca Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -3127,15 +3127,18 @@ reconnect: /* after switching to an encrypted connection */
if (result == SASL_OK && *ssf > 0)
{
+ int tmo;
+
/*
** Convert I/O layer to use SASL.
** If the call fails, the connection
** is aborted.
*/
+ tmo = DATA_PROGRESS_TIMEOUT * 1000;
if (sfdcsasl(&mci->mci_in,
&mci->mci_out,
- mci->mci_conn) == 0)
+ mci->mci_conn, tmo) == 0)
{
mci->mci_flags &= ~MCIF_EXTENS;
mci->mci_flags |= MCIF_AUTHACT|
@@ -3961,7 +3964,11 @@ giveresponse(status, dsn, m, mci, ctladdr, xstart, e, to)
char *exmsg;
if (e == NULL)
+ {
syserr("giveresponse: null envelope");
+ /* NOTREACHED */
+ SM_ASSERT(0);
+ }
/*
** Compute status message from code.
@@ -4623,7 +4630,7 @@ putbody(mci, e, separator)
/* now do the hard work */
boundaries[0] = NULL;
mci->mci_flags |= MCIF_INHEADER;
- if (mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER) ==
+ if (mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER, 0) ==
SM_IO_EOF)
goto writeerr;
}
@@ -4654,7 +4661,7 @@ putbody(mci, e, separator)
SuprErrs = true;
if (mime8to7(mci, e->e_header, e, boundaries,
- M87F_OUTER|M87F_NO8TO7) == SM_IO_EOF)
+ M87F_OUTER|M87F_NO8TO7, 0) == SM_IO_EOF)
goto writeerr;
/* restore SuprErrs */
@@ -5217,8 +5224,14 @@ mailfile(filename, mailer, ctladdr, sfflags, e)
CurrentPid = getpid();
if (e->e_lockfp != NULL)
- (void) close(sm_io_getinfo(e->e_lockfp, SM_IO_WHAT_FD,
- NULL));
+ {
+ int fd;
+
+ fd = sm_io_getinfo(e->e_lockfp, SM_IO_WHAT_FD, NULL);
+ /* SM_ASSERT(fd >= 0); */
+ if (fd >= 0)
+ (void) close(fd);
+ }
(void) sm_signal(SIGINT, SIG_DFL);
(void) sm_signal(SIGHUP, SIG_DFL);
diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c
index e12baad..81e64d1 100644
--- a/contrib/sendmail/src/domain.c
+++ b/contrib/sendmail/src/domain.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2004, 2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1986, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -14,9 +14,9 @@
#include <sendmail.h>
#if NAMED_BIND
-SM_RCSID("@(#)$Id: domain.c,v 8.197 2005/03/04 00:54:42 ca Exp $ (with name server)")
+SM_RCSID("@(#)$Id: domain.c,v 8.199 2006/04/18 00:00:34 ca Exp $ (with name server)")
#else /* NAMED_BIND */
-SM_RCSID("@(#)$Id: domain.c,v 8.197 2005/03/04 00:54:42 ca Exp $ (without name server)")
+SM_RCSID("@(#)$Id: domain.c,v 8.199 2006/04/18 00:00:34 ca Exp $ (without name server)")
#endif /* NAMED_BIND */
#if NAMED_BIND
@@ -521,7 +521,7 @@ punt:
}
# if NETINET6
freehostent(h);
- hp = NULL;
+ h = NULL;
# endif /* NETINET6 */
}
if (strlen(host) >= sizeof MXHostBuf)
@@ -972,11 +972,7 @@ nexttype:
/* avoid problems after truncation in tcp packets */
if (ret > sizeof(answer))
ret = sizeof(answer);
- if (ret < 0)
- {
- *statp = EX_SOFTWARE;
- return false;
- }
+ SM_ASSERT(ret >= 0);
/*
** Appear to have a match. Confirm it by searching for A or
diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c
index 164ed6f..50009a4 100644
--- a/contrib/sendmail/src/envelope.c
+++ b/contrib/sendmail/src/envelope.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: envelope.c,v 8.295 2005/06/15 20:32:18 ca Exp $")
+SM_RCSID("@(#)$Id: envelope.c,v 8.296 2006/03/31 18:53:50 ca Exp $")
/*
** CLRSESSENVELOPE -- clear session oriented data in an envelope
@@ -519,7 +519,14 @@ simpledrop:
printenvflags(e);
}
if (!panic)
+ {
+ if (e->e_dfp != NULL)
+ {
+ (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
+ e->e_dfp = NULL;
+ }
(void) xunlink(queuename(e, DATAFL_LETTER));
+ }
if (panic && QueueMode == QM_LOST)
{
/*
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index 96d6e55..8a142d2 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: headers.c,v 8.290 2006/02/25 02:16:52 ca Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.291 2006/03/24 01:01:56 ca Exp $")
static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *));
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
@@ -1542,7 +1542,7 @@ crackaddr(addr, e)
** flags -- MIME conversion flags.
**
** Returns:
-** success
+** true iff header part was written successfully
**
** Side Effects:
** none.
@@ -1810,7 +1810,7 @@ putheader(mci, hdr, e, flags)
** mci -- the connection info for output
**
** Returns:
-** success
+** true iff header was written successfully
*/
static bool
@@ -1871,7 +1871,7 @@ put_vanilla_header(h, v, mci)
** e -- the envelope containing the message.
**
** Returns:
-** success
+** true iff header field was written successfully
**
** Side Effects:
** outputs "p" to file "fp".
diff --git a/contrib/sendmail/src/helpfile b/contrib/sendmail/src/helpfile
index 5c502d3..d5d55e8 100644
--- a/contrib/sendmail/src/helpfile
+++ b/contrib/sendmail/src/helpfile
@@ -1,6 +1,6 @@
#vers 2
cpyr
-cpyr Copyright (c) 1998-2000, 2002, 2004, 2005 Sendmail, Inc. and its suppliers.
+cpyr Copyright (c) 1998-2000, 2002, 2004-2006 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.45 2005/09/13 00:05:23 ca Exp $$
+cpyr $$Id: helpfile,v 8.47 2006/04/26 18:22:54 ca Exp $$
cpyr
smtp This is sendmail version $v
smtp Topics:
@@ -20,8 +20,8 @@ smtp RSET NOOP QUIT HELP VRFY
smtp EXPN VERB ETRN DSN AUTH
smtp STARTTLS
smtp For more info use "HELP <topic>".
-smtp To report bugs in the implementation send email to
-smtp sendmail-bugs@sendmail.org.
+smtp To report bugs in the implementation see
+smtp http://www.sendmail.org/email-addresses.html
smtp For local information send email to Postmaster at your site.
help HELP [ <topic> ]
help The HELP command gives help info.
@@ -77,14 +77,14 @@ expn Expand an address. If the address indicates a mailing
expn list, return the contents of that list.
noop NOOP
noop Do nothing.
-send SEND FROM: <sender>
+send SEND FROM:<sender>
send replaces the MAIL command, and can be used to send
send directly to a users terminal. Not supported in this
send implementation.
-soml SOML FROM: <sender>
+soml SOML FROM:<sender>
soml Send or mail. If the user is logged in, send directly,
soml otherwise mail. Not supported in this implementation.
-saml SAML FROM: <sender>
+saml SAML FROM:<sender>
saml Send and mail. Send directly to the user's terminal,
saml and also mail a letter. Not supported in this
saml implementation.
@@ -95,8 +95,8 @@ etrn ETRN [ <hostname> | @<domain> | \#<queuename> ]
etrn Run the queue for the specified <hostname>, or
etrn all hosts within a given <domain>, or a specially-named
etrn <queuename> (implementation-specific).
-dsn MAIL FROM: <sender> [ RET={ FULL | HDRS} ] [ ENVID=<envid> ]
-dsn RCPT TO: <recipient> [ NOTIFY={NEVER,SUCCESS,FAILURE,DELAY} ]
+dsn MAIL From:<sender> [ RET={ FULL | HDRS} ] [ ENVID=<envid> ]
+dsn RCPT To:<recipient> [ NOTIFY={NEVER,SUCCESS,FAILURE,DELAY} ]
dsn [ ORCPT=<recipient> ]
dsn SMTP Delivery Status Notifications.
dsn Descriptions:
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index 45ea1ed..d81d386 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -25,7 +25,7 @@ SM_UNUSED(static char copyright[]) =
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
-SM_RCSID("@(#)$Id: main.c,v 8.942 2005/12/26 04:39:13 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.944 2006/04/21 23:56:42 ca Exp $")
#if NETINET || NETINET6
@@ -516,6 +516,8 @@ main(argc, argv, envp)
/* reset macro */
set_op_mode(OpMode);
+ if (OpMode == MD_DAEMON)
+ DaemonPid = CurrentPid; /* needed for finis() to work */
pw = sm_getpwuid(RealUid);
if (pw != NULL)
@@ -2319,10 +2321,7 @@ main(argc, argv, envp)
dtype[0] = '\0';
if (OpMode == MD_DAEMON)
- {
(void) sm_strlcat(dtype, "+SMTP", sizeof dtype);
- DaemonPid = CurrentPid;
- }
if (QueueIntvl > 0)
{
(void) sm_strlcat2(dtype,
@@ -2874,6 +2873,7 @@ finis(drop, cleanup, exitstat)
volatile int exitstat;
{
char pidpath[MAXPATHLEN];
+ pid_t pid;
/* Still want to process new timeouts added below */
sm_clear_events();
@@ -2942,14 +2942,15 @@ finis(drop, cleanup, exitstat)
/* XXX clean up queues and related data structures */
cleanup_queues();
+ pid = getpid();
#if SM_CONF_SHM
- cleanup_shm(DaemonPid == getpid());
+ cleanup_shm(DaemonPid == pid);
#endif /* SM_CONF_SHM */
/* close locked pid file */
close_sendmail_pid();
- if (DaemonPid == getpid() || PidFilePid == getpid())
+ if (DaemonPid == pid || PidFilePid == pid)
{
/* blow away the pid file */
expand(PidFile, pidpath, sizeof pidpath, CurEnv);
@@ -3275,13 +3276,18 @@ disconnect(droplev, e)
{
fd = open(SM_PATH_DEVNULL, O_WRONLY, 0666);
if (fd == -1)
+ {
sm_syslog(LOG_ERR, e->e_id,
"disconnect: open(\"%s\") failed: %s",
SM_PATH_DEVNULL, sm_errstring(errno));
+ }
(void) sm_io_flush(smioout, SM_TIME_DEFAULT);
- (void) dup2(fd, STDOUT_FILENO);
- (void) dup2(fd, STDERR_FILENO);
- (void) close(fd);
+ if (fd >= 0)
+ {
+ (void) dup2(fd, STDOUT_FILENO);
+ (void) dup2(fd, STDERR_FILENO);
+ (void) close(fd);
+ }
}
/* drop our controlling TTY completely if possible */
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index ee3fbb7..9a7bf7a 100644
--- a/contrib/sendmail/src/map.c
+++ b/contrib/sendmail/src/map.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: map.c,v 8.671 2005/10/25 17:55:50 ca Exp $")
+SM_RCSID("@(#)$Id: map.c,v 8.672 2006/04/18 01:26:41 ca Exp $")
#if LDAPMAP
# include <sm/ldap.h>
@@ -5992,6 +5992,10 @@ user_map_lookup(map, key, av, statp)
case 7:
rwval = user.mbdb_shell;
break;
+ default:
+ syserr("user_map %s: bogus field %d",
+ map->map_mname, map->map_valcolno);
+ return NULL;
}
return map_rewrite(map, rwval, strlen(rwval), av);
}
diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c
index be4a455..802ab00 100644
--- a/contrib/sendmail/src/mci.c
+++ b/contrib/sendmail/src/mci.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: mci.c,v 8.216 2005/07/12 22:27:44 ca Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.217 2006/04/18 01:27:36 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -922,9 +922,17 @@ mci_read_persistent(fp, mci)
char buf[MAXLINE];
if (fp == NULL)
+ {
syserr("mci_read_persistent: NULL fp");
+ /* NOTREACHED */
+ return -1;
+ }
if (mci == NULL)
+ {
syserr("mci_read_persistent: NULL mci");
+ /* NOTREACHED */
+ return -1;
+ }
if (tTd(56, 93))
{
sm_dprintf("mci_read_persistent: fp=%lx, mci=",
diff --git a/contrib/sendmail/src/mime.c b/contrib/sendmail/src/mime.c
index 541307d..c73fbf2 100644
--- a/contrib/sendmail/src/mime.c
+++ b/contrib/sendmail/src/mime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003, 2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1994, 1996-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1994
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <string.h>
-SM_RCSID("@(#)$Id: mime.c,v 8.139 2006/03/01 18:07:45 ca Exp $")
+SM_RCSID("@(#)$Id: mime.c,v 8.142.2.1 2006/05/23 01:32:08 ca Exp $")
/*
** MIME support.
@@ -80,6 +80,7 @@ static bool MapNLtoCRLF;
** boundaries -- the currently pending message boundaries.
** NULL if we are processing the outer portion.
** flags -- to tweak processing.
+** level -- recursion level.
**
** Returns:
** An indicator of what terminated the message part:
@@ -96,12 +97,13 @@ struct args
};
int
-mime8to7(mci, header, e, boundaries, flags)
+mime8to7(mci, header, e, boundaries, flags, level)
register MCI *mci;
HDR *header;
register ENVELOPE *e;
char **boundaries;
int flags;
+ int level;
{
register char *p;
int linelen;
@@ -122,6 +124,18 @@ mime8to7(mci, header, e, boundaries, flags)
char pvpbuf[MAXLINE];
extern unsigned char MimeTokenTab[256];
+ if (level > MAXMIMENESTING)
+ {
+ if (!bitset(EF_TOODEEP, e->e_flags))
+ {
+ if (tTd(43, 4))
+ sm_dprintf("mime8to7: too deep, level=%d\n",
+ level);
+ usrerr("mime8to7: recursion level %d exceeded",
+ level);
+ e->e_flags |= EF_DONT_MIME|EF_TOODEEP;
+ }
+ }
if (tTd(43, 1))
{
sm_dprintf("mime8to7: flags = %x, boundaries =", flags);
@@ -213,7 +227,7 @@ mime8to7(mci, header, e, boundaries, flags)
if (subtype == NULL)
subtype = "-none-";
- /* don't propogate some flags more than one level into the message */
+ /* don't propagate some flags more than one level into the message */
flags &= ~M87F_DIGEST;
/*
@@ -242,7 +256,9 @@ mime8to7(mci, header, e, boundaries, flags)
*/
if (sm_strcasecmp(type, "multipart") == 0 &&
- (!bitset(M87F_NO8BIT, flags) || bitset(M87F_NO8TO7, flags)))
+ (!bitset(M87F_NO8BIT, flags) || bitset(M87F_NO8TO7, flags)) &&
+ !bitset(EF_TOODEEP, e->e_flags)
+ )
{
if (sm_strcasecmp(subtype, "digest") == 0)
@@ -286,10 +302,13 @@ mime8to7(mci, header, e, boundaries, flags)
}
if (i >= MAXMIMENESTING)
{
- usrerr("mime8to7: multipart nesting boundary too deep");
+ if (tTd(43, 4))
+ sm_dprintf("mime8to7: too deep, i=%d\n", i);
+ if (!bitset(EF_TOODEEP, e->e_flags))
+ usrerr("mime8to7: multipart nesting boundary too deep");
/* avoid bounce loops */
- e->e_flags |= EF_DONT_MIME;
+ e->e_flags |= EF_DONT_MIME|EF_TOODEEP;
}
else
{
@@ -333,7 +352,8 @@ mime8to7(mci, header, e, boundaries, flags)
goto writeerr;
if (tTd(43, 101))
putline("+++after putheader", mci);
- bt = mime8to7(mci, hdr, e, boundaries, flags);
+ bt = mime8to7(mci, hdr, e, boundaries, flags,
+ level + 1);
if (bt == SM_IO_EOF)
goto writeerr;
}
@@ -374,7 +394,8 @@ mime8to7(mci, header, e, boundaries, flags)
if (sm_strcasecmp(type, "message") == 0)
{
- if (!wordinclass(subtype, 's'))
+ if (!wordinclass(subtype, 's') ||
+ bitset(EF_TOODEEP, e->e_flags))
{
flags |= M87F_NO8BIT;
}
@@ -397,7 +418,8 @@ mime8to7(mci, header, e, boundaries, flags)
!bitset(M87F_NO8TO7, flags) &&
!putline("MIME-Version: 1.0", mci))
goto writeerr;
- bt = mime8to7(mci, hdr, e, boundaries, flags);
+ bt = mime8to7(mci, hdr, e, boundaries, flags,
+ level + 1);
mci->mci_flags &= ~MCIF_INMIME;
return bt;
}
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index ee4f61f..dea3e1f 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: parseaddr.c,v 8.383 2006/02/01 19:46:11 ca Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.384 2006/04/18 01:28:47 ca Exp $")
static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
static int callsubr __P((char**, int, ENVELOPE *));
@@ -1442,7 +1442,11 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
endtoken = LOOKUPEND;
mapname = *++rvp;
if (mapname == NULL)
+ {
syserr("554 5.3.0 rewrite: missing mapname");
+ /* NOTREACHED */
+ SM_ASSERT(0);
+ }
}
map = stab(mapname, ST_MAP, ST_FIND);
if (map == NULL)
@@ -1452,8 +1456,12 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
/* extract the match part */
key_rvp = ++rvp;
if (key_rvp == NULL)
+ {
syserr("554 5.3.0 rewrite: missing key for map %s",
mapname);
+ /* NOTREACHED */
+ SM_ASSERT(0);
+ }
default_rvp = NULL;
arg_rvp = argvect;
xpvp = NULL;
@@ -1522,7 +1530,8 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
if (replac == NULL && default_rvp != NULL)
{
/* create the default */
- cataddr(default_rvp, NULL, cbuf, sizeof cbuf, '\0');
+ cataddr(default_rvp, NULL, cbuf, sizeof cbuf,
+ '\0');
replac = cbuf;
}
@@ -3175,8 +3184,7 @@ rscap(rwset, p1, p2, e, pvp, pvpbuf, size)
sm_dprintf("rscap(%s, %s, %s)\n", rwset, p1,
p2 == NULL ? "(NULL)" : p2);
- if (pvp != NULL)
- *pvp = NULL;
+ SM_REQUIRE(pvp != NULL);
rsno = strtorwset(rwset, NULL, ST_FIND);
if (rsno < 0)
return EX_UNAVAILABLE;
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index 6cf7fc9..151cd48 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/sem.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.951 2006/03/02 19:13:38 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.954 2006/04/22 01:07:00 ca Exp $")
#include <dirent.h>
@@ -3902,6 +3902,7 @@ readqf(e, openonly)
** Read and process the file.
*/
+ bp = NULL;
(void) sm_strlcpy(qf, queuename(e, ANYQFL_LETTER), sizeof qf);
qfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT, qf, SM_IO_RDWR_B, NULL);
if (qfp == NULL)
@@ -4033,6 +4034,7 @@ readqf(e, openonly)
}
if (delim != '\0')
*bp = delim;
+ bp = NULL;
}
if (!bogus)
bogus = bitset(qsafe, st.st_mode);
@@ -4468,7 +4470,10 @@ readqf(e, openonly)
}
if (bp != buf)
+ {
sm_free(bp); /* XXX */
+ bp = NULL;
+ }
}
/*
@@ -4541,6 +4546,11 @@ readqf(e, openonly)
** queueup() with bogus data.
*/
+ if (bp != NULL && bp != buf)
+ {
+ sm_free(bp); /* XXX */
+ bp = NULL;
+ }
if (qfp != NULL)
(void) sm_io_close(qfp, SM_TIME_DEFAULT);
e->e_lockfp = NULL;
@@ -5180,7 +5190,7 @@ queuename(e, type)
else
{
if (e->e_qgrp == NOQGRP || e->e_qdir == NOQDIR)
- setnewqueue(e);
+ (void) setnewqueue(e);
if (type == DATAFL_LETTER)
{
qd = e->e_dfqdir;
@@ -5194,7 +5204,7 @@ queuename(e, type)
}
/* xf files always have a valid qd and qg picked above */
- if (e->e_qdir == NOQDIR && type != XSCRPT_LETTER)
+ if ((qd == NOQDIR || qg == NOQGRP) && type != XSCRPT_LETTER)
(void) sm_strlcpyn(buf, sizeof buf, 2, pref, e->e_id);
else
{
@@ -6397,7 +6407,7 @@ filesys_update()
#if SM_CONF_SHM
/* only the daemon updates this structure */
- if (ShmId != SM_SHM_NO_ID && DaemonPid != CurrentPid)
+ if (ShmId == SM_SHM_NO_ID || DaemonPid != CurrentPid)
return;
#endif /* SM_CONF_SHM */
now = curtime();
diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c
index 75231da..e44f4c1 100644
--- a/contrib/sendmail/src/savemail.c
+++ b/contrib/sendmail/src/savemail.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003, 2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: savemail.c,v 8.306 2006/02/25 02:16:53 ca Exp $")
+SM_RCSID("@(#)$Id: savemail.c,v 8.308 2006/04/18 01:31:33 ca Exp $")
static bool errbody __P((MCI *, ENVELOPE *, char *));
static bool pruneroute __P((char *));
@@ -733,7 +733,7 @@ returntosender(msg, returnq, flags, e)
** separator -- any possible MIME separator (unused).
**
** Returns:
-** success
+** true iff body was written successfully
**
** Side Effects:
** Outputs the body of an error message.
@@ -1264,8 +1264,8 @@ errbody(mci, e, separator)
/* Diagnostic-Code: -- actual result from other end */
if (q->q_rstatus != NULL)
{
- p = q->q_mailer->m_diagtype;
- if (p == NULL)
+ if (q->q_mailer == NULL ||
+ (p = q->q_mailer->m_diagtype) == NULL)
p = "smtp";
(void) sm_snprintf(buf, sizeof buf,
"Diagnostic-Code: %s; %.800s",
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 302079e..c1c9d84 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -52,7 +52,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1006 2006/02/27 17:49:09 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1008.2.1 2006/05/23 01:32:07 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -942,6 +942,7 @@ struct envelope
#define EF_TOOBIG 0x02000000L /* message is too big */
#define EF_SPLIT 0x04000000L /* envelope has been split */
#define EF_UNSAFE 0x08000000L /* unsafe: read from untrusted source */
+#define EF_TOODEEP 0x10000000L /* message is nested too deep */
#define DLVR_NOTIFY 0x01
#define DLVR_RETURN 0x02
@@ -1655,7 +1656,7 @@ EXTERN unsigned long PrivacyFlags; /* privacy flags */
/* functions */
extern bool mime7to8 __P((MCI *, HDR *, ENVELOPE *));
-extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int));
+extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int, int));
/*
** Flags passed to returntosender.
@@ -2224,7 +2225,7 @@ EXTERN int MaxNOOPCommands; /* max "noise" commands before slowdown */
EXTERN int MaxRcptPerMsg; /* max recipients per SMTP message */
EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */
#if _FFR_MSG_ACCEPT
-EXTERN char *MessageAccept;
+EXTERN char *MessageAccept; /* "Message accepted for delivery" reply text */
#endif /* _FFR_MSG_ACCEPT */
EXTERN int MimeMode; /* MIME processing mode */
diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c
index 89fb390..216d87e 100644
--- a/contrib/sendmail/src/sfsasl.c
+++ b/contrib/sendmail/src/sfsasl.c
@@ -9,9 +9,10 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: sfsasl.c,v 8.113 2006/03/02 19:18:27 ca Exp $")
+SM_RCSID("@(#)$Id: sfsasl.c,v 8.115 2006/04/18 21:34:07 ca Exp $")
#include <stdlib.h>
#include <sendmail.h>
+#include <sm/time.h>
#include <errno.h>
/* allow to disable error handling code just in case... */
@@ -326,6 +327,7 @@ sasl_write(fp, buf, size)
{
while (outlen > 0)
{
+ errno = 0;
/* XXX result == 0? */
ret = sm_io_write(so->fp, SM_TIME_DEFAULT,
&outbuf[total], outlen);
@@ -347,8 +349,9 @@ sasl_write(fp, buf, size)
**
** Parameters:
** fin -- the sm_io file encrypted data to be read from
-** fout -- the sm_io file encrypted data to be writen to
+** fout -- the sm_io file encrypted data to be written to
** conn -- the sasl connection pointer
+** tmo -- timeout
**
** Returns:
** -1 on error
@@ -360,15 +363,16 @@ sasl_write(fp, buf, size)
*/
int
-sfdcsasl(fin, fout, conn)
+sfdcsasl(fin, fout, conn, tmo)
SM_FILE_T **fin;
SM_FILE_T **fout;
sasl_conn_t *conn;
+ int tmo;
{
SM_FILE_T *newin, *newout;
SM_FILE_T SM_IO_SET_TYPE(sasl_vector, "sasl", sasl_open, sasl_close,
sasl_read, sasl_write, NULL, sasl_getinfo, NULL,
- SM_TIME_FOREVER);
+ SM_TIME_DEFAULT);
struct sasl_info info;
if (conn == NULL)
@@ -379,7 +383,7 @@ sfdcsasl(fin, fout, conn)
SM_IO_INIT_TYPE(sasl_vector, "sasl", sasl_open, sasl_close,
sasl_read, sasl_write, NULL, sasl_getinfo, NULL,
- SM_TIME_FOREVER);
+ SM_TIME_DEFAULT);
info.fp = *fin;
info.conn = conn;
newin = sm_io_open(&sasl_vector, SM_TIME_DEFAULT, &info,
@@ -400,6 +404,9 @@ sfdcsasl(fin, fout, conn)
}
sm_io_automode(newin, newout);
+ sm_io_setinfo(*fin, SM_IO_WHAT_TIMEOUT, &tmo);
+ sm_io_setinfo(*fout, SM_IO_WHAT_TIMEOUT, &tmo);
+
*fin = newin;
*fout = newout;
return 0;
diff --git a/contrib/sendmail/src/sfsasl.h b/contrib/sendmail/src/sfsasl.h
index 1cc1892..a92f772 100644
--- a/contrib/sendmail/src/sfsasl.h
+++ b/contrib/sendmail/src/sfsasl.h
@@ -6,15 +6,15 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Id: sfsasl.h,v 8.19 2006/02/27 19:53:37 ca Exp $"
+ * $Id: sfsasl.h,v 8.20 2006/03/27 21:31:00 ca Exp $"
*/
#ifndef SFSASL_H
# define SFSASL_H
-#if SASL
-extern int sfdcsasl __P((SM_FILE_T **, SM_FILE_T **, sasl_conn_t *));
-#endif /* SASL */
+# if SASL
+extern int sfdcsasl __P((SM_FILE_T **, SM_FILE_T **, sasl_conn_t *, int));
+# endif /* SASL */
# if STARTTLS
extern int tls_retry __P((SSL *, int, int, time_t, int, int,
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index e5cfdcf..c75214f 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -17,7 +17,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.922 2006/02/28 00:42:13 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.924.2.2 2006/05/31 20:56:37 ca Exp $")
#include <sm/time.h>
#include <sm/fdset.h>
@@ -70,9 +70,10 @@ static unsigned int srvfeatures __P((ENVELOPE *, char *, unsigned int));
#define STOP_ATTACK ((time_t) -1)
static time_t checksmtpattack __P((volatile unsigned int *, unsigned int,
bool, char *, ENVELOPE *));
-static void mail_esmtp_args __P((char *, char *, ENVELOPE *));
+static void mail_esmtp_args __P((char *, char *, ENVELOPE *, unsigned int));
static void printvrfyaddr __P((ADDRESS *, bool, bool));
-static void rcpt_esmtp_args __P((ADDRESS *, char *, char *, ENVELOPE *));
+static void rcpt_esmtp_args __P((ADDRESS *, char *, char *, ENVELOPE *,
+ unsigned int));
static char *skipword __P((char *volatile, char *));
static void setup_smtpd_io __P((void));
@@ -588,8 +589,8 @@ smtp(nullserver, d_flags, e)
: (SRV_OFFER_EXPN
| (bitset(PRIV_NOVERB, PrivacyFlags)
? SRV_NONE : SRV_OFFER_VERB)))
- | (bitset(PRIV_NORECEIPTS, PrivacyFlags) ? SRV_NONE
- : SRV_OFFER_DSN)
+ | ((bitset(PRIV_NORECEIPTS, PrivacyFlags) || !SendMIMEErrors)
+ ? SRV_NONE : SRV_OFFER_DSN)
#if SASL
| (bitnset(D_NOAUTH, d_flags) ? SRV_NONE : SRV_OFFER_AUTH)
| (bitset(SASL_SEC_NOPLAINTEXT, SASLOpts) ? SRV_REQ_SEC
@@ -1285,14 +1286,17 @@ smtp(nullserver, d_flags, e)
if (ssf != NULL && *ssf > 0)
{
+ int tmo;
+
/*
** Convert I/O layer to use SASL.
** If the call fails, the connection
** is aborted.
*/
+ tmo = TimeOuts.to_datablock * 1000;
if (sfdcsasl(&InChannel, &OutChannel,
- conn) == 0)
+ conn, tmo) == 0)
{
/* restart dialogue */
n_helo = 0;
@@ -2017,7 +2021,7 @@ smtp(nullserver, d_flags, e)
case SMFIR_SHUTDOWN:
if (MilterLogLevel > 3)
sm_syslog(LOG_INFO, e->e_id,
- "Milter: Milter: helo=%s, reject=421 4.7.0 %s closing connection",
+ "Milter: helo=%s, reject=421 4.7.0 %s closing connection",
p, MyHostName);
tempfail = true;
smtp.sm_milterize = false;
@@ -2296,7 +2300,7 @@ smtp(nullserver, d_flags, e)
sm_dprintf("MAIL: got arg %s=\"%s\"\n", kp,
vp == NULL ? "<null>" : vp);
- mail_esmtp_args(kp, vp, e);
+ mail_esmtp_args(kp, vp, e, features);
if (equal != NULL)
*equal = '=';
args[argno++] = kp;
@@ -2566,7 +2570,7 @@ smtp(nullserver, d_flags, e)
sm_dprintf("RCPT: got arg %s=\"%s\"\n", kp,
vp == NULL ? "<null>" : vp);
- rcpt_esmtp_args(a, kp, vp, e);
+ rcpt_esmtp_args(a, kp, vp, e, features);
if (equal != NULL)
*equal = '=';
args[argno++] = kp;
@@ -3848,6 +3852,7 @@ skipword(p, w)
return p;
}
+
/*
** MAIL_ESMTP_ARGS -- process ESMTP arguments from MAIL line
**
@@ -3855,16 +3860,18 @@ skipword(p, w)
** kp -- the parameter key.
** vp -- the value of that parameter.
** e -- the envelope.
+** features -- current server features
**
** Returns:
** none.
*/
static void
-mail_esmtp_args(kp, vp, e)
+mail_esmtp_args(kp, vp, e, features)
char *kp;
char *vp;
ENVELOPE *e;
+ unsigned int features;
{
if (sm_strcasecmp(kp, "size") == 0)
{
@@ -3911,7 +3918,7 @@ mail_esmtp_args(kp, vp, e)
}
else if (sm_strcasecmp(kp, "envid") == 0)
{
- if (bitset(PRIV_NORECEIPTS, PrivacyFlags))
+ if (!bitset(SRV_OFFER_DSN, features))
{
usrerr("504 5.7.0 Sorry, ENVID not supported, we do not allow DSN");
/* NOTREACHED */
@@ -3937,7 +3944,7 @@ mail_esmtp_args(kp, vp, e)
}
else if (sm_strcasecmp(kp, "ret") == 0)
{
- if (bitset(PRIV_NORECEIPTS, PrivacyFlags))
+ if (!bitset(SRV_OFFER_DSN, features))
{
usrerr("504 5.7.0 Sorry, RET not supported, we do not allow DSN");
/* NOTREACHED */
@@ -4130,23 +4137,25 @@ mail_esmtp_args(kp, vp, e)
** kp -- the parameter key.
** vp -- the value of that parameter.
** e -- the envelope.
+** features -- current server features
**
** Returns:
** none.
*/
static void
-rcpt_esmtp_args(a, kp, vp, e)
+rcpt_esmtp_args(a, kp, vp, e, features)
ADDRESS *a;
char *kp;
char *vp;
ENVELOPE *e;
+ unsigned int features;
{
if (sm_strcasecmp(kp, "notify") == 0)
{
char *p;
- if (bitset(PRIV_NORECEIPTS, PrivacyFlags))
+ if (!bitset(SRV_OFFER_DSN, features))
{
usrerr("504 5.7.0 Sorry, NOTIFY not supported, we do not allow DSN");
/* NOTREACHED */
@@ -4187,7 +4196,7 @@ rcpt_esmtp_args(a, kp, vp, e)
}
else if (sm_strcasecmp(kp, "orcpt") == 0)
{
- if (bitset(PRIV_NORECEIPTS, PrivacyFlags))
+ if (!bitset(SRV_OFFER_DSN, features))
{
usrerr("504 5.7.0 Sorry, ORCPT not supported, we do not allow DSN");
/* NOTREACHED */
diff --git a/contrib/sendmail/src/tls.c b/contrib/sendmail/src/tls.c
index dc4a1d9..71fcdc3 100644
--- a/contrib/sendmail/src/tls.c
+++ b/contrib/sendmail/src/tls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2005 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2006 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: tls.c,v 8.102 2006/03/02 19:18:27 ca Exp $")
+SM_RCSID("@(#)$Id: tls.c,v 8.105 2006/05/11 22:59:31 ca Exp $")
#if STARTTLS
# include <openssl/err.h>
@@ -506,6 +506,13 @@ tls_safe_f(var, sff, srv)
static char server_session_id_context[] = "sendmail8";
+/* 0.9.8a and b have a problem with SSL_OP_TLS_BLOCK_PADDING_BUG */
+#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
+# define SM_SSL_OP_TLS_BLOCK_PADDING_BUG 1
+#else
+# define SM_SSL_OP_TLS_BLOCK_PADDING_BUG 0
+#endif
+
bool
inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
SSL_CTX **ctx;
@@ -518,7 +525,7 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
# endif /* !NO_DH */
int r;
bool ok;
- long sff, status;
+ long sff, status, options;
char *who;
# if _FFR_TLS_1
char *cf2, *kf2;
@@ -531,11 +538,19 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
X509_CRL *crl;
X509_STORE *store;
# endif /* OPENSSL_VERSION_NUMBER > 0x00907000L */
+#if SM_SSL_OP_TLS_BLOCK_PADDING_BUG
+ long rt_version;
+ STACK_OF(SSL_COMP) *comp_methods;
+#endif
status = TLS_S_NONE;
who = srv ? "server" : "client";
if (ctx == NULL)
+ {
syserr("STARTTLS=%s, inittls: ctx == NULL", who);
+ /* NOTREACHED */
+ SM_ASSERT(ctx != NULL);
+ }
/* already initialized? (we could re-init...) */
if (*ctx != NULL)
@@ -895,7 +910,29 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
# endif /* _FFR_TLS_1 */
/* SSL_CTX_set_quiet_shutdown(*ctx, 1); violation of standard? */
- SSL_CTX_set_options(*ctx, SSL_OP_ALL); /* XXX bug compatibility? */
+
+ options = SSL_OP_ALL; /* bug compatibility? */
+#if SM_SSL_OP_TLS_BLOCK_PADDING_BUG
+
+ /*
+ ** In OpenSSL 0.9.8[ab], enabling zlib compression breaks the
+ ** padding bug work-around, leading to false positives and
+ ** failed connections. We may not interoperate with systems
+ ** with the bug, but this is better than breaking on all 0.9.8[ab]
+ ** systems that have zlib support enabled.
+ ** Note: this checks the runtime version of the library, not
+ ** just the compile time version.
+ */
+
+ rt_version = SSLeay();
+ if (rt_version >= 0x00908000L && rt_version <= 0x0090802fL)
+ {
+ comp_methods = SSL_COMP_get_compression_methods();
+ if (comp_methods != NULL && sk_SSL_COMP_num(comp_methods) > 0)
+ options &= ~SSL_OP_TLS_BLOCK_PADDING_BUG;
+ }
+#endif
+ SSL_CTX_set_options(*ctx, options);
# if !NO_DH
/* Diffie-Hellman initialization */
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index ea36b6e..c27cd90 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: util.c,v 8.392 2006/03/09 19:49:35 ca Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.394 2006/05/03 23:55:29 ca Exp $")
#include <sysexits.h>
#include <sm/xtrap.h>
@@ -2044,7 +2044,15 @@ prog_open(argv, pfd, e)
/* this process has no right to the queue file */
if (e->e_lockfp != NULL)
- (void) close(sm_io_getinfo(e->e_lockfp, SM_IO_WHAT_FD, NULL));
+ {
+ int fd;
+
+ fd = sm_io_getinfo(e->e_lockfp, SM_IO_WHAT_FD, NULL);
+ if (fd >= 0)
+ (void) close(fd);
+ else
+ syserr("%s: lockfp does not have a fd", argv[0]);
+ }
/* chroot to the program mailer directory, if defined */
if (ProgMailer != NULL && ProgMailer->m_rootdir != NULL)
@@ -2737,7 +2745,7 @@ proc_list_probe()
CurChildren = 0;
if (chldwasblocked == 0)
(void) sm_releasesignal(SIGCHLD);
- if (LogLevel > 10 && children != CurChildren)
+ if (LogLevel > 10 && children != CurChildren && CurrentPid == DaemonPid)
{
sm_syslog(LOG_ERR, NOQID,
"proc_list_probe: found %d children, expected %d",
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 7ca90a8..812d1eb 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: version.c,v 8.160 2006/03/08 19:21:21 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.163.2.4 2006/06/05 22:32:40 ca Exp $")
-char Version[] = "8.13.6";
+char Version[] = "8.13.7";
OpenPOWER on IntegriCloud