summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Build13
-rw-r--r--src/Makefile.m42
-rw-r--r--src/README8
-rw-r--r--src/aliases.089
-rw-r--r--src/collect.c5
-rw-r--r--src/conf.c23
-rw-r--r--src/daemon.c18
-rw-r--r--src/envelope.c16
-rw-r--r--src/mailq.081
-rw-r--r--src/main.c14
-rwxr-xr-xsrc/makesendmail13
-rw-r--r--src/mci.c29
-rw-r--r--src/newaliases.035
-rw-r--r--src/parseaddr.c9
-rw-r--r--src/queue.c8
-rw-r--r--src/ratectrl.c4
-rw-r--r--src/readcf.c20
-rw-r--r--src/sendmail.0465
-rw-r--r--src/sendmail.h20
-rw-r--r--src/sfsasl.c28
-rw-r--r--src/sm_resolve.c6
-rw-r--r--src/srvrsmtp.c53
-rw-r--r--src/sysexits.h95
-rw-r--r--src/usersmtp.c5
-rw-r--r--src/util.c9
-rw-r--r--src/version.c6
26 files changed, 996 insertions, 78 deletions
diff --git a/src/Build b/src/Build
new file mode 100755
index 0000000000000..620a814f87e54
--- /dev/null
+++ b/src/Build
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set
+# forth in the LICENSE file which can be found at the top level of
+# the sendmail distribution.
+#
+#
+# $Id: Build,v 8.6 2000/04/10 06:32:53 gshapiro Exp $
+
+exec sh ../devtools/bin/Build $*
diff --git a/src/Makefile.m4 b/src/Makefile.m4
index b2bfa1a8d25a5..fd015b4937a34 100644
--- a/src/Makefile.m4
+++ b/src/Makefile.m4
@@ -1,4 +1,4 @@
-dnl $Id: Makefile.m4,v 8.112 2007/10/17 21:29:43 ca Exp $
+dnl $Id: Makefile.m4,v 8.115 2008/03/27 16:13:33 ca Exp $
include(confBUILDTOOLSDIR`/M4/switch.m4')
define(`confREQUIRE_LIBSM', `true')
diff --git a/src/README b/src/README
index 2039674381d84..34313fc8506c9 100644
--- a/src/README
+++ b/src/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Id: README,v 8.390 2006/11/13 22:27:27 ca Exp $
+# $Id: README,v 8.391 2008/02/12 16:38:21 ca Exp $
#
This directory contains the source files for sendmail(TM).
@@ -41,7 +41,7 @@ Sendmail is a trademark of Sendmail, Inc.
By far, the easiest way to compile sendmail is to use the "Build"
script:
- sh Build
+ sh ./Build
This uses the "uname" command to figure out what architecture you are
on and creates a proper Makefile accordingly. It also creates a
@@ -52,7 +52,7 @@ read the note below in the OPERATING SYSTEM AND COMPILE QUIRKS section.
If you need to look at other include or library directories, use the
-I or -L flags on the command line, e.g.,
- sh Build -I/usr/sww/include -L/usr/sww/lib
+ sh ./Build -I/usr/sww/include -L/usr/sww/lib
It's also possible to create local site configuration in the file
site.config.m4 (or another file settable with the -f flag). This
@@ -1847,4 +1847,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.390 $, last update $Date: 2006/11/13 22:27:27 $ )
+(Version $Revision: 8.391 $, last update $Date: 2008/02/12 16:38:21 $ )
diff --git a/src/aliases.0 b/src/aliases.0
new file mode 100644
index 0000000000000..60510303dd6c2
--- /dev/null
+++ b/src/aliases.0
@@ -0,0 +1,89 @@
+ALIASES(5) ALIASES(5)
+
+
+
+NNAAMMEE
+ aliases - aliases file for sendmail
+
+SSYYNNOOPPSSIISS
+ aalliiaasseess
+
+DDEESSCCRRIIPPTTIIOONN
+ This file describes user ID aliases used by sendmail. The file resides
+ in /etc/mail and is formatted as a series of lines of the form
+
+ name: addr_1, addr_2, addr_3, . . .
+
+ The _n_a_m_e is the name to alias, and the _a_d_d_r___n are the aliases for that
+ name. _a_d_d_r___n can be another alias, a local username, a local filename,
+ a command, an include file, or an external address.
+
+ LLooccaall UUsseerrnnaammee
+ username
+
+ The username must be available via getpwnam(3).
+
+ LLooccaall FFiilleennaammee
+ /path/name
+
+ Messages are appended to the file specified by the full pathname
+ (starting with a slash (/))
+
+ CCoommmmaanndd
+ |command
+
+ A command starts with a pipe symbol (|), it receives messages
+ via standard input.
+
+ IInncclluuddee FFiillee
+ :include: /path/name
+
+ The aliases in pathname are added to the aliases for _n_a_m_e_.
+
+ EE--MMaaiill AAddddrreessss
+ user@domain
+
+ An e-mail address in RFC 822 format.
+
+ Lines beginning with white space are continuation lines. Another way
+ to continue lines is by placing a backslash directly before a newline.
+ Lines beginning with # are comments.
+
+ Aliasing occurs only on local names. Loops can not occur, since no
+ message will be sent to any person more than once.
+
+ If an alias is found for _n_a_m_e, sendmail then checks for an alias for
+ _o_w_n_e_r_-_n_a_m_e. If it is found and the result of the lookup expands to a
+ single address, the envelope sender address of the message is rewritten
+ to that address. If it is found and the result expands to more than
+ one address, the envelope sender address is changed to _o_w_n_e_r_-_n_a_m_e.
+
+ After aliasing has been done, local and valid recipients who have a
+ ``.forward'' file in their home directory have messages forwarded to
+ the list of users defined in that file.
+
+ This is only the raw data file; the actual aliasing information is
+ placed into a binary format in the file /etc/mail/aliases.db using the
+ program newaliases(1). A newaliases command should be executed each
+ time the aliases file is changed for the change to take effect.
+
+SSEEEE AALLSSOO
+ newaliases(1), dbm(3), dbopen(3), db_open(3), sendmail(8)
+
+ _S_E_N_D_M_A_I_L _I_n_s_t_a_l_l_a_t_i_o_n _a_n_d _O_p_e_r_a_t_i_o_n _G_u_i_d_e_.
+
+ _S_E_N_D_M_A_I_L _A_n _I_n_t_e_r_n_e_t_w_o_r_k _M_a_i_l _R_o_u_t_e_r_.
+
+BBUUGGSS
+ If you have compiled sendmail with DBM support instead of NEWDB, you
+ may have encountered problems in dbm(3) restricting a single alias to
+ about 1000 bytes of information. You can get longer aliases by
+ ``chaining''; that is, make the last name in the alias be a dummy name
+ which is a continuation alias.
+
+HHIISSTTOORRYY
+ The aalliiaasseess file format appeared in 4.0BSD.
+
+
+
+ $Date: 2004/07/12 05:39:21 $ ALIASES(5)
diff --git a/src/collect.c b/src/collect.c
index 56fed0a664766..0a2cdaba83ebf 100644
--- a/src/collect.c
+++ b/src/collect.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 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: collect.c,v 8.280 2006/11/29 00:20:40 ca Exp $")
+SM_RCSID("@(#)$Id: collect.c,v 8.282 2008/01/31 18:48:29 ca Exp $")
static void eatfrom __P((char *volatile, ENVELOPE *));
static void collect_doheader __P((ENVELOPE *));
@@ -308,6 +308,7 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
dbto = smtpmode ? ((int) TimeOuts.to_datablock * 1000)
: SM_TIME_FOREVER;
sm_io_setinfo(fp, SM_IO_WHAT_TIMEOUT, &dbto);
+ set_tls_rd_tmo(TimeOuts.to_datablock);
c = SM_IO_EOF;
inputerr = false;
headeronly = hdrp != NULL;
diff --git a/src/conf.c b/src/conf.c
index 0cbb88e34ddff..bf9705712c443 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 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: conf.c,v 8.1136 2007/10/10 00:06:45 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.1141 2008/04/14 02:09:35 ca Exp $")
#include <sm/sendmail.h>
#include <sendmail/pathnames.h>
@@ -1513,7 +1513,7 @@ getla()
sm_dprintf("getla: symbol address = %#lx\n",
(unsigned long) Nl[X_AVENRUN].n_value);
if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, SEEK_SET) == -1 ||
- read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
+ read(kmem, (char *) avenrun, sizeof(avenrun)) != sizeof(avenrun))
{
/* thank you Ian */
if (tTd(3, 1))
@@ -1835,7 +1835,7 @@ getla(void)
if (lseek(kmem, CAST_SYSMP(sysmp(MP_KERNADDR, MPKA_AVENRUN)), SEEK_SET)
== -1 ||
- read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
+ read(kmem, (char *) avenrun, sizeof(avenrun)) != sizeof(avenrun))
{
if (tTd(3, 1))
sm_dprintf("getla: lseek or read: %s\n",
@@ -1943,6 +1943,13 @@ getla()
}
r = read(afd, &avenrun, sizeof(avenrun));
+ if (r != sizeof(avenrun))
+ {
+ sm_syslog(LOG_ERR, NOQID,
+ "can't read %s: %s", _PATH_AVENRUN,
+ r == -1 ? sm_errstring(errno) : "short read");
+ return -1;
+ }
if (tTd(3, 5))
sm_dprintf("getla: avenrun = %d\n", avenrun);
@@ -6024,6 +6031,10 @@ char *FFRCompileOptions[] =
/* DefaultAuthInfo doesn't really work in 8.13 anymore. */
"_FFR_ALLOW_SASLINFO",
#endif /* _FFR_ALLOW_SASLINFO */
+#if _FFR_BADRCPT_SHUTDOWN
+ /* shut down connection (421) if there are too many bad RCPTs */
+ "_FFR_BADRCPT_SHUTDOWN",
+#endif /* _FFR_BADRCPT_SHUTDOWN */
#if _FFR_BESTMX_BETTER_TRUNCATION
/* Better truncation of list of MX records for dns map. */
"_FFR_BESTMX_BETTER_TRUNCATION",
@@ -6164,6 +6175,10 @@ char *FFRCompileOptions[] =
/* Ignore extensions offered in response to HELO */
"_FFR_IGNORE_EXT_ON_HELO",
#endif /* _FFR_IGNORE_EXT_ON_HELO */
+#if _FFR_LOCAL_DAEMON
+ /* Local daemon mode (-bl) which only accepts loopback connections */
+ "_FFR_LOCAL_DAEMON",
+#endif /* _FFR_LOCAL_DAEMON */
#if _FFR_MAXDATASIZE
/*
** It is possible that a header is larger than MILTER_CHUNK_SIZE,
diff --git a/src/daemon.c b/src/daemon.c
index 76b5b582607a4..06a36c7e64874 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include "map.h"
-SM_RCSID("@(#)$Id: daemon.c,v 8.678 2007/03/08 00:33:40 ca Exp $")
+SM_RCSID("@(#)$Id: daemon.c,v 8.680 2008/02/14 00:20:26 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -1257,7 +1257,8 @@ setupdaemon(daemonaddr)
#if NETINET
case AF_INET:
if (daemonaddr->sin.sin_addr.s_addr == 0)
- daemonaddr->sin.sin_addr.s_addr = INADDR_ANY;
+ daemonaddr->sin.sin_addr.s_addr =
+ LocalDaemon ? htonl(INADDR_LOOPBACK) : INADDR_ANY;
port = daemonaddr->sin.sin_port;
break;
#endif /* NETINET */
@@ -1265,7 +1266,8 @@ setupdaemon(daemonaddr)
#if NETINET6
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&daemonaddr->sin6.sin6_addr))
- daemonaddr->sin6.sin6_addr = in6addr_any;
+ daemonaddr->sin6.sin6_addr =
+ LocalDaemon ? in6addr_loopback : in6addr_any;
port = daemonaddr->sin6.sin6_port;
break;
#endif /* NETINET6 */
@@ -2204,7 +2206,8 @@ makeconnection(host, port, mci, e, enough)
#if NETINET
case AF_INET:
if (clt_addr.sin.sin_addr.s_addr == 0)
- clt_addr.sin.sin_addr.s_addr = INADDR_ANY;
+ clt_addr.sin.sin_addr.s_addr = LocalDaemon ?
+ htonl(INADDR_LOOPBACK) : INADDR_ANY;
else
clt_bind = true;
if (clt_addr.sin.sin_port != 0)
@@ -2215,7 +2218,8 @@ makeconnection(host, port, mci, e, enough)
#if NETINET6
case AF_INET6:
if (IN6_IS_ADDR_UNSPECIFIED(&clt_addr.sin6.sin6_addr))
- clt_addr.sin6.sin6_addr = in6addr_any;
+ clt_addr.sin6.sin6_addr = LocalDaemon ?
+ in6addr_loopback : in6addr_any;
else
clt_bind = true;
socksize = sizeof(struct sockaddr_in6);
@@ -3274,7 +3278,7 @@ myhostname(hostbuf, size)
if (strchr(hostbuf, '.') == NULL &&
!getcanonname(hostbuf, size, true, NULL))
{
- sm_syslog(LOG_CRIT, NOQID,
+ sm_syslog(LocalDaemon ? LOG_WARNING : LOG_CRIT, NOQID,
"My unqualified host name (%s) unknown; sleeping for retry",
hostbuf);
message("My unqualified host name (%s) unknown; sleeping for retry",
@@ -3282,7 +3286,7 @@ myhostname(hostbuf, size)
(void) sleep(60);
if (!getcanonname(hostbuf, size, true, NULL))
{
- sm_syslog(LOG_ALERT, NOQID,
+ sm_syslog(LocalDaemon ? LOG_WARNING : LOG_ALERT, NOQID,
"unable to qualify my own domain name (%s) -- using short name",
hostbuf);
message("WARNING: unable to qualify my own domain name (%s) -- using short name",
diff --git a/src/envelope.c b/src/envelope.c
index 20b0ba22b0c6f..641c621a416cc 100644
--- a/src/envelope.c
+++ b/src/envelope.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: envelope.c,v 8.304 2007/04/18 17:15:49 ca Exp $")
+SM_RCSID("@(#)$Id: envelope.c,v 8.305 2008/03/31 16:32:13 ca Exp $")
/*
** CLRSESSENVELOPE -- clear session oriented data in an envelope
@@ -75,7 +75,7 @@ newenvelope(e, parent, rpool)
register ENVELOPE *parent;
SM_RPOOL_T *rpool;
{
- int sendmode, dm;
+ int sendmode;
/*
** This code used to read:
@@ -86,16 +86,8 @@ newenvelope(e, parent, rpool)
** This meant macvalue() could go into an infinite loop.
*/
- dm = DM_NOTSET;
if (parent != NULL)
- {
- char *str;
-
sendmode = parent->e_sendmode;
- str = macvalue(macid("{deliveryMode}"), parent);
- if (str != NULL)
- dm = (int) str[0];
- }
else
sendmode = DM_NOTSET;
@@ -144,9 +136,7 @@ newenvelope(e, parent, rpool)
if (CurEnv->e_xfp != NULL)
(void) sm_io_flush(CurEnv->e_xfp, SM_TIME_DEFAULT);
if (sendmode != DM_NOTSET)
- e->e_sendmode = sendmode;
- if (dm != DM_NOTSET)
- set_delivery_mode(dm, e);
+ set_delivery_mode(sendmode, e);
return e;
}
diff --git a/src/mailq.0 b/src/mailq.0
new file mode 100644
index 0000000000000..1a76dd4182868
--- /dev/null
+++ b/src/mailq.0
@@ -0,0 +1,81 @@
+MAILQ(1) MAILQ(1)
+
+
+
+NNAAMMEE
+ mailq - print the mail queue
+
+SSYYNNOOPPSSIISS
+ mmaaiillqq [--AAcc] [--qq......] [--vv]
+
+DDEESSCCRRIIPPTTIIOONN
+ MMaaiillqq prints a summary of the mail messages queued for future delivery.
+
+ The first line printed for each message shows the internal identifier
+ used on this host for the message with a possible status character, the
+ size of the message in bytes, the date and time the message was
+ accepted into the queue, and the envelope sender of the message. The
+ second line shows the error message that caused this message to be
+ retained in the queue; it will not be present if the message is being
+ processed for the first time. The status characters are either ** to
+ indicate the job is being processed; XX to indicate that the load is too
+ high to process the job; and -- to indicate that the job is too young to
+ process. The following lines show message recipients, one per line.
+
+ MMaaiillqq is identical to ``sendmail -bp''.
+
+ The relevant options are as follows:
+
+ --AAcc Show the mail submission queue specified in _/_e_t_c_/_m_a_i_l_/_s_u_b_m_i_t_._c_f
+ instead of the MTA queue specified in _/_e_t_c_/_m_a_i_l_/_s_e_n_d_m_a_i_l_._c_f.
+
+ --qqLL Show the "lost" items in the mail queue instead of the normal
+ queue items.
+
+ --qqQQ Show the quarantined items in the mail queue instead of the nor-
+ mal queue items.
+
+ --qq[_!]I substr
+ Limit processed jobs to those containing _s_u_b_s_t_r as a substring
+ of the queue id or not when _! is specified.
+
+ --qq[_!]Q substr
+ Limit processed jobs to quarantined jobs containing _s_u_b_s_t_r as a
+ substring of the quarantine reason or not when _! is specified.
+
+ --qq[_!]R substr
+ Limit processed jobs to those containing _s_u_b_s_t_r as a substring
+ of one of the recipients or not when _! is specified.
+
+ --qq[_!]S substr
+ Limit processed jobs to those containing _s_u_b_s_t_r as a substring
+ of the sender or not when _! is specified.
+
+ --vv Print verbose information. This adds the priority of the mes-
+ sage and a single character indicator (``+'' or blank) indicat-
+ ing whether a warning message has been sent on the first line of
+ the message. Additionally, extra lines may be intermixed with
+ the recipients indicating the ``controlling user'' information;
+ this shows who will own any programs that are executed on behalf
+ of this message and the name of the alias this command expanded
+ from, if any. Moreover, status messages for each recipient are
+ printed if available.
+
+ Several sendmail.cf options influence the behavior of the mmaaiillqq util-
+ ity: The number of items printed per queue group is restricted by
+ MMaaxxQQuueeuueeRRuunnSSiizzee if that value is set. The status character ** is not
+ printed for some values of QQuueeuueeSSoorrttOOrrddeerr,, e.g., filename, random, mod-
+ ification, and none, unless a --qq option is used to limit the processed
+ jobs.
+
+ The mmaaiillqq utility exits 0 on success, and >0 if an error occurs.
+
+SSEEEE AALLSSOO
+ sendmail(8)
+
+HHIISSTTOORRYY
+ The mmaaiillqq command appeared in 4.0BSD.
+
+
+
+ $Date: 2007/03/22 18:21:27 $ MAILQ(1)
diff --git a/src/main.c b/src/main.c
index 8680add40b0bb..d68d5b590d6bd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -26,7 +26,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.963 2007/06/29 20:07:37 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.967 2008/03/31 16:32:13 ca Exp $")
#if NETINET || NETINET6
@@ -302,6 +302,9 @@ main(argc, argv, envp)
ExitStat = EX_OK;
SubmitMode = SUBMIT_UNKNOWN;
+#if _FFR_LOCAL_DAEMON
+ LocalDaemon = false;
+#endif /* _FFR_LOCAL_DAEMON */
#if XDEBUG
checkfd012("after openlog");
#endif /* XDEBUG */
@@ -401,6 +404,13 @@ main(argc, argv, envp)
OpMode = j;
break;
+#if _FFR_LOCAL_DAEMON
+ case MD_LOCAL:
+ OpMode = MD_DAEMON;
+ LocalDaemon = true;
+ break;
+#endif /* _FFR_LOCAL_DAEMON */
+
case MD_FREEZE:
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Frozen configurations unsupported\n");
diff --git a/src/makesendmail b/src/makesendmail
new file mode 100755
index 0000000000000..9ca35206710f0
--- /dev/null
+++ b/src/makesendmail
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+# All rights reserved.
+#
+# By using this file, you agree to the terms and conditions set
+# forth in the LICENSE file which can be found at the top level of
+# the sendmail distribution.
+#
+#
+# $Id: makesendmail,v 8.4 1999/04/04 07:01:42 gshapiro Exp $
+
+exec ./Build $*
diff --git a/src/mci.c b/src/mci.c
index ae33f66ce30b5..277011770be74 100644
--- a/src/mci.c
+++ b/src/mci.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: mci.c,v 8.218 2006/08/15 23:24:57 ca Exp $")
+SM_RCSID("@(#)$Id: mci.c,v 8.221 2007/11/13 23:44:25 gshapiro Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -1143,16 +1143,27 @@ mci_traverse_persistent(action, pathname)
pathname, sm_errstring(errno));
return -1;
}
- len = sizeof(newpath) - MAXNAMLEN - 3;
+
+ /*
+ ** Reserve space for trailing '/', at least one
+ ** character, and '\0'
+ */
+
+ len = sizeof(newpath) - 3;
if (sm_strlcpy(newpath, pathname, len) >= len)
{
+ int save_errno = errno;
+
if (tTd(56, 2))
sm_dprintf("mci_traverse: path \"%s\" too long",
pathname);
+ (void) closedir(d);
+ errno = save_errno;
return -1;
}
newptr = newpath + strlen(newpath);
*newptr++ = '/';
+ len = sizeof(newpath) - (newptr - newpath);
/*
** repeat until no file has been removed
@@ -1169,9 +1180,17 @@ mci_traverse_persistent(action, pathname)
if (e->d_name[0] == '.')
continue;
- (void) sm_strlcpy(newptr, e->d_name,
- sizeof(newpath) -
- (newptr - newpath));
+ if (sm_strlcpy(newptr, e->d_name, len) >= len)
+ {
+ /* Skip truncated copies */
+ if (tTd(56, 4))
+ {
+ *newptr = '\0';
+ sm_dprintf("mci_traverse: path \"%s%s\" too long",
+ newpath, e->d_name);
+ }
+ continue;
+ }
if (StopRequest)
stop_sendmail();
diff --git a/src/newaliases.0 b/src/newaliases.0
new file mode 100644
index 0000000000000..540c7d8df5b58
--- /dev/null
+++ b/src/newaliases.0
@@ -0,0 +1,35 @@
+NEWALIASES(1) NEWALIASES(1)
+
+
+
+NNAAMMEE
+ newaliases - rebuild the data base for the mail aliases file
+
+SSYYNNOOPPSSIISS
+ nneewwaalliiaasseess
+
+DDEESSCCRRIIPPTTIIOONN
+ NNeewwaalliiaasseess rebuilds the random access data base for the mail aliases
+ file /etc/mail/aliases. It must be run each time this file is changed
+ in order for the change to take effect.
+
+ NNeewwaalliiaasseess is identical to ``sendmail -bi''.
+
+ The nneewwaalliiaasseess utility exits 0 on success, and >0 if an error occurs.
+
+ Notice: do nnoott use mmaakkeemmaapp to create the aliases data base, because
+ nneewwaalliiaasseess puts a special token into the data base that is required by
+ sseennddmmaaiill..
+
+FFIILLEESS
+ /etc/mail/aliases The mail aliases file
+
+SSEEEE AALLSSOO
+ aliases(5), sendmail(8)
+
+HHIISSTTOORRYY
+ The nneewwaalliiaasseess command appeared in 4.0BSD.
+
+
+
+ $Date: 2001/10/10 03:23:17 $ NEWALIASES(1)
diff --git a/src/parseaddr.c b/src/parseaddr.c
index eca60f984c484..19bcf739bd917 100644
--- a/src/parseaddr.c
+++ b/src/parseaddr.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: parseaddr.c,v 8.401 2007/09/27 23:33:59 ca Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.403 2008/02/08 02:27:35 ca Exp $")
#include <sm/sendmail.h>
#include "map.h"
@@ -1460,6 +1460,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
size_t trsize;
char *replac;
int endtoken;
+ bool external;
STAB *map;
char *mapname;
char **key_rvp;
@@ -1575,6 +1576,7 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
true);
argvect[0] = cbuf;
replac = map_lookup(map, cbuf, argvect, &rstat, e);
+ external = replac != NULL;
/* if no replacement, use default */
if (replac == NULL && default_rvp != NULL)
@@ -1599,7 +1601,8 @@ rewrite(pvp, ruleset, reclevel, e, maxatom)
{
/* scan the new replacement */
xpvp = prescan(replac, '\0', pvpbuf,
- sizeof(pvpbuf), NULL, NULL,
+ sizeof(pvpbuf), NULL,
+ external ? NULL : IntTokenTab,
false);
if (xpvp == NULL)
{
@@ -2263,7 +2266,7 @@ cataddr(pvp, evp, buf, sz, spacesub, external)
{
char *q;
- natomtok = (ExtTokenTab[**pvp & 0xff] == ATM);
+ natomtok = (IntTokenTab[**pvp & 0xff] == ATM);
if (oatomtok && natomtok)
{
*p++ = spacesub;
diff --git a/src/queue.c b/src/queue.c
index e80a0357b9e9d..d4c6369d0e6a0 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/sem.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.975 2007/06/18 20:08:40 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.977 2008/02/15 23:19:58 ca Exp $")
#include <dirent.h>
@@ -4514,7 +4514,7 @@ readqf(e, openonly)
(void) sm_io_close(qfp, SM_TIME_DEFAULT);
return false;
}
-
+
#if _FFR_QF_PARANOIA
/* Check to make sure key fields were read */
if (e->e_from.q_mailer == NULL)
@@ -6596,8 +6596,8 @@ init_sem(owner)
if (SemId < 0)
{
sm_syslog(LOG_ERR, NOQID,
- "func=init_sem, sem_key=%ld, sm_sem_start=%d",
- (long) SemKey, SemId);
+ "func=init_sem, sem_key=%ld, sm_sem_start=%d, error=%s",
+ (long) SemKey, SemId, sm_errstring(-SemId));
return;
}
#endif /* SM_CONF_SEM */
diff --git a/src/ratectrl.c b/src/ratectrl.c
index 22f9803efb5f7..8b95b3753df0e 100644
--- a/src/ratectrl.c
+++ b/src/ratectrl.c
@@ -45,7 +45,7 @@
*/
#include <sendmail.h>
-SM_RCSID("@(#)$Id: ratectrl.c,v 8.11 2006/08/15 23:24:57 ca Exp $")
+SM_RCSID("@(#)$Id: ratectrl.c,v 8.12 2008/02/11 22:56:05 ca Exp $")
/*
** stuff included - given some warnings (inet_ntoa)
@@ -114,7 +114,7 @@ connection_rate_check(hostaddr, e)
/* update server connection rate */
totalrate = total_rate(now, e == NULL);
#if RATECTL_DEBUG
- sm_syslog(LOG_INFO, NOQID, "global connection rate: %d", globalRate);
+ sm_syslog(LOG_INFO, NOQID, "global connection rate: %d", totalrate);
#endif /* RATECTL_DEBUG */
/* update client connection rate */
diff --git a/src/readcf.c b/src/readcf.c
index 0d0849b18d25f..445df9e106867 100644
--- a/src/readcf.c
+++ b/src/readcf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 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/sendmail.h>
-SM_RCSID("@(#)$Id: readcf.c,v 8.664 2007/07/10 17:01:22 ca Exp $")
+SM_RCSID("@(#)$Id: readcf.c,v 8.666 2008/02/14 17:25:14 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -2249,6 +2249,12 @@ static struct optioninfo
# define O_ADDR_TYPE_MODES 0xe0
{ "AddrTypeModes", O_ADDR_TYPE_MODES, OI_NONE },
#endif /* _FFR_ADDR_TYPE_MODES */
+#if _FFR_BADRCPT_SHUTDOWN
+# define O_RCPTSHUTD 0xe1
+ { "BadRcptShutdown", O_RCPTSHUTD, OI_SAFE },
+# define O_RCPTSHUTDG 0xe2
+ { "BadRcptShutdownGood", O_RCPTSHUTDG, OI_SAFE },
+#endif /* _FFR_BADRCPT_SHUTDOWN */
{ NULL, '\0', OI_NONE }
};
@@ -3817,6 +3823,16 @@ setoption(opt, val, safe, sticky, e)
break;
#endif /* _FFR_ADDR_TYPE_MODES */
+#if _FFR_BADRCPT_SHUTDOWN
+ case O_RCPTSHUTD:
+ BadRcptShutdown = atoi(val);
+ break;
+
+ case O_RCPTSHUTDG:
+ BadRcptShutdownGood = atoi(val);
+ break;
+#endif /* _FFR_BADRCPT_SHUTDOWN */
+
default:
if (tTd(37, 1))
{
diff --git a/src/sendmail.0 b/src/sendmail.0
new file mode 100644
index 0000000000000..060ed242f6169
--- /dev/null
+++ b/src/sendmail.0
@@ -0,0 +1,465 @@
+SENDMAIL(8) SENDMAIL(8)
+
+
+
+NNAAMMEE
+ sendmail - an electronic mail transport agent
+
+SSYYNNOOPPSSIISS
+ sseennddmmaaiill [_f_l_a_g_s] [_a_d_d_r_e_s_s _._._.]
+ nneewwaalliiaasseess
+ mmaaiillqq [--vv]
+ hhoossttssttaatt
+ ppuurrggeessttaatt
+ ssmmttppdd
+
+DDEESSCCRRIIPPTTIIOONN
+ SSeennddmmaaiill sends a message to one or more _r_e_c_i_p_i_e_n_t_s_, routing the message
+ over whatever networks are necessary. SSeennddmmaaiill does internetwork for-
+ warding as necessary to deliver the message to the correct place.
+
+ SSeennddmmaaiill is not intended as a user interface routine; other programs
+ provide user-friendly front ends; sseennddmmaaiill is used only to deliver pre-
+ formatted messages.
+
+ With no flags, sseennddmmaaiill reads its standard input up to an end-of-file
+ or a line consisting only of a single dot and sends a copy of the mes-
+ sage found there to all of the addresses listed. It determines the
+ network(s) to use based on the syntax and contents of the addresses.
+
+ Local addresses are looked up in a file and aliased appropriately.
+ Aliasing can be prevented by preceding the address with a backslash.
+ Beginning with 8.10, the sender is included in any alias expansions,
+ e.g., if `john' sends to `group', and `group' includes `john' in the
+ expansion, then the letter will also be delivered to `john'.
+
+ PPaarraammeetteerrss
+ --AAcc Use submit.cf even if the operation mode does not indicate an
+ initial mail submission.
+
+ --AAmm Use sendmail.cf even if the operation mode indicates an initial
+ mail submission.
+
+ --BB_t_y_p_e Set the body type to _t_y_p_e. Current legal values are 7BIT or
+ 8BITMIME.
+
+ --bbaa Go into ARPANET mode. All input lines must end with a CR-LF,
+ and all messages will be generated with a CR-LF at the end.
+ Also, the ``From:'' and ``Sender:'' fields are examined for the
+ name of the sender.
+
+ --bbdd Run as a daemon. SSeennddmmaaiill will fork and run in background lis-
+ tening on socket 25 for incoming SMTP connections. This is nor-
+ mally run from /etc/rc.
+
+ --bbDD Same as --bbdd except runs in foreground.
+
+ --bbhh Print the persistent host status database.
+
+ --bbHH Purge expired entries from the persistent host status database.
+
+ --bbii Initialize the alias database.
+
+ --bbmm Deliver mail in the usual way (default).
+
+ --bbpp Print a listing of the queue(s).
+
+ --bbPP Print number of entries in the queue(s); only available with
+ shared memory support.
+
+ --bbss Use the SMTP protocol as described in RFC821 on standard input
+ and output. This flag implies all the operations of the --bbaa
+ flag that are compatible with SMTP.
+
+ --bbtt Run in address test mode. This mode reads addresses and shows
+ the steps in parsing; it is used for debugging configuration
+ tables.
+
+ --bbvv Verify names only - do not try to collect or deliver a message.
+ Verify mode is normally used for validating users or mailing
+ lists.
+
+ --CC_f_i_l_e Use alternate configuration file. SSeennddmmaaiill gives up any
+ enhanced (set-user-ID or set-group-ID) privileges if an alter-
+ nate configuration file is specified.
+
+ --DD _l_o_g_f_i_l_e
+ Send debugging output to the indicated log file instead of std-
+ out.
+
+ --dd_c_a_t_e_g_o_r_y.._l_e_v_e_l_._._.
+ Set the debugging flag for _c_a_t_e_g_o_r_y to _l_e_v_e_l. _C_a_t_e_g_o_r_y is
+ either an integer or a name specifying the topic, and _l_e_v_e_l 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.
+ The option --dd00..11 prints the version of sseennddmmaaiill and the options
+ it was compiled with.
+ Most other categories are only useful with, and documented in,
+ sseennddmmaaiill's source code.
+
+ --FF_f_u_l_l_n_a_m_e
+ Set the full name of the sender.
+
+ --ff_n_a_m_e Sets the name of the ``from'' person (i.e., the envelope sender
+ of the mail). This address may also be used in the From: header
+ if that header is missing during initial submission. The enve-
+ lope sender address is used as the recipient for delivery status
+ notifications and may also appear in a Return-Path: header. --ff
+ should only be used by ``trusted'' users (normally _r_o_o_t, _d_a_e_m_o_n,
+ and _n_e_t_w_o_r_k) or if the person you are trying to become is the
+ same as the person you are. Otherwise, an X-Authentication-
+ Warning header will be added to the message.
+
+ --GG Relay (gateway) submission of a message, e.g., when rrmmaaiill calls
+ sseennddmmaaiill ..
+
+ --hh_N Set the hop count to _N. The hop count is incremented every time
+ the mail is processed. When it reaches a limit, the mail is
+ returned with an error message, the victim of an aliasing loop.
+ If not specified, ``Received:'' lines in the message are
+ counted.
+
+ --ii Ignore dots alone on lines by themselves in incoming messages.
+ This should be set if you are reading data from a file.
+
+ --LL _t_a_g Set the identifier used in syslog messages to the supplied _t_a_g.
+
+ --NN _d_s_n Set delivery status notification conditions to _d_s_n, which can be
+ `never' for no notifications or a comma separated list of the
+ values `failure' to be notified if delivery failed, `delay' to
+ be notified if delivery is delayed, and `success' to be notified
+ when the message is successfully delivered.
+
+ --nn Don't do aliasing.
+
+ --OO _o_p_t_i_o_n=_v_a_l_u_e
+ Set option _o_p_t_i_o_n to the specified _v_a_l_u_e. This form uses long
+ names. See below for more details.
+
+ --oo_x _v_a_l_u_e
+ Set option _x to the specified _v_a_l_u_e. This form uses single
+ character names only. The short names are not described in this
+ manual page; see the _S_e_n_d_m_a_i_l _I_n_s_t_a_l_l_a_t_i_o_n _a_n_d _O_p_e_r_a_t_i_o_n _G_u_i_d_e
+ for details.
+
+ --pp_p_r_o_t_o_c_o_l
+ Set the name of the protocol used to receive the message. This
+ can be a simple protocol name such as ``UUCP'' or a protocol and
+ hostname, such as ``UUCP:ucbvax''.
+
+ --qq[_t_i_m_e]
+ Process saved messages in the queue at given intervals. If _t_i_m_e
+ is omitted, process the queue once. _T_i_m_e is given as a tagged
+ number, with `s' being seconds, `m' being minutes (default), `h'
+ being hours, `d' being days, and `w' being weeks. For example,
+ `-q1h30m' or `-q90m' would both set the timeout to one hour
+ thirty minutes. By default, sseennddmmaaiill will run in the back-
+ ground. This option can be used safely with --bbdd.
+
+ --qqpp[_t_i_m_e]
+ Similar to --qq_t_i_m_e, except that instead of periodically forking a
+ child to process the queue, sendmail forks a single persistent
+ child for each queue that alternates between processing the
+ queue and sleeping. The sleep time is given as the argument; it
+ defaults to 1 second. The process will always sleep at least 5
+ seconds if the queue was empty in the previous queue run.
+
+ --qqf Process saved messages in the queue once and do not fork(), but
+ run in the foreground.
+
+ --qqG_n_a_m_e
+ Process jobs in queue group called _n_a_m_e only.
+
+ --qq[_!]I_s_u_b_s_t_r
+ Limit processed jobs to those containing _s_u_b_s_t_r as a substring
+ of the queue id or not when _! is specified.
+
+ --qq[_!]Q_s_u_b_s_t_r
+ Limit processed jobs to quarantined jobs containing _s_u_b_s_t_r as a
+ substring of the quarantine reason or not when _! is specified.
+
+ --qq[_!]R_s_u_b_s_t_r
+ Limit processed jobs to those containing _s_u_b_s_t_r as a substring
+ of one of the recipients or not when _! is specified.
+
+ --qq[_!]S_s_u_b_s_t_r
+ Limit processed jobs to those containing _s_u_b_s_t_r as a substring
+ of the sender or not when _! is specified.
+
+ --QQ[reason]
+ Quarantine a normal queue items with the given reason or unquar-
+ antine quarantined queue items if no reason is given. This
+ should only be used with some sort of item matching using as
+ described above.
+
+ --RR _r_e_t_u_r_n
+ Set the amount of the message to be returned if the message
+ bounces. The _r_e_t_u_r_n parameter can be `full' to return the
+ entire message or `hdrs' to return only the headers. In the
+ latter case also local bounces return only the headers.
+
+ --rr_n_a_m_e An alternate and obsolete form of the --ff flag.
+
+ --tt Read message for recipients. To:, Cc:, and Bcc: lines will be
+ scanned for recipient addresses. The Bcc: line will be deleted
+ before transmission.
+
+ --VV _e_n_v_i_d
+ Set the original envelope id. This is propagated across SMTP to
+ servers that support DSNs and is returned in DSN-compliant error
+ messages.
+
+ --vv Go into verbose mode. Alias expansions will be announced, etc.
+
+ --XX _l_o_g_f_i_l_e
+ Log all traffic in and out of mailers in the indicated log file.
+ This should only be used as a last resort for debugging mailer
+ bugs. It will log a lot of data very quickly.
+
+ ---- Stop processing command flags and use the rest of the arguments
+ as addresses.
+
+ OOppttiioonnss
+ There are also a number of processing options that may be set. Nor-
+ mally these will only be used by a system administrator. Options may
+ be set either on the command line using the --oo flag (for short names),
+ the --OO flag (for long names), or in the configuration file. This is a
+ partial list limited to those options that are likely to be useful on
+ the command line and only shows the long names; for a complete list
+ (and details), consult the _S_e_n_d_m_a_i_l _I_n_s_t_a_l_l_a_t_i_o_n _a_n_d _O_p_e_r_a_t_i_o_n _G_u_i_d_e.
+ The options are:
+
+ AliasFile=_f_i_l_e
+ Use alternate alias file.
+
+ HoldExpensive
+ On mailers that are considered ``expensive'' to connect to,
+ don't initiate immediate connection. This requires queueing.
+
+ CheckpointInterval=_N
+ Checkpoint the queue file after every _N successful deliveries
+ (default 10). This avoids excessive duplicate deliveries when
+ sending to long mailing lists interrupted by system crashes.
+
+ DeliveryMode=_x
+ Set the delivery mode to _x. Delivery modes are `i' for interac-
+ tive (synchronous) delivery, `b' for background (asynchronous)
+ delivery, `q' for queue only - i.e., actual delivery is done the
+ next time the queue is run, and `d' for deferred - the same as
+ `q' except that database lookups for maps which have set the -D
+ option (default for the host map) are avoided.
+
+ ErrorMode=_x
+ Set error processing to mode _x. Valid modes are `m' to mail
+ back the error message, `w' to ``write'' back the error message
+ (or mail it back if the sender is not logged in), `p' to print
+ the errors on the terminal (default), `q' to throw away error
+ messages (only exit status is returned), and `e' to do special
+ processing for the BerkNet. If the text of the message is not
+ mailed back by modes `m' or `w' and if the sender is local to
+ this machine, a copy of the message is appended to the file
+ _d_e_a_d_._l_e_t_t_e_r in the sender's home directory.
+
+ SaveFromLine
+ Save UNIX-style From lines at the front of messages.
+
+ MaxHopCount=_N
+ The maximum number of times a message is allowed to ``hop''
+ before we decide it is in a loop.
+
+ IgnoreDots
+ Do not take dots on a line by themselves as a message termina-
+ tor.
+
+ SendMimeErrors
+ Send error messages in MIME format. If not set, the DSN (Deliv-
+ ery Status Notification) SMTP extension is disabled.
+
+ ConnectionCacheTimeout=_t_i_m_e_o_u_t
+ Set connection cache timeout.
+
+ ConnectionCacheSize=_N
+ Set connection cache size.
+
+ LogLevel=_n
+ The log level.
+
+ MeToo=_F_a_l_s_e
+ Don't send to ``me'' (the sender) if I am in an alias expansion.
+
+ CheckAliases
+ Validate the right hand side of aliases during a newaliases(1)
+ command.
+
+ OldStyleHeaders
+ If set, this message may have old style headers. If not set,
+ this message is guaranteed to have new style headers (i.e., com-
+ mas instead of spaces between addresses). If set, an adaptive
+ algorithm is used that will correctly determine the header for-
+ mat in most cases.
+
+ QueueDirectory=_q_u_e_u_e_d_i_r
+ Select the directory in which to queue messages.
+
+ StatusFile=_f_i_l_e
+ Save statistics in the named file.
+
+ Timeout.queuereturn=_t_i_m_e
+ Set the timeout on undelivered messages in the queue to the
+ specified time. After delivery has failed (e.g., because of a
+ host being down) for this amount of time, failed messages will
+ be returned to the sender. The default is five days.
+
+ UserDatabaseSpec=_u_s_e_r_d_a_t_a_b_a_s_e
+ If set, a user database is consulted to get forwarding informa-
+ tion. You can consider this an adjunct to the aliasing mecha-
+ nism, except that the database is intended to be distributed;
+ aliases are local to a particular host. This may not be avail-
+ able if your sendmail does not have the USERDB option compiled
+ in.
+
+ ForkEachJob
+ Fork each job during queue runs. May be convenient on memory-
+ poor machines.
+
+ SevenBitInput
+ Strip incoming messages to seven bits.
+
+ EightBitMode=_m_o_d_e
+ Set the handling of eight bit input to seven bit destinations to
+ _m_o_d_e: m (mimefy) will convert to seven-bit MIME format, p (pass)
+ will pass it as eight bits (but violates protocols), and s
+ (strict) will bounce the message.
+
+ MinQueueAge=_t_i_m_e_o_u_t
+ Sets how long a job must ferment in the queue between attempts
+ to send it.
+
+ DefaultCharSet=_c_h_a_r_s_e_t
+ Sets the default character set used to label 8-bit data that is
+ not otherwise labelled.
+
+ DialDelay=_s_l_e_e_p_t_i_m_e
+ If opening a connection fails, sleep for _s_l_e_e_p_t_i_m_e seconds and
+ try again. Useful on dial-on-demand sites.
+
+ NoRecipientAction=_a_c_t_i_o_n
+ Set the behaviour when there are no recipient headers (To:, Cc:
+ or Bcc:) in the message to _a_c_t_i_o_n: none leaves the message
+ unchanged, add-to adds a To: header with the envelope recipi-
+ ents, add-apparently-to adds an Apparently-To: header with the
+ envelope recipients, add-bcc adds an empty Bcc: header, and add-
+ to-undisclosed adds a header reading `To: undisclosed-recipi-
+ ents:;'.
+
+ MaxDaemonChildren=_N
+ Sets the maximum number of children that an incoming SMTP daemon
+ will allow to spawn at any time to _N.
+
+ ConnectionRateThrottle=_N
+ Sets the maximum number of connections per second to the SMTP
+ port to _N.
+
+ In aliases, the first character of a name may be a vertical bar to
+ cause interpretation of the rest of the name as a command to pipe the
+ mail to. It may be necessary to quote the name to keep sseennddmmaaiill from
+ suppressing the blanks from between arguments. For example, a common
+ alias is:
+
+ msgs: "|/usr/bin/msgs -s"
+
+ Aliases may also have the syntax ``:include:_f_i_l_e_n_a_m_e'' to ask sseennddmmaaiill
+ to read the named file for a list of recipients. For example, an alias
+ such as:
+
+ poets: ":include:/usr/local/lib/poets.list"
+
+ would read _/_u_s_r_/_l_o_c_a_l_/_l_i_b_/_p_o_e_t_s_._l_i_s_t for the list of addresses making
+ up the group.
+
+ SSeennddmmaaiill returns an exit status describing what it did. The codes are
+ defined in <_s_y_s_e_x_i_t_s_._h>:
+
+ EX_OK Successful completion on all addresses.
+
+ EX_NOUSER
+ User name not recognized.
+
+ EX_UNAVAILABLE
+ Catchall meaning necessary resources were not available.
+
+ EX_SYNTAX
+ Syntax error in address.
+
+ EX_SOFTWARE
+ Internal software error, including bad arguments.
+
+ EX_OSERR
+ Temporary operating system error, such as ``cannot fork''.
+
+ EX_NOHOST
+ Host name not recognized.
+
+ EX_TEMPFAIL
+ Message could not be sent immediately, but was queued.
+
+ If invoked as nneewwaalliiaasseess, sseennddmmaaiill will rebuild the alias database. If
+ invoked as mmaaiillqq, sseennddmmaaiill will print the contents of the mail queue.
+ If invoked as hhoossttssttaatt, sseennddmmaaiill will print the persistent host status
+ database. If invoked as ppuurrggeessttaatt, sseennddmmaaiill will purge expired entries
+ from the persistent host status database. If invoked as ssmmttppdd, sseenndd--
+ mmaaiill will act as a daemon, as if the --bbdd option were specified.
+
+NNOOTTEESS
+ sseennddmmaaiill often gets blamed for many problems that are actually the
+ result of other problems, such as overly permissive modes on directo-
+ ries. For this reason, sseennddmmaaiill checks the modes on system directories
+ and files to determine if they can be trusted. Although these checks
+ can be turned off and your system security reduced by setting the DDoonntt--
+ BBllaammeeSSeennddmmaaiill option, the permission problems should be fixed. For
+ more information, see:
+
+ _h_t_t_p_:_/_/_w_w_w_._s_e_n_d_m_a_i_l_._o_r_g_/_t_i_p_s_/_D_o_n_t_B_l_a_m_e_S_e_n_d_m_a_i_l_._h_t_m_l
+
+FFIILLEESS
+ Except for the file _/_e_t_c_/_m_a_i_l_/_s_e_n_d_m_a_i_l_._c_f itself the following path-
+ names are all specified in _/_e_t_c_/_m_a_i_l_/_s_e_n_d_m_a_i_l_._c_f. Thus, these values
+ are only approximations.
+
+
+ /etc/mail/aliases
+ raw data for alias names
+
+ /etc/mail/aliases.db
+ data base of alias names
+
+ /etc/mail/sendmail.cf
+ configuration file
+
+ /etc/mail/helpfile
+ help file
+
+ /etc/mail/statistics
+ collected statistics
+
+ /var/spool/mqueue/*
+ temp files
+
+SSEEEE AALLSSOO
+ binmail(1), mail(1), rmail(1), syslog(3), aliases(5), mailaddr(7),
+ rc(8)
+
+ DARPA Internet Request For Comments _R_F_C_8_1_9, _R_F_C_8_2_1, _R_F_C_8_2_2. _S_e_n_d_m_a_i_l
+ _I_n_s_t_a_l_l_a_t_i_o_n _a_n_d _O_p_e_r_a_t_i_o_n _G_u_i_d_e, No. 8, SMM.
+
+ http://www.sendmail.org/
+
+HHIISSTTOORRYY
+ The sseennddmmaaiill command appeared in 4.2BSD.
+
+
+
+ $Date: 2007/08/02 05:42:33 $ SENDMAIL(8)
diff --git a/src/sendmail.h b/src/sendmail.h
index 82ab6a9d93120..88607e684ae0b 100644
--- a/src/sendmail.h
+++ b/src/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -52,7 +52,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1052 2007/10/05 23:06:30 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1059 2008/02/15 23:19:58 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -1551,6 +1551,7 @@ extern void stabapply __P((void (*)(STAB *, int), int));
#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */
#define MD_DAEMON 'd' /* run as a daemon */
#define MD_FGDAEMON 'D' /* run daemon in foreground */
+#define MD_LOCAL 'l' /* like daemon, but localhost only */
#define MD_VERIFY 'v' /* verify: don't collect or deliver */
#define MD_TEST 't' /* test mode: resolve addrs only */
#define MD_INITALIAS 'i' /* initialize alias database */
@@ -1561,6 +1562,12 @@ extern void stabapply __P((void (*)(STAB *, int), int));
#define MD_PURGESTAT 'H' /* purge persistent host stat info */
#define MD_QUEUERUN 'q' /* queue run */
+#if _FFR_LOCAL_DAEMON
+EXTERN bool LocalDaemon;
+#else /* _FFR_LOCAL_DAEMON */
+# define LocalDaemon false
+#endif /* _FFR_LOCAL_DAEMON */
+
/* Note: see also include/sendmail/pathnames.h: GET_CLIENT_CF */
/* values for e_sendmode -- send modes */
@@ -2229,6 +2236,10 @@ EXTERN char InetMode; /* default network for daemon mode */
EXTERN char OpMode; /* operation mode, see below */
EXTERN char SpaceSub; /* substitution for <lwsp> */
EXTERN int BadRcptThrottle; /* Throttle rejected RCPTs per SMTP message */
+#if _FFR_BADRCPT_SHUTDOWN
+EXTERN int BadRcptShutdown; /* Shutdown connection for rejected RCPTs */
+EXTERN int BadRcptShutdownGood; /* above even when there are good RCPTs */
+#endif /* _FFR_BADRCPT_SHUTDOWN */
EXTERN int CheckpointInterval; /* queue file checkpoint interval */
EXTERN int ConfigLevel; /* config file level */
EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */
@@ -2590,6 +2601,11 @@ extern void setoption __P((int, char *, bool, bool, ENVELOPE *));
extern sigfunc_t setsignal __P((int, sigfunc_t));
extern void sm_setuserenv __P((const char *, const char *));
extern void settime __P((ENVELOPE *));
+#if STARTTLS
+extern void set_tls_rd_tmo __P((int));
+#else /* STARTTLS */
+#define set_tls_rd_tmo(rd_tmo)
+#endif /* STARTTLS */
extern char *sfgets __P((char *, int, SM_FILE_T *, time_t, char *));
extern char *shortenstring __P((const char *, size_t));
extern char *shorten_hostname __P((char []));
diff --git a/src/sfsasl.c b/src/sfsasl.c
index 216d87ef0a604..67e919f34df34 100644
--- a/src/sfsasl.c
+++ b/src/sfsasl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2006, 2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: sfsasl.c,v 8.115 2006/04/18 21:34:07 ca Exp $")
+SM_RCSID("@(#)$Id: sfsasl.c,v 8.117 2008/01/31 18:48:29 ca Exp $")
#include <stdlib.h>
#include <sendmail.h>
#include <sm/time.h>
@@ -675,6 +675,26 @@ tls_retry(ssl, rfd, wfd, tlsstart, timeout, err, where)
#endif /* ETIMEDOUT */
/*
+** SET_TLS_RD_TMO -- read secured information for the caller
+**
+** Parameters:
+** rd_tmo -- read timeout
+**
+** Results:
+** none
+** This is a hack: there is no way to pass it in
+*/
+
+static int tls_rd_tmo = -1;
+
+void
+set_tls_rd_tmo(rd_tmo)
+ int rd_tmo;
+{
+ tls_rd_tmo = rd_tmo;
+}
+
+/*
** TLS_READ -- read secured information for the caller
**
** Parameters:
@@ -725,7 +745,9 @@ tls_read(fp, buf, size)
rfd = SSL_get_rfd(so->con);
wfd = SSL_get_wfd(so->con);
try = tls_retry(so->con, rfd, wfd, tlsstart,
- TimeOuts.to_datablock, ssl_err, "read");
+ (tls_rd_tmo < 0) ? TimeOuts.to_datablock
+ : tls_rd_tmo,
+ ssl_err, "read");
if (try > 0)
goto retry;
errno = SM_ERR_TIMEOUT;
diff --git a/src/sm_resolve.c b/src/sm_resolve.c
index 035a9e51bad8b..6d9c28d73fa12 100644
--- a/src/sm_resolve.c
+++ b/src/sm_resolve.c
@@ -46,7 +46,7 @@
# if NAMED_BIND
# include "sm_resolve.h"
-SM_RCSID("$Id: sm_resolve.c,v 8.35 2007/06/25 16:20:14 ca Exp $")
+SM_RCSID("$Id: sm_resolve.c,v 8.36 2008/02/11 23:04:16 ca Exp $")
static struct stot
{
@@ -168,7 +168,7 @@ parse_dns_reply(data, len)
int len;
{
unsigned char *p;
- ushort ans_cnt, ui;
+ unsigned short ans_cnt, ui;
int status;
size_t l;
char host[MAXHOSTNAMELEN];
@@ -198,7 +198,7 @@ parse_dns_reply(data, len)
return NULL;
}
- ans_cnt = ntohs((ushort) r->dns_r_h.ancount);
+ ans_cnt = ntohs((unsigned short) r->dns_r_h.ancount);
p += status;
GETSHORT(r->dns_r_q.dns_q_type, p);
diff --git a/src/srvrsmtp.c b/src/srvrsmtp.c
index 514a5e6310b85..fffcd0d37ab7a 100644
--- a/src/srvrsmtp.c
+++ b/src/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -17,7 +17,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.967 2007/10/01 16:22:14 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.975 2008/03/31 16:32:13 ca Exp $")
#include <sm/time.h>
#include <sm/fdset.h>
@@ -637,6 +637,9 @@ smtp(nullserver, d_flags, e)
# define p_addr_st NULL
#endif /* MILTER */
size_t inplen;
+#if _FFR_BADRCPT_SHUTDOWN
+ int n_badrcpts_adj;
+#endif /* _FFR_BADRCPT_SHUTDOWN */
SevenBitInput_Saved = SevenBitInput;
smtp.sm_nrcpts = 0;
@@ -903,6 +906,8 @@ smtp(nullserver, d_flags, e)
#endif /* SASL */
#if STARTTLS
+
+ set_tls_rd_tmo(TimeOuts.to_nextcommand);
#endif /* STARTTLS */
#if MILTER
@@ -942,6 +947,7 @@ smtp(nullserver, d_flags, e)
/* arrange to ignore send list */
e->e_sendqueue = NULL;
+ lognullconnection = false;
goto doquit;
}
}
@@ -1054,10 +1060,10 @@ smtp(nullserver, d_flags, e)
if (select(fd + 1, FDSET_CAST &readfds,
NULL, NULL, &timeout) > 0 &&
FD_ISSET(fd, &readfds) &&
- (eoftest = sm_io_getc(InChannel, SM_TIME_DEFAULT))
+ (eoftest = sm_io_getc(InChannel, SM_TIME_DEFAULT))
!= SM_IO_EOF)
{
- sm_io_ungetc(InChannel, SM_TIME_DEFAULT,
+ sm_io_ungetc(InChannel, SM_TIME_DEFAULT,
eoftest);
gettimeofday(&ep, NULL);
timersub(&ep, &bp, &tp);
@@ -2523,6 +2529,36 @@ smtp(nullserver, d_flags, e)
milter_rcpt_added = false;
smtp.sm_e_nrcpts_orig = e->e_nrcpts;
#endif
+#if _FFR_BADRCPT_SHUTDOWN
+ /*
+ ** hack to deal with hack, see below:
+ ** n_badrcpts is increased is limit is reached.
+ */
+
+ n_badrcpts_adj = (BadRcptThrottle > 0 &&
+ n_badrcpts > BadRcptThrottle &&
+ LogLevel > 5)
+ ? n_badrcpts - 1 : n_badrcpts;
+ if (BadRcptShutdown > 0 &&
+ n_badrcpts_adj >= BadRcptShutdown &&
+ (BadRcptShutdownGood == 0 ||
+ smtp.sm_nrcpts == 0 ||
+ (n_badrcpts_adj * 100 /
+ (smtp.sm_nrcpts + n_badrcpts) >=
+ BadRcptShutdownGood)))
+ {
+ if (LogLevel > 5)
+ sm_syslog(LOG_INFO, e->e_id,
+ "%s: Possible SMTP RCPT flood, shutting down connection.",
+ CurSmtpClient);
+ message("421 4.7.0 %s Too many bad recipients; closing connection",
+ MyHostName);
+
+ /* arrange to ignore any current send list */
+ e->e_sendqueue = NULL;
+ goto doquit;
+ }
+#endif /* _FFR_BADRCPT_SHUTDOWN */
if (BadRcptThrottle > 0 &&
n_badrcpts >= BadRcptThrottle)
{
@@ -3775,17 +3811,10 @@ smtp_data(smtp, e)
dropenvelope(ee, true, false);
}
}
- sm_rpool_free(e->e_rpool);
-
- /*
- ** At this point, e == &MainEnvelope, but if we did splitting,
- ** then CurEnv may point to an envelope structure that was just
- ** freed with the rpool. So reset CurEnv *before* calling
- ** newenvelope.
- */
CurEnv = e;
features = e->e_features;
+ sm_rpool_free(e->e_rpool);
newenvelope(e, e, sm_rpool_new_x(NULL));
e->e_flags = BlankEnvelope.e_flags;
e->e_features = features;
diff --git a/src/sysexits.h b/src/sysexits.h
new file mode 100644
index 0000000000000..99fe9372021cb
--- /dev/null
+++ b/src/sysexits.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1987, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * By using this file, you agree to the terms and conditions set
+ * forth in the LICENSE file which can be found at the top level of
+ * the sendmail distribution.
+ *
+ * $Id: sysexits.h,v 8.5 2000/11/26 02:13:20 ca Exp $
+ * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYSEXITS_H_
+# define _SYSEXITS_H_
+
+/*
+** SYSEXITS.H -- Exit status codes for system programs.
+**
+** This include file attempts to categorize possible error
+** exit statuses for system programs, notably delivermail
+** and the Berkeley network.
+**
+** Error numbers begin at EX__BASE to reduce the possibility of
+** clashing with other exit statuses that random programs may
+** already return. The meaning of the codes is approximately
+** as follows:
+**
+** EX_USAGE -- The command was used incorrectly, e.g., with
+** the wrong number of arguments, a bad flag, a bad
+** syntax in a parameter, or whatever.
+** EX_DATAERR -- The input data was incorrect in some way.
+** This should only be used for user's data & not
+** system files.
+** EX_NOINPUT -- An input file (not a system file) did not
+** exist or was not readable. This could also include
+** errors like "No message" to a mailer (if it cared
+** to catch it).
+** EX_NOUSER -- The user specified did not exist. This might
+** be used for mail addresses or remote logins.
+** EX_NOHOST -- The host specified did not exist. This is used
+** in mail addresses or network requests.
+** EX_UNAVAILABLE -- A service is unavailable. This can occur
+** if a support program or file does not exist. This
+** can also be used as a catchall message when something
+** you wanted to do doesn't work, but you don't know
+** why.
+** EX_SOFTWARE -- An internal software error has been detected.
+** This should be limited to non-operating system related
+** errors as possible.
+** EX_OSERR -- An operating system error has been detected.
+** This is intended to be used for such things as "cannot
+** fork", "cannot create pipe", or the like. It includes
+** things like getuid returning a user that does not
+** exist in the passwd file.
+** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
+** etc.) does not exist, cannot be opened, or has some
+** sort of error (e.g., syntax error).
+** EX_CANTCREAT -- A (user specified) output file cannot be
+** created.
+** EX_IOERR -- An error occurred while doing I/O on some file.
+** EX_TEMPFAIL -- temporary failure, indicating something that
+** is not really an error. In sendmail, this means
+** that a mailer (e.g.) could not create a connection,
+** and the request should be reattempted later.
+** EX_PROTOCOL -- the remote system returned something that
+** was "not possible" during a protocol exchange.
+** EX_NOPERM -- You did not have sufficient permission to
+** perform the operation. This is not intended for
+** file system problems, which should use NOINPUT or
+** CANTCREAT, but rather for higher level permissions.
+*/
+
+# define EX_OK 0 /* successful termination */
+
+# define EX__BASE 64 /* base value for error messages */
+
+# define EX_USAGE 64 /* command line usage error */
+# define EX_DATAERR 65 /* data format error */
+# define EX_NOINPUT 66 /* cannot open input */
+# define EX_NOUSER 67 /* addressee unknown */
+# define EX_NOHOST 68 /* host name unknown */
+# define EX_UNAVAILABLE 69 /* service unavailable */
+# define EX_SOFTWARE 70 /* internal software error */
+# define EX_OSERR 71 /* system error (e.g., can't fork) */
+# define EX_OSFILE 72 /* critical OS file missing */
+# define EX_CANTCREAT 73 /* can't create (user) output file */
+# define EX_IOERR 74 /* input/output error */
+# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
+# define EX_PROTOCOL 76 /* remote error in protocol */
+# define EX_NOPERM 77 /* permission denied */
+# define EX_CONFIG 78 /* configuration error */
+
+# define EX__MAX 78 /* maximum listed value */
+
+#endif /* ! _SYSEXITS_H_ */
diff --git a/src/usersmtp.c b/src/usersmtp.c
index 724f10c90df7f..b29495c3ae7fe 100644
--- a/src/usersmtp.c
+++ b/src/usersmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2006, 2008 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: usersmtp.c,v 8.470 2007/10/17 21:35:30 ca Exp $")
+SM_RCSID("@(#)$Id: usersmtp.c,v 8.472 2008/01/31 18:48:29 ca Exp $")
#include <sysexits.h>
@@ -3077,6 +3077,7 @@ reply(m, mci, e, timeout, pfunc, enhstat, rtype)
*/
bufp = SmtpReplyBuffer;
+ set_tls_rd_tmo(timeout);
for (;;)
{
register char *p;
diff --git a/src/util.c b/src/util.c
index 95d2f9a4138a4..dab5961305008 100644
--- a/src/util.c
+++ b/src/util.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: util.c,v 8.413 2007/09/26 23:29:11 ca Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.414 2007/11/02 17:30:38 ca Exp $")
#include <sm/sendmail.h>
#include <sysexits.h>
@@ -2823,9 +2823,10 @@ count_open_connections(hostaddr)
return 0;
/*
- ** Initialize to 1 instead of 0 because this code gets called
- ** before proc_list_add() gets called, so we (the daemon child
- ** for this connection) don't count ourselves.
+ ** This code gets called before proc_list_add() gets called,
+ ** so we (the daemon child for this connection) have not yet
+ ** counted ourselves. Hence initialize the counter to 1
+ ** instead of 0 to compensate.
*/
n = 1;
diff --git a/src/version.c b/src/version.c
index ee09fc93a2d4c..3e5ee8e6fdcc2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2008 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.199 2007/10/31 16:04:12 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.208 2008/04/17 17:04:30 ca Exp $")
-char Version[] = "8.14.2";
+char Version[] = "8.14.3";