summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2004-02-14 21:53:31 +0000
committergshapiro <gshapiro@FreeBSD.org>2004-02-14 21:53:31 +0000
commit238623a0204c90e8d61dbde7b3b499a5036f2e5d (patch)
tree136f3e97b372409d2104603a771ff37e36631243 /contrib/sendmail/src
parent96b960fca637a0765d566591885b7d42576e723f (diff)
downloadFreeBSD-src-238623a0204c90e8d61dbde7b3b499a5036f2e5d.zip
FreeBSD-src-238623a0204c90e8d61dbde7b3b499a5036f2e5d.tar.gz
Import sendmail 8.12.11
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/README9
-rw-r--r--contrib/sendmail/src/alias.c4
-rw-r--r--contrib/sendmail/src/conf.c13
-rw-r--r--contrib/sendmail/src/daemon.c18
-rw-r--r--contrib/sendmail/src/deliver.c7
-rw-r--r--contrib/sendmail/src/headers.c14
-rw-r--r--contrib/sendmail/src/main.c49
-rw-r--r--contrib/sendmail/src/milter.c21
-rw-r--r--contrib/sendmail/src/mime.c74
-rw-r--r--contrib/sendmail/src/queue.c121
-rw-r--r--contrib/sendmail/src/readcf.c8
-rw-r--r--contrib/sendmail/src/recipient.c7
-rw-r--r--contrib/sendmail/src/sendmail.835
-rw-r--r--contrib/sendmail/src/sendmail.h3
-rw-r--r--contrib/sendmail/src/srvrsmtp.c51
-rw-r--r--contrib/sendmail/src/tls.c36
-rw-r--r--contrib/sendmail/src/util.c7
-rw-r--r--contrib/sendmail/src/version.c6
18 files changed, 340 insertions, 143 deletions
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README
index 669a20c..e0af96b 100644
--- a/contrib/sendmail/src/README
+++ b/contrib/sendmail/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.355.2.15 2003/06/02 01:43:04 ca Exp $
+# $Id: README,v 8.355.2.16 2004/01/08 21:54:55 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -561,6 +561,11 @@ MATCHGECOS Permit fuzzy matching of user names against the full
MIME8TO7 If non-zero, include 8 to 7 bit MIME conversions. This
also controls advertisement of 8BITMIME in the ESMTP
startup dialogue.
+MIME7TO8_OLD If 0 then use an algorithm for MIME 7-bit quoted-printable
+ or base64 encoding to 8-bit text that has been introduced
+ in 8.12.3. There are some examples where that code fails,
+ but the old code works. If you have an example of improper
+ 7 to 8 bit conversion please send it to sendmail-bugs.
MIME7TO8 If non-zero, include 7 to 8 bit MIME conversions.
HES_GETMAILHOST Define this to 1 if you are using Hesiod with the
hes_getmailhost() routine. This is included with the MIT
@@ -1797,4 +1802,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.355.2.15 $, last update $Date: 2003/06/02 01:43:04 $ )
+(Version $Revision: 8.355.2.16 $, last update $Date: 2004/01/08 21:54:55 $ )
diff --git a/contrib/sendmail/src/alias.c b/contrib/sendmail/src/alias.c
index 3ce8b0e..c944388 100644
--- a/contrib/sendmail/src/alias.c
+++ b/contrib/sendmail/src/alias.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 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: alias.c,v 8.214.2.1 2003/07/28 17:47:55 ca Exp $")
+SM_RCSID("@(#)$Id: alias.c,v 8.214.2.2 2003/10/06 20:43:29 ca Exp $")
#define SEPARATOR ':'
# define ALIAS_SPEC_SEPARATORS " ,/:"
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index b164d29..56a8404 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.972.2.50 2003/09/03 21:37:03 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.972.2.54 2004/01/08 21:54:55 ca Exp $")
#include <sendmail/pathnames.h>
#if NEWDB
@@ -5571,6 +5571,9 @@ char *CompileOptions[] =
#if MIME7TO8
"MIME7TO8",
#endif /* MIME7TO8 */
+#if MIME7TO8_OLD
+ "MIME7TO8_OLD",
+#endif /* MIME7TO8_OLD */
#if MIME8TO7
"MIME8TO7",
#endif /* MIME8TO7 */
@@ -6065,11 +6068,19 @@ char *FFRCompileOptions[] =
/* Limit sleep(2) time in libsm/clock.c */
"_FFR_MAX_SLEEP_TIME",
#endif /* _FFR_MAX_SLEEP_TIME */
+#if _FFR_MESSAGEID_MACRO
+ /* stick the message ID header's value in a macro */
+ "_FFR_MESSAGEID_MACRO",
+#endif /* _FFR_MESSAGEID_MACRO */
#if MILTER
# if _FFR_MILTER_421
/* If a filter returns 421, close the SMTP connection */
"_FFR_MILTER_421",
# endif /* _FFR_MILTER_421 */
+# if _FFR_MILTER_MACROS_EOM
+ /* Add an EOM macro set for milter */
+ "_FFR_MILTER_MACROS_EOM",
+# endif /* _FFR_MILTER_MACROS_EOM */
# if _FFR_MILTER_PERDAEMON
/* Per DaemonPortOptions InputMailFilter lists */
"_FFR_MILTER_PERDAEMON",
diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c
index 267f363..88c55cd 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.613.2.17 2003/07/30 20:17:04 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.613.2.20 2003/11/25 19:02:24 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -164,6 +164,8 @@ getrequests(e)
extern bool refuseconnections __P((char *, ENVELOPE *, int, bool));
+ /* initialize data for function that generates queue ids */
+ init_qid_alg();
for (idx = 0; idx < NDaemons; idx++)
{
Daemons[idx].d_port = setupdaemon(&(Daemons[idx].d_addr));
@@ -363,7 +365,6 @@ getrequests(e)
/* Did someone signal while waiting? */
CHECK_RESTART;
-
curdaemon = -1;
if (doqueuerun())
{
@@ -3484,10 +3485,21 @@ getauthinfo(fd, may_be_forged)
nleft = sizeof ibuf - 1;
while ((i = read(s, p, nleft)) > 0)
{
+ char *s;
+
p += i;
nleft -= i;
*p = '\0';
- if (strchr(ibuf, '\n') != NULL || nleft <= 0)
+ if ((s = strchr(ibuf, '\n')) != NULL)
+ {
+ if (p > s + 1)
+ {
+ p = s + 1;
+ *p = '\0';
+ }
+ break;
+ }
+ if (nleft <= 0)
break;
}
(void) close(s);
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 95149a0..eb98f83 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sys/time.h>
-SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.19 2003/09/03 19:58:26 ca Exp $")
+SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.20 2003/09/26 18:26:19 ca Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -3491,7 +3491,12 @@ do_transfer:
(mci->mci_state == MCIS_MAIL ||
mci->mci_state == MCIS_RCPT ||
mci->mci_state == MCIS_DATA))
+ {
mci->mci_state = MCIS_OPEN;
+ SmtpPhase = mci->mci_phase = "idle";
+ sm_setproctitle(true, e, "%s: %s", CurHostName,
+ mci->mci_phase);
+ }
}
if (tobuf[0] != '\0')
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index dd871ea..8012b51 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.266.4.7 2003/09/03 21:32:20 ca Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.266.4.9 2003/10/30 00:17:22 gshapiro Exp $")
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
static int priencode __P((char *));
@@ -730,6 +730,10 @@ eatheader(e, full, log)
e->e_msgid = h->h_value;
while (isascii(*e->e_msgid) && isspace(*e->e_msgid))
e->e_msgid++;
+#if _FFR_MESSAGEID_MACRO
+ macdefine(&e->e_macro, A_PERM, macid("{msg_id}"),
+ e->e_msgid);
+#endif /* _FFR_MESSAGEID_MACRO */
}
}
if (tTd(32, 1))
@@ -773,11 +777,13 @@ eatheader(e, full, log)
e->e_timeoutclass = TOC_NORMAL;
else if (sm_strcasecmp(p, "non-urgent") == 0)
e->e_timeoutclass = TOC_NONURGENT;
+#if _FFR_QUEUERETURN_DSN
+ else if (bitset(EF_RESPONSE, e->e_flags))
+ e->e_timeoutclass = TOC_DSN;
+#endif /* _FFR_QUEUERETURN_DSN */
}
-
#if _FFR_QUEUERETURN_DSN
- /* If no timeoutclass picked and it's a DSN, use that timeoutclass */
- if (e->e_timeoutclass == TOC_NORMAL && bitset(EF_RESPONSE, e->e_flags))
+ else if (bitset(EF_RESPONSE, e->e_flags))
e->e_timeoutclass = TOC_DSN;
#endif /* _FFR_QUEUERETURN_DSN */
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index a56315c..0d8c0ce 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -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.887.2.27 2003/08/04 17:23:37 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.887.2.29 2003/11/07 00:09:31 ca Exp $")
#if NETINET || NETINET6
@@ -2234,8 +2234,32 @@ main(argc, argv, envp)
int status;
pid_t ret;
+ errno = 0;
while ((ret = sm_wait(&status)) <= 0)
+ {
+ if (errno == ECHILD)
+ {
+ /*
+ ** Oops... something got messed
+ ** up really bad. Waiting for
+ ** non-existent children
+ ** shouldn't happen. Let's get
+ ** out of here.
+ */
+
+ CurChildren = 0;
+ break;
+ }
continue;
+ }
+
+ /* something is really really wrong */
+ if (errno == ECHILD)
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "queue control process: lost all children: wait returned ECHILD");
+ break;
+ }
/* Only drop when a child gives status */
if (WIFSTOPPED(status))
@@ -2371,8 +2395,31 @@ main(argc, argv, envp)
int group;
CHECK_RESTART;
+ errno = 0;
while ((ret = sm_wait(&status)) <= 0)
+ {
+ /*
+ ** Waiting for non-existent
+ ** children shouldn't happen.
+ ** Let's get out of here if
+ ** it occurs.
+ */
+
+ if (errno == ECHILD)
+ {
+ CurChildren = 0;
+ break;
+ }
continue;
+ }
+
+ /* something is really really wrong */
+ if (errno == ECHILD)
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "persistent queue runner control process: lost all children: wait returned ECHILD");
+ break;
+ }
if (WIFSTOPPED(status))
continue;
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index c91ad12..c25101c 100644
--- a/contrib/sendmail/src/milter.c
+++ b/contrib/sendmail/src/milter.c
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: milter.c,v 8.197.2.9 2003/09/07 00:18:29 ca Exp $")
+SM_RCSID("@(#)$Id: milter.c,v 8.197.2.10 2003/12/01 23:57:44 msk Exp $")
#if MILTER
# include <libmilter/mfapi.h>
@@ -34,6 +34,9 @@ static char *MilterConnectMacros[MAXFILTERMACROS + 1];
static char *MilterHeloMacros[MAXFILTERMACROS + 1];
static char *MilterEnvFromMacros[MAXFILTERMACROS + 1];
static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];
+#if _FFR_MILTER_MACROS_EOM
+static char *MilterEOMMacros[MAXFILTERMACROS + 1];
+#endif /* _FFR_MILTER_MACROS_EOM */
# define MILTER_CHECK_DONE_MSG() \
if (*state == SMFIR_REPLYCODE || \
@@ -1415,6 +1418,10 @@ static struct milteropt
{ "macros.envrcpt", MO_MACROS_ENVRCPT },
# define MO_LOGLEVEL 0x05
{ "loglevel", MO_LOGLEVEL },
+#if _FFR_MILTER_MACROS_EOM
+# define MO_MACROS_EOM 0x06
+ { "macros.eom", MO_MACROS_EOM },
+#endif /* _FFR_MILTER_MACROS_EOM */
{ NULL, 0 },
};
@@ -1488,6 +1495,13 @@ milter_set_option(name, val, sticky)
case MO_MACROS_ENVRCPT:
if (macros == NULL)
macros = MilterEnvRcptMacros;
+#if _FFR_MILTER_MACROS_EOM
+ /* FALLTHROUGH */
+
+ case MO_MACROS_EOM:
+ if (macros == NULL)
+ macros = MilterEOMMacros;
+#endif /* _FFR_MILTER_MACROS_EOM */
p = newstr(val);
while (*p != '\0')
@@ -3594,6 +3608,11 @@ milter_data(e, state)
MILTER_CHECK_RESULTS();
}
+#if _FFR_MILTER_MACROS_EOM
+ if (MilterEOMMacros[0] != NULL)
+ milter_send_macros(m, MilterEOMMacros, SMFIC_BODYEOB, e);
+#endif /* _FFR_MILTER_MACROS_EOM */
+
/* send the final body chunk */
(void) milter_write(m, SMFIC_BODYEOB, NULL, 0,
m->mf_timeout[SMFTO_WRITE], e);
diff --git a/contrib/sendmail/src/mime.c b/contrib/sendmail/src/mime.c
index 62d1617..a9a26c4 100644
--- a/contrib/sendmail/src/mime.c
+++ b/contrib/sendmail/src/mime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 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.130.2.1 2003/04/15 01:05:59 ca Exp $")
+SM_RCSID("@(#)$Id: mime.c,v 8.130.2.3 2004/01/08 21:42:56 ca Exp $")
/*
** MIME support.
@@ -33,6 +33,11 @@ SM_RCSID("@(#)$Id: mime.c,v 8.130.2.1 2003/04/15 01:05:59 ca Exp $")
** the problem.
*/
+/* use "old" mime 7 to 8 algorithm by default */
+#ifndef MIME7TO8_OLD
+# define MIME7TO8_OLD 1
+#endif /* ! MIME7TO8_OLD */
+
#if MIME8TO7
static int isboundary __P((char *, char **));
static int mimeboundary __P((char *, char **));
@@ -1064,54 +1069,41 @@ mime7to8(mci, header, e)
c1 = CHAR64(c1);
c2 = CHAR64(c2);
+#if MIME7TO8_OLD
+#define CHK_EOL if (*--fbufp != '\n' || (fbufp > fbuf && *--fbufp != '\r')) \
+ ++fbufp;
+#else /* MIME7TO8_OLD */
+#define CHK_EOL if (*--fbufp != '\n' || (fbufp > fbuf && *--fbufp != '\r')) \
+ { \
+ ++fbufp; \
+ pxflags |= PXLF_NOADDEOL; \
+ }
+#endif /* MIME7TO8_OLD */
+
+#define PUTLINE64 \
+ do \
+ { \
+ if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE]) \
+ { \
+ CHK_EOL; \
+ putxline((char *) fbuf, fbufp - fbuf, mci, pxflags); \
+ pxflags &= ~PXLF_NOADDEOL; \
+ fbufp = fbuf; \
+ } \
+ } while (0)
+
*fbufp = (c1 << 2) | ((c2 & 0x30) >> 4);
- if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE])
- {
- if (*--fbufp != '\n' ||
- (fbufp > fbuf && *--fbufp != '\r'))
- {
- pxflags |= PXLF_NOADDEOL;
- fbufp++;
- }
- putxline((char *) fbuf, fbufp - fbuf,
- mci, pxflags);
- pxflags &= ~PXLF_NOADDEOL;
- fbufp = fbuf;
- }
+ PUTLINE64;
if (c3 == '=')
continue;
c3 = CHAR64(c3);
*fbufp = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2);
- if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE])
- {
- if (*--fbufp != '\n' ||
- (fbufp > fbuf && *--fbufp != '\r'))
- {
- pxflags |= PXLF_NOADDEOL;
- fbufp++;
- }
- putxline((char *) fbuf, fbufp - fbuf,
- mci, pxflags);
- pxflags &= ~PXLF_NOADDEOL;
- fbufp = fbuf;
- }
+ PUTLINE64;
if (c4 == '=')
continue;
c4 = CHAR64(c4);
*fbufp = ((c3 & 0x03) << 6) | c4;
- if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE])
- {
- if (*--fbufp != '\n' ||
- (fbufp > fbuf && *--fbufp != '\r'))
- {
- pxflags |= PXLF_NOADDEOL;
- fbufp++;
- }
- putxline((char *) fbuf, fbufp - fbuf,
- mci, pxflags);
- pxflags &= ~PXLF_NOADDEOL;
- fbufp = fbuf;
- }
+ PUTLINE64;
}
}
else
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index 6f91ed9..e71b8f2 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.863.2.61 2003/09/03 19:58:26 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.863.2.67 2003/12/02 23:56:01 ca Exp $")
#include <dirent.h>
@@ -22,7 +22,16 @@ SM_RCSID("@(#)$Id: queue.c,v 8.863.2.61 2003/09/03 19:58:26 ca Exp $")
# define sm_file_exists(errno) ((errno) == EEXIST)
-# define TF_OPEN_FLAGS (O_CREAT|O_WRONLY|O_EXCL)
+# if HASFLOCK && defined(O_EXLOCK)
+# define SM_OPEN_EXLOCK 1
+# define TF_OPEN_FLAGS (O_CREAT|O_WRONLY|O_EXCL|O_EXLOCK)
+# else /* HASFLOCK && defined(O_EXLOCK) */
+# define TF_OPEN_FLAGS (O_CREAT|O_WRONLY|O_EXCL)
+# endif /* HASFLOCK && defined(O_EXLOCK) */
+
+#ifndef SM_OPEN_EXLOCK
+# define SM_OPEN_EXLOCK 0
+#endif /* ! SM_OPEN_EXLOCK */
/*
** Historical notes:
@@ -358,6 +367,18 @@ queueup(e, announce, msync)
** Create control file.
*/
+#define OPEN_TF do \
+ { \
+ MODE_T oldumask = 0; \
+ \
+ if (bitset(S_IWGRP, QueueFileMode)) \
+ oldumask = umask(002); \
+ tfd = open(tf, TF_OPEN_FLAGS, QueueFileMode); \
+ if (bitset(S_IWGRP, QueueFileMode)) \
+ (void) umask(oldumask); \
+ } while (0)
+
+
newid = (e->e_id == NULL) || !bitset(EF_INQUEUE, e->e_flags);
(void) sm_strlcpy(tf, queuename(e, NEWQFL_LETTER), sizeof tf);
tfp = e->e_lockfp;
@@ -370,9 +391,11 @@ queueup(e, announce, msync)
*/
(void) sm_strlcpy(tf, queuename(e, ANYQFL_LETTER), sizeof tf);
- tfd = open(tf, TF_OPEN_FLAGS, FileMode);
+ OPEN_TF;
if (tfd < 0 ||
+#if !SM_OPEN_EXLOCK
!lockfile(tfd, tf, NULL, LOCK_EX|LOCK_NB) ||
+#endif /* !SM_OPEN_EXLOCK */
(tfp = sm_io_open(SmFtStdiofd, SM_TIME_DEFAULT,
(void *) &tfd, SM_IO_WRONLY_B,
NULL)) == NULL)
@@ -396,14 +419,7 @@ queueup(e, announce, msync)
{
if (tfd < 0)
{
- MODE_T oldumask = 0;
-
- if (bitset(S_IWGRP, QueueFileMode))
- oldumask = umask(002);
- tfd = open(tf, TF_OPEN_FLAGS, QueueFileMode);
- if (bitset(S_IWGRP, QueueFileMode))
- (void) umask(oldumask);
-
+ OPEN_TF;
if (tfd < 0)
{
if (errno != EEXIST)
@@ -414,12 +430,22 @@ queueup(e, announce, msync)
tf, (int) geteuid(),
sm_errstring(errno));
}
+#if SM_OPEN_EXLOCK
+ else
+ break;
+#endif /* SM_OPEN_EXLOCK */
}
if (tfd >= 0)
{
+#if SM_OPEN_EXLOCK
+ /* file is locked by open() */
+ break;
+#else /* SM_OPEN_EXLOCK */
if (lockfile(tfd, tf, NULL, LOCK_EX|LOCK_NB))
break;
- else if (LogLevel > 0 && (i % 32) == 0)
+ else
+#endif /* SM_OPEN_EXLOCK */
+ if (LogLevel > 0 && (i % 32) == 0)
sm_syslog(LOG_ALERT, e->e_id,
"queueup: cannot lock %s: %s",
tf, sm_errstring(errno));
@@ -5172,6 +5198,36 @@ queuename(e, type)
sm_dprintf("queuename: %s\n", buf);
return buf;
}
+
+/*
+** INIT_QID_ALG -- Initialize the (static) parameters that are used to
+** generate a queue ID.
+**
+** This function is called by the daemon to reset
+** LastQueueTime and LastQueuePid which are used by assign_queueid().
+** Otherwise the algorithm may cause problems because
+** LastQueueTime and LastQueuePid are set indirectly by main()
+** before the daemon process is started, hence LastQueuePid is not
+** the pid of the daemon and therefore a child of the daemon can
+** actually have the same pid as LastQueuePid which means the section
+** in assign_queueid():
+** * see if we need to get a new base time/pid *
+** is NOT triggered which will cause the same queue id to be generated.
+**
+** Parameters:
+** none
+**
+** Returns:
+** none.
+*/
+
+void
+init_qid_alg()
+{
+ LastQueueTime = 0;
+ LastQueuePid = -1;
+}
+
/*
** ASSIGN_QUEUEID -- assign a queue ID for this envelope.
**
@@ -5188,8 +5244,20 @@ queuename(e, type)
** none.
*/
-static const char QueueIdChars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx";
+static const char QueueIdChars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
# define QIC_LEN 60
+# define QIC_LEN_R 62
+
+/*
+** Note: the length is "officially" 60 because minutes and seconds are
+** usually only 0-59. However (Linux):
+** tm_sec The number of seconds after the minute, normally in
+** the range 0 to 59, but can be up to 61 to allow for
+** leap seconds.
+** Hence the real length of the string is 62 to take this into account.
+** Alternatively % QIC_LEN can (should) be used for access everywhere.
+*/
+
# define queuenextid() CurrentPid
@@ -5244,8 +5312,8 @@ assign_queueid(e)
idbuf[1] = QueueIdChars[tm->tm_mon];
idbuf[2] = QueueIdChars[tm->tm_mday];
idbuf[3] = QueueIdChars[tm->tm_hour];
- idbuf[4] = QueueIdChars[tm->tm_min];
- idbuf[5] = QueueIdChars[tm->tm_sec];
+ idbuf[4] = QueueIdChars[tm->tm_min % QIC_LEN_R];
+ idbuf[5] = QueueIdChars[tm->tm_sec % QIC_LEN_R];
idbuf[6] = QueueIdChars[seq / QIC_LEN];
idbuf[7] = QueueIdChars[seq % QIC_LEN];
(void) sm_snprintf(&idbuf[8], sizeof idbuf - 8, "%06d",
@@ -7357,10 +7425,10 @@ cmpidx(a, b)
void
makeworkgroups()
{
- int i, j, total_runners = 0;
- int dir;
+ int i, j, total_runners, dir, h;
SORTQGRP_T si[MAXQUEUEGROUPS + 1];
+ total_runners = 0;
if (NumQueue == 1 && strcmp(Queue[0]->qg_name, "mqueue") == 0)
{
/*
@@ -7456,18 +7524,19 @@ makeworkgroups()
(WorkGrp[j].wg_numqgrp + 1)));
}
- WorkGrp[j].wg_qgs[WorkGrp[j].wg_numqgrp] = Queue[si[i].sg_idx];
+ h = si[i].sg_idx;
+ WorkGrp[j].wg_qgs[WorkGrp[j].wg_numqgrp] = Queue[h];
WorkGrp[j].wg_numqgrp++;
- WorkGrp[j].wg_runners += Queue[i]->qg_maxqrun;
- Queue[si[i].sg_idx]->qg_wgrp = j;
+ WorkGrp[j].wg_runners += Queue[h]->qg_maxqrun;
+ Queue[h]->qg_wgrp = j;
if (WorkGrp[j].wg_maxact == 0)
{
/* can't have more runners than allowed total */
if (MaxQueueChildren > 0 &&
- Queue[i]->qg_maxqrun > MaxQueueChildren)
- Queue[i]->qg_maxqrun = MaxQueueChildren;
- WorkGrp[j].wg_maxact = Queue[i]->qg_maxqrun;
+ Queue[h]->qg_maxqrun > MaxQueueChildren)
+ Queue[h]->qg_maxqrun = MaxQueueChildren;
+ WorkGrp[j].wg_maxact = Queue[h]->qg_maxqrun;
}
/*
@@ -7477,9 +7546,9 @@ makeworkgroups()
*/
/* keep track of the lowest interval for a persistent runner */
- if (Queue[si[i].sg_idx]->qg_queueintvl > 0 &&
- WorkGrp[j].wg_lowqintvl < Queue[si[i].sg_idx]->qg_queueintvl)
- WorkGrp[j].wg_lowqintvl = Queue[si[i].sg_idx]->qg_queueintvl;
+ if (Queue[h]->qg_queueintvl > 0 &&
+ WorkGrp[j].wg_lowqintvl < Queue[h]->qg_queueintvl)
+ WorkGrp[j].wg_lowqintvl = Queue[h]->qg_queueintvl;
j += dir;
}
if (tTd(41, 9))
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index 2a40e82..161e7d5 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.11 2003/04/03 23:04:06 ca Exp $")
+SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.12 2003/10/07 17:45:28 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -3153,7 +3153,7 @@ setoption(opt, val, safe, sticky, e)
RunAsGid = pw->pw_gid;
else if (UseMSP && *p == '\0')
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
- "WARNING: RunAsGid for MSP ignored, check group ids (egid=%d, want=%d)\n",
+ "WARNING: RunAsUser for MSP ignored, check group ids (egid=%d, want=%d)\n",
(int) EffGid,
(int) pw->pw_gid);
}
@@ -3177,7 +3177,7 @@ setoption(opt, val, safe, sticky, e)
else if (UseMSP)
(void) sm_io_fprintf(smioout,
SM_TIME_DEFAULT,
- "WARNING: RunAsGid for MSP ignored, check group ids (egid=%d, want=%d)\n",
+ "WARNING: RunAsUser for MSP ignored, check group ids (egid=%d, want=%d)\n",
(int) EffGid,
(int) runasgid);
}
@@ -3194,7 +3194,7 @@ setoption(opt, val, safe, sticky, e)
else if (UseMSP)
(void) sm_io_fprintf(smioout,
SM_TIME_DEFAULT,
- "WARNING: RunAsGid for MSP ignored, check group ids (egid=%d, want=%d)\n",
+ "WARNING: RunAsUser for MSP ignored, check group ids (egid=%d, want=%d)\n",
(int) EffGid,
(int) gr->gr_gid);
}
diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c
index 7452897..b7b6660 100644
--- a/contrib/sendmail/src/recipient.c
+++ b/contrib/sendmail/src/recipient.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 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: recipient.c,v 8.330.2.2 2003/09/16 19:56:25 ca Exp $")
+SM_RCSID("@(#)$Id: recipient.c,v 8.330.2.4 2003/10/06 20:43:29 ca Exp $")
static void includetimeout __P((void));
static ADDRESS *self_reference __P((ADDRESS *));
@@ -397,7 +397,8 @@ removefromlist(list, sendq, e)
for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
{
if (!QS_IS_DEAD(q->q_state) &&
- sameaddr(q, &a))
+ (sameaddr(q, &a) ||
+ strcmp(q->q_paddr, a.q_paddr) == 0))
{
if (tTd(25, 5))
{
diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8
index eb67358..eacfbd0 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.51.2.1 2003/05/20 16:38:15 gshapiro Exp $
+.\" $Id: sendmail.8,v 8.51.2.3 2003/12/01 17:02:00 ca Exp $
.\"
-.TH SENDMAIL 8 "$Date: 2003/05/20 16:38:15 $"
+.TH SENDMAIL 8 "$Date: 2003/12/01 17:02:00 $"
.SH NAME
sendmail
\- an electronic mail transport agent
@@ -150,11 +150,32 @@ users or mailing lists.
.BI \-C file
Use alternate configuration file.
.B Sendmail
-refuses to run as root if an alternate configuration file is specified.
-.TP
-.BI \-d X
-Set debugging value to
-.IR X .
+gives up any enhanced (set-user-ID or set-group-ID) privileges
+if an alternate configuration file is specified.
+.TP
+.BI \-d category . level...
+Set the debugging flag for
+.I category
+to
+.IR level .
+.I Category
+is either an integer or a name specifying the topic, and
+.I level
+an integer specifying the level of debugging output desired.
+Higher levels generally mean more output.
+More than one flag can be specified by separating them with commas.
+A list of numeric debugging categories can be found in the TRACEFLAGS file
+in the sendmail source distribution.
+.br
+The option
+.B \-d0.1
+prints the version of
+.B sendmail
+and the options it was compiled with.
+.br
+Most other categories are only useful with, and documented in,
+.BR sendmail 's
+source code.
.ne 1i
.TP
.BI \-F fullname
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 07e59bc..2e1b732 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -48,7 +48,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.28 2003/09/03 19:58:27 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.29 2003/11/07 00:08:02 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -1973,6 +1973,7 @@ extern void setup_queues __P((bool));
extern bool setnewqueue __P((ENVELOPE *));
extern bool shouldqueue __P((long, time_t));
extern void sync_queue_time __P((void));
+extern void init_qid_alg __P((void));
extern int print_single_queue __P((int, int));
#if REQUIRES_DIR_FSYNC
# define SYNC_DIR(path, panic) sync_dir(path, panic)
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 52d47a1..e752aa0 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -16,7 +16,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.31 2003/07/01 17:30:01 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.34 2004/01/14 19:13:46 ca Exp $")
#if SASL || STARTTLS
# include <sys/time.h>
@@ -1288,6 +1288,7 @@ smtp(nullserver, d_flags, e)
case CMDEHLO:
case CMDNOOP:
case CMDRSET:
+ case CMDERROR:
/* process normally */
break;
@@ -2338,6 +2339,29 @@ tlsfail:
case CMDRCPT: /* rcpt -- designate recipient */
DELAY_CONN("RCPT");
+ if (BadRcptThrottle > 0 &&
+ n_badrcpts >= BadRcptThrottle)
+ {
+ if (LogLevel > 5 &&
+ n_badrcpts == BadRcptThrottle)
+ {
+ sm_syslog(LOG_INFO, e->e_id,
+ "%s: Possible SMTP RCPT flood, throttling.",
+ CurSmtpClient);
+
+ /* To avoid duplicated message */
+ n_badrcpts++;
+ }
+
+ /*
+ ** Don't use exponential backoff for now.
+ ** Some servers will open more connections
+ ** and actually overload the receiver even
+ ** more.
+ */
+
+ (void) sleep(1);
+ }
if (!smtp.sm_gotmail)
{
usrerr("503 5.0.0 Need MAIL before RCPT");
@@ -2384,29 +2408,6 @@ tlsfail:
e, true);
macdefine(&e->e_macro, A_PERM,
macid("{addr_type}"), NULL);
- if (BadRcptThrottle > 0 &&
- n_badrcpts >= BadRcptThrottle)
- {
- if (LogLevel > 5 &&
- n_badrcpts == BadRcptThrottle)
- {
- sm_syslog(LOG_INFO, e->e_id,
- "%s: Possible SMTP RCPT flood, throttling.",
- CurSmtpClient);
-
- /* To avoid duplicated message */
- n_badrcpts++;
- }
-
- /*
- ** Don't use exponential backoff for now.
- ** Some servers will open more connections
- ** and actually overload the receiver even
- ** more.
- */
-
- (void) sleep(1);
- }
if (Errors > 0)
goto rcpt_done;
if (a == NULL)
@@ -3146,7 +3147,7 @@ smtp_data(smtp, e)
doublequeue = false;
aborting = Errors > 0;
- if (!aborting &&
+ if (!(aborting || bitset(EF_DISCARD, e->e_flags)) &&
#if _FFR_QUARANTINE
(QueueMode == QM_QUARANTINE || e->e_quarmsg == NULL) &&
#endif /* _FFR_QUARANTINE */
diff --git a/contrib/sendmail/src/tls.c b/contrib/sendmail/src/tls.c
index a74c691..598c187 100644
--- a/contrib/sendmail/src/tls.c
+++ b/contrib/sendmail/src/tls.c
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: tls.c,v 8.79.4.4 2003/03/20 00:03:42 ca Exp $")
+SM_RCSID("@(#)$Id: tls.c,v 8.79.4.5 2003/12/28 04:23:28 gshapiro Exp $")
#if STARTTLS
# include <openssl/err.h>
@@ -344,30 +344,36 @@ tls_set_verify(ctx, ssl, vrfy)
# define TLS_S_DHPAR_EX 0x00400000 /* DH param file exists */
# define TLS_S_DHPAR_OK 0x00800000 /* DH param file is ok to use */
+/* Type of variable */
+# define TLS_T_OTHER 0
+# define TLS_T_SRV 1
+# define TLS_T_CLT 2
+
/*
** TLS_OK_F -- can var be an absolute filename?
**
** Parameters:
** var -- filename
** fn -- what is the filename used for?
-** srv -- server side?
+** type -- type of variable
**
** Returns:
** ok?
*/
static bool
-tls_ok_f(var, fn, srv)
+tls_ok_f(var, fn, type)
char *var;
char *fn;
- bool srv;
+ int type;
{
/* must be absolute pathname */
if (var != NULL && *var == '/')
return true;
if (LogLevel > 12)
sm_syslog(LOG_WARNING, NOQID, "STARTTLS: %s%s missing",
- srv ? "Server" : "Client", fn);
+ type == TLS_T_SRV ? "Server" :
+ (type == TLS_T_CLT ? "Client" : ""), var);
return false;
}
/*
@@ -407,16 +413,16 @@ tls_safe_f(var, sff, srv)
** fn -- what is the filename used for?
** req -- is the file required?
** st -- status bit to set if ok
-** srv -- server side?
+** type -- type of variable
**
** Side Effects:
** uses r, ok; may change ok and status.
**
*/
-# define TLS_OK_F(var, fn, req, st, srv) if (ok) \
+# define TLS_OK_F(var, fn, req, st, type) if (ok) \
{ \
- r = tls_ok_f(var, fn, srv); \
+ r = tls_ok_f(var, fn, type); \
if (r) \
status |= st; \
else if (req) \
@@ -539,13 +545,13 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
*/
TLS_OK_F(certfile, "CertFile", bitset(TLS_I_CERT_EX, req),
- TLS_S_CERT_EX, srv);
+ TLS_S_CERT_EX, srv ? TLS_T_SRV : TLS_T_CLT);
TLS_OK_F(keyfile, "KeyFile", bitset(TLS_I_KEY_EX, req),
- TLS_S_KEY_EX, srv);
+ TLS_S_KEY_EX, srv ? TLS_T_SRV : TLS_T_CLT);
TLS_OK_F(cacertpath, "CACertPath", bitset(TLS_I_CERTP_EX, req),
- TLS_S_CERTP_EX, srv);
+ TLS_S_CERTP_EX, TLS_T_OTHER);
TLS_OK_F(cacertfile, "CACertFile", bitset(TLS_I_CERTF_EX, req),
- TLS_S_CERTF_EX, srv);
+ TLS_S_CERTF_EX, TLS_T_OTHER);
# if _FFR_TLS_1
/*
@@ -556,12 +562,12 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
if (cf2 != NULL)
{
TLS_OK_F(cf2, "CertFile", bitset(TLS_I_CERT_EX, req),
- TLS_S_CERT2_EX, srv);
+ TLS_S_CERT2_EX, srv ? TLS_T_SRV : TLS_T_CLT);
}
if (kf2 != NULL)
{
TLS_OK_F(kf2, "KeyFile", bitset(TLS_I_KEY_EX, req),
- TLS_S_KEY2_EX, srv);
+ TLS_S_KEY2_EX, srv ? TLS_T_SRV : TLS_T_CLT);
}
# endif /* _FFR_TLS_1 */
@@ -599,7 +605,7 @@ inittls(ctx, req, srv, certfile, keyfile, cacertpath, cacertfile, dhparam)
{
TLS_OK_F(dhparam, "DHParameters",
bitset(TLS_I_DHPAR_EX, req),
- TLS_S_DHPAR_EX, srv);
+ TLS_S_DHPAR_EX, TLS_T_OTHER);
}
}
if (!ok)
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index dc0b1e4..911f692 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2003 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: util.c,v 8.363.2.7 2003/06/02 03:25:39 gshapiro Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.363.2.10 2003/10/15 17:19:14 ca Exp $")
#include <sysexits.h>
#include <sm/xtrap.h>
@@ -2380,7 +2380,8 @@ str2prt(s)
*h++ = 'r';
break;
default:
- (void) sm_snprintf(h, l, "%03o", (int) c);
+ (void) sm_snprintf(h, l, "%03o",
+ (unsigned int)((unsigned char) c));
/*
** XXX since l is unsigned this may
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 9f7eb12..ec91cfe 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: version.c,v 8.104.2.22 2003/09/16 20:02:04 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.104.2.26 2004/01/13 00:29:26 ca Exp $")
-char Version[] = "8.12.10";
+char Version[] = "8.12.11";
OpenPOWER on IntegriCloud