diff options
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r-- | contrib/sendmail/src/conf.c | 141 | ||||
-rw-r--r-- | contrib/sendmail/src/conf.h | 53 | ||||
-rw-r--r-- | contrib/sendmail/src/headers.c | 70 | ||||
-rw-r--r-- | contrib/sendmail/src/mci.c | 14 | ||||
-rw-r--r-- | contrib/sendmail/src/savemail.c | 261 | ||||
-rw-r--r-- | contrib/sendmail/src/sendmail.8 | 7 |
6 files changed, 183 insertions, 363 deletions
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index f8cd300..381ca0a 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -9,25 +9,18 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #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.1061 2005/03/07 17:18:44 ca Exp $") #include <sendmail/pathnames.h> #if NEWDB # include "sm/bdb.h" #endif /* NEWDB */ -#ifdef DEC -# if NETINET6 -/* for the IPv6 device lookup */ -# define _SOCKADDR_LEN -# include <macros.h> -# endif /* NETINET6 */ -#endif /* DEC */ - # include <sys/ioctl.h> # include <sys/param.h> @@ -352,7 +345,6 @@ setdefaults(e) MaxMimeFieldLength = MaxMimeHeaderLength / 2; MaxForwardEntries = 0; FastSplit = 1; - MaxNOOPCommands = MAXNOOPCOMMANDS; #if SASL AuthMechanisms = newstr(AUTH_MECHANISMS); AuthRealm = NULL; @@ -2183,25 +2175,10 @@ shouldqueue(pri, ct) time_t ct; { bool rval; -#if _FFR_MEMSTAT - long memfree; -#endif /* _FFR_MEMSTAT */ if (tTd(3, 30)) sm_dprintf("shouldqueue: CurrentLA=%d, pri=%ld: ", CurrentLA, pri); - -#if _FFR_MEMSTAT - if (QueueLowMem > 0 && - sm_memstat_get(MemoryResource, &memfree) >= 0 && - memfree < QueueLowMem) - { - if (tTd(3, 30)) - sm_dprintf("true (memfree=%ld < QueueLowMem)\n", - memfree, QueueLowMem); - return true; - } -#endif /* _FFR_MEMSTAT */ if (CurrentLA < QueueLA) { if (tTd(3, 30)) @@ -2250,9 +2227,6 @@ refuseconnections(name, e, d, active) static int conncnt[MAXDAEMONS]; static time_t firstrejtime[MAXDAEMONS]; static time_t nextlogtime[MAXDAEMONS]; -#if _FFR_MEMSTAT - long memfree; -#endif /* _FFR_MEMSTAT */ #if XLA if (!xla_smtp_ok()) @@ -2289,19 +2263,6 @@ refuseconnections(name, e, d, active) conncnt[d] = 0; } - -#if _FFR_MEMSTAT - if (RefuseLowMem > 0 && - sm_memstat_get(MemoryResource, &memfree) >= 0 && - memfree < RefuseLowMem) - { -# define R_MSG_LM "rejecting connections on daemon %s: free memory: %ld" - sm_setproctitle(true, e, R_MSG_LM, name, memfree); - if (LogLevel > 8) - sm_syslog(LOG_NOTICE, NOQID, R_MSG_LM, name, memfree); - return true; - } -#endif /* _FFR_MEMSTAT */ sm_getla(); if (RefuseLA > 0 && CurrentLA >= RefuseLA) { @@ -3771,7 +3732,7 @@ chownsafe(fd, safedir) #if HASSETRLIMIT # ifdef RLIMIT_NEEDS_SYS_TIME_H -# include <sm/time.h> +# include <sys/time.h> # endif /* RLIMIT_NEEDS_SYS_TIME_H */ # include <sys/resource.h> #endif /* HASSETRLIMIT */ @@ -3833,13 +3794,6 @@ setvendor(vendor) return true; } #endif /* SUN_EXTENSIONS */ -#ifdef DEC - if (sm_strcasecmp(vendor, "Digital") == 0) - { - VendorCode = VENDOR_DEC; - return true; - } -#endif /* DEC */ #if defined(VENDOR_NAME) && defined(VENDOR_CODE) if (sm_strcasecmp(vendor, VENDOR_NAME) == 0) @@ -3931,8 +3885,8 @@ vendor_pre_defaults(e) ** /etc/mail/sendmail.cf without this */ - sm_setuserenv("ISP", NULL); - sm_setuserenv("SYSTYPE", NULL); + setuserenv("ISP", NULL); + setuserenv("SYSTYPE", NULL); #endif /* apollo */ } @@ -3946,7 +3900,7 @@ vendor_post_defaults(e) /* Makes sure the SOCK environment variable remains */ if (p = getextenv("SOCK")) - sm_setuserenv("SOCK", p); + setuserenv("SOCK", p); #endif /* __QNX__ */ #if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES) sun_post_defaults(e); @@ -4722,7 +4676,7 @@ add_hostnames(sa) struct rtentry; struct mbuf; # ifndef SUNOS403 -# include <sm/time.h> +# include <sys/time.h> # endif /* ! SUNOS403 */ # if (_AIX4 >= 40300) && !defined(_NET_IF_H) # undef __P @@ -4863,13 +4817,7 @@ load_if_names() i += sizeof ifr->lifr_name + sa->sa.sa_len; else # endif /* BSD4_4_SOCKADDR */ -# ifdef DEC - /* fix for IPv6 size differences */ - i += sizeof ifr->ifr_name + - max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len); -# else /* DEC */ i += sizeof *ifr; -# endif /* DEC */ if (tTd(0, 20)) sm_dprintf("%s\n", anynet_ntoa(sa)); @@ -5362,8 +5310,8 @@ sm_syslog(level, id, fmt, va_alist) va_dcl #endif /* __STDC__ */ { - char *buf; - size_t bufsize; + static char *buf = NULL; + static size_t bufsize; char *begin, *end; int save_errno; int seq = 1; @@ -5387,8 +5335,11 @@ sm_syslog(level, id, fmt, va_alist) else idlen = strlen(id) + SyslogPrefixLen; - buf = buf0; - bufsize = sizeof buf0; + if (buf == NULL) + { + buf = buf0; + bufsize = sizeof buf0; + } for (;;) { @@ -5430,8 +5381,8 @@ sm_syslog(level, id, fmt, va_alist) (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s: %s\n", id, newstring); #endif /* LOG */ - if (buf != buf0) - sm_free(buf); + if (buf == buf0) + buf = NULL; errno = save_errno; return; } @@ -5495,8 +5446,8 @@ sm_syslog(level, id, fmt, va_alist) (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s[%d]: %s\n", id, seq, begin); #endif /* LOG */ - if (buf != buf0) - sm_free(buf); + if (buf == buf0) + buf = NULL; errno = save_errno; } /* @@ -5706,9 +5657,6 @@ char *CompileOptions[] = #if LDAPMAP "LDAPMAP", #endif /* LDAPMAP */ -#if LDAP_REFERRALS - "LDAP_REFERRALS", -#endif /* LDAP_REFERRALS */ #if LOG "LOG", #endif /* LOG */ @@ -6099,10 +6047,6 @@ char *FFRCompileOptions[] = /* What it says :-) */ "_FFR_DEPRECATE_MAILER_FLAG_I", #endif /* _FFR_DEPRECATE_MAILER_FLAG_I */ -#if _FFR_DM_ONE - /* deliver first TA in background, then queue */ - "_FFR_DM_ONE", -#endif /* _FFR_DM_ONE */ #if _FFR_DIGUNIX_SAFECHOWN /* Properly set SAFECHOWN (include/sm/conf.h) for Digital UNIX */ /* Problem noted by Anne Bennett of Concordia University */ @@ -6166,10 +6110,6 @@ char *FFRCompileOptions[] = /* Generate a ORCPT DSN arg if not already provided */ "_FFR_GEN_ORCPT", #endif /* _FFR_GEN_ORCPT */ -#if _FFR_LOG_GREET_PAUSE - /* log time for greet_pause delay; from Nik Clayton */ - "_FFR_LOG_GREET_PAUSE", -#endif /* _FFR_LOG_GREET_PAUSE */ #if _FFR_GROUPREADABLEAUTHINFOFILE /* Allow group readable DefaultAuthInfo file. */ "_FFR_GROUPREADABLEAUTHINFOFILE", @@ -6219,22 +6159,10 @@ char *FFRCompileOptions[] = /* Randall S. Winchester of the University of Maryland */ "_FFR_MAX_FORWARD_ENTRIES", #endif /* _FFR_MAX_FORWARD_ENTRIES */ -#if _FFR_MAXKEY - /* increase key size for LDAP lookups, see conf.h */ - "_FFR_MAXKEY", -#endif /* _FFR_MAXKEY */ -#if _FFR_MAXNOOPCOMMANDS - /* runtime option for "MaxNOOPCommands" */ - "_FFR_MAXNOOPCOMMANDS", -#endif /* _FFR_MAXNOOPCOMMANDS */ #if _FFR_MAX_SLEEP_TIME /* Limit sleep(2) time in libsm/clock.c */ "_FFR_MAX_SLEEP_TIME", #endif /* _FFR_MAX_SLEEP_TIME */ -#if _FFR_MEMSTAT - /* Check free memory */ - "_FFR_MEMSTAT", -#endif /* _FFR_MEMSTAT */ #if _FFR_MILTER_NAGLE /* milter: turn off Nagle ("cork" on Linux) */ /* John Gardiner Myers of Proofpoint */ @@ -6249,10 +6177,6 @@ char *FFRCompileOptions[] = /* Old mime7to8 code, the new is broken for at least one example. */ "_FFR_MIME7TO8_OLD", #endif /* _FFR_MAX_SLEEP_TIME */ -#if _FFR_MSG_ACCEPT - /* allow to override "Message accepted for delivery" */ - "_FFR_MSG_ACCEPT", -#endif /* _FFR_MSG_ACCEPT */ #if _FFR_NODELAYDSN_ON_HOLD /* Do not issue a DELAY DSN for mailers that use the hold flag. */ /* Steven Pitzl */ @@ -6268,9 +6192,9 @@ char *FFRCompileOptions[] = #endif /* _FFR_LOG_NTRIES */ #if _FFR_PRIV_NOACTUALRECIPIENT /* - ** PrivacyOptions=noactualrecipient stops sendmail from putting - ** X-Actual-Recipient lines in DSNs revealing the actual - ** account that addresses map to. Patch from Dan Harkless. + ** PrivacyOptions=noactualrecipient stops sendmail from putting + ** X-Actual-Recipient lines in DSNs revealing the actual + ** account that addresses map to. Patch from Dan Harkless. */ "_FFR_PRIV_NOACTUALRECIPIENT", @@ -6289,7 +6213,7 @@ char *FFRCompileOptions[] = "_FFR_QUEUE_MACRO", #endif /* _FFR_QUEUE_MACRO */ #if _FFR_QUEUE_RUN_PARANOIA - /* Additional checks when doing queue runs; interval of checks */ + /* Additional checks when doing queue runs. */ "_FFR_QUEUE_RUN_PARANOIA", #endif /* _FFR_QUEUE_RUN_PARANOIA */ #if _FFR_QUEUE_SCHED_DBG @@ -6321,25 +6245,6 @@ char *FFRCompileOptions[] = /* Donated code (unused). */ "_FFR_SHM_STATUS", #endif /* _FFR_SHM_STATUS */ -#if _FFR_LDAP_SINGLEDN - /* - ** The LDAP database map code in Sendmail 8.12.10, when - ** given the -1 switch, would match only a single DN, - ** but was able to return multiple attributes for that - ** DN. In Sendmail 8.13 this "bug" was corrected to - ** only return if exactly one attribute matched. - ** - ** Unfortunately, our configuration uses the former - ** behaviour. Attached is a relatively simple patch - ** to 8.13.4 which adds a -2 switch (for lack of a - ** better option) which returns the single dn/multiple - ** attributes. - ** - ** Jeffrey T. Eaton, Carnegie-Mellon University - */ - - "_FFR_LDAP_SINGLEDN", -#endif /* _FFR_LDAP_SINGLEDN */ #if _FFR_SKIP_DOMAINS /* process every N'th domain instead of every N'th message */ "_FFR_SKIP_DOMAINS", diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h index 5e85015..77577c4 100644 --- a/contrib/sendmail/src/conf.h +++ b/contrib/sendmail/src/conf.h @@ -10,7 +10,7 @@ * the sendmail distribution. * * - * $Id: conf.h,v 8.570 2005/12/09 18:37:27 ca Exp $ + * $Id: conf.h,v 8.567 2004/07/23 20:45:01 gshapiro Exp $ */ /* @@ -59,40 +59,31 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ ** If you do, be careful, none should be set anywhere near INT_MAX **********************************************************************/ -#define MAXLINE 2048 /* max line length */ -#define MAXNAME 256 /* max length of a name */ +#define MAXLINE 2048 /* max line length */ +#define MAXNAME 256 /* max length of a name */ #ifndef MAXAUTHINFO -# define MAXAUTHINFO 100 /* max length of authinfo token */ +# define MAXAUTHINFO 100 /* max length of authinfo token */ #endif /* ! MAXAUTHINFO */ -#define MAXPV 256 /* max # of parms to mailers */ -#define MAXATOM 1000 /* max atoms per address */ -#define MAXRWSETS 200 /* max # of sets of rewriting rules */ -#define MAXPRIORITIES 25 /* max values for Precedence: field */ -#define MAXMXHOSTS 100 /* max # of MX records for one host */ -#define SMTPLINELIM 990 /* max SMTP line length */ -#define MAXUDBKEY 128 /* max size of a database key (udb only) */ -#if _FFR_MAXKEY -# define MAXKEY 1024 /* max size of a database key */ -#else /* _FFR_MAXKEY */ -# define MAXKEY (MAXNAME + 1) /* max size of a database key */ -#endif /* _FFR_MAXKEY */ -#define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */ -#define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */ -#define MAXMAPSTACK 12 /* max # of stacked or sequenced maps */ +#define MAXPV 256 /* max # of parms to mailers */ +#define MAXATOM 1000 /* max atoms per address */ +#define MAXRWSETS 200 /* max # of sets of rewriting rules */ +#define MAXPRIORITIES 25 /* max values for Precedence: field */ +#define MAXMXHOSTS 100 /* max # of MX records for one host */ +#define SMTPLINELIM 990 /* maximum SMTP line length */ +#define MAXKEY 128 /* maximum size of a database key */ +#define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */ +#define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */ +#define MAXMAPSTACK 12 /* max # of stacked or sequenced maps */ #if MILTER -# define MAXFILTERS 25 /* max # of milter filters */ -# define MAXFILTERMACROS 50 /* max # of macros per milter cmd */ +# define MAXFILTERS 25 /* max # of milter filters */ +# define MAXFILTERMACROS 50 /* max # of macros per milter cmd */ #endif /* MILTER */ -#define MAXSMTPARGS 20 /* max # of ESMTP args for MAIL/RCPT */ -#define MAXTOCLASS 8 /* max # of message timeout classes */ -#define MAXRESTOTYPES 3 /* max # of resolver timeout types */ -#define MAXMIMEARGS 20 /* max args in Content-Type: */ -#define MAXMIMENESTING 20 /* max MIME multipart nesting */ -#define QUEUESEGSIZE 1000 /* increment for queue size */ - -#ifndef MAXNOOPCOMMANDS -# define MAXNOOPCOMMANDS 20 /* max "noise" commands before slowdown */ -#endif /* ! MAXNOOPCOMMANDS */ +#define MAXSMTPARGS 20 /* max # of ESMTP args for MAIL/RCPT */ +#define MAXTOCLASS 8 /* max # of message timeout classes */ +#define MAXRESTOTYPES 3 /* max # of resolver timeout types */ +#define MAXMIMEARGS 20 /* max args in Content-Type: */ +#define MAXMIMENESTING 20 /* max MIME multipart nesting */ +#define QUEUESEGSIZE 1000 /* increment for queue size */ /* ** MAXQFNAME == 2 (size of "qf", "df" prefix) diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index 96d6e55..ec0d376 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2004, 2006 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -9,16 +9,17 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #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.287 2004/12/03 18:29:51 ca Exp $") static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *)); static size_t fix_mime_header __P((HDR *, ENVELOPE *)); static int priencode __P((char *)); -static bool put_vanilla_header __P((HDR *, char *, MCI *)); +static void put_vanilla_header __P((HDR *, char *, MCI *)); /* ** SETUPHEADERS -- initialize headers in symbol table @@ -993,6 +994,7 @@ logsender(e, msgid) char *name; register char *sbp; register char *p; + int l; char hbuf[MAXNAME + 1]; char sbuf[MAXLINE + 1]; char mbuf[MAXNAME + 1]; @@ -1001,8 +1003,6 @@ logsender(e, msgid) /* XXX do we still need this? sm_syslog() replaces control chars */ if (msgid != NULL) { - size_t l; - l = strlen(msgid); if (l > sizeof mbuf - 1) l = sizeof mbuf - 1; @@ -1542,13 +1542,13 @@ crackaddr(addr, e) ** flags -- MIME conversion flags. ** ** Returns: -** success +** none. ** ** Side Effects: ** none. */ -bool +void putheader(mci, hdr, e, flags) register MCI *mci; HDR *hdr; @@ -1683,8 +1683,7 @@ putheader(mci, hdr, e, flags) { if (tTd(34, 11)) sm_dprintf("\n"); - if (!put_vanilla_header(h, p, mci)) - goto writeerr; + put_vanilla_header(h, p, mci); continue; } @@ -1743,8 +1742,7 @@ putheader(mci, hdr, e, flags) /* no other recipient headers: truncate value */ (void) sm_strlcpyn(obuf, sizeof obuf, 2, h->h_field, ":"); - if (!putline(obuf, mci)) - goto writeerr; + putline(obuf, mci); } continue; } @@ -1763,8 +1761,7 @@ putheader(mci, hdr, e, flags) } else { - if (!put_vanilla_header(h, p, mci)) - goto writeerr; + put_vanilla_header(h, p, mci); } } @@ -1781,25 +1778,18 @@ putheader(mci, hdr, e, flags) !bitset(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME, mci->mci_flags) && hvalue("MIME-Version", e->e_header) == NULL) { - if (!putline("MIME-Version: 1.0", mci)) - goto writeerr; + putline("MIME-Version: 1.0", mci); if (hvalue("Content-Type", e->e_header) == NULL) { (void) sm_snprintf(obuf, sizeof obuf, "Content-Type: text/plain; charset=%s", defcharset(e)); - if (!putline(obuf, mci)) - goto writeerr; + putline(obuf, mci); } - if (hvalue("Content-Transfer-Encoding", e->e_header) == NULL - && !putline("Content-Transfer-Encoding: 8bit", mci)) - goto writeerr; + if (hvalue("Content-Transfer-Encoding", e->e_header) == NULL) + putline("Content-Transfer-Encoding: 8bit", mci); } #endif /* MIME8TO7 */ - return true; - - writeerr: - return false; } /* ** PUT_VANILLA_HEADER -- output a fairly ordinary header @@ -1810,10 +1800,10 @@ putheader(mci, hdr, e, flags) ** mci -- the connection info for output ** ** Returns: -** success +** none. */ -static bool +static void put_vanilla_header(h, v, mci) HDR *h; char *v; @@ -1844,8 +1834,7 @@ put_vanilla_header(h, v, mci) l = SPACELEFT(obuf, obp) - 1; (void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v); - if (!putxline(obuf, strlen(obuf), mci, putflags)) - goto writeerr; + putxline(obuf, strlen(obuf), mci, putflags); v += l + 1; obp = obuf; if (*v != ' ' && *v != '\t') @@ -1855,10 +1844,7 @@ put_vanilla_header(h, v, mci) /* XXX This is broken for SPACELEFT()==0 */ (void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.*s", (int) (SPACELEFT(obuf, obp) - 1), v); - return putxline(obuf, strlen(obuf), mci, putflags); - - writeerr: - return false; + putxline(obuf, strlen(obuf), mci, putflags); } /* ** COMMAIZE -- output a header field, making a comma-translated list. @@ -1871,13 +1857,13 @@ put_vanilla_header(h, v, mci) ** e -- the envelope containing the message. ** ** Returns: -** success +** none. ** ** Side Effects: ** outputs "p" to file "fp". */ -bool +void commaize(h, p, oldstyle, mci, e) register HDR *h; register char *p; @@ -2016,6 +2002,13 @@ commaize(h, p, oldstyle, mci, e) } name = denlstring(name, false, true); + /* + ** record data progress so DNS timeouts + ** don't cause DATA timeouts + */ + + DataProgress = true; + /* output the name with nice formatting */ opos += strlen(name); if (!firstone) @@ -2023,8 +2016,7 @@ commaize(h, p, oldstyle, mci, e) if (opos > omax && !firstone) { (void) sm_strlcpy(obp, ",\n", SPACELEFT(obuf, obp)); - if (!putxline(obuf, strlen(obuf), mci, putflags)) - goto writeerr; + putxline(obuf, strlen(obuf), mci, putflags); obp = obuf; (void) sm_strlcpy(obp, " ", sizeof obuf); opos = strlen(obp); @@ -2046,12 +2038,8 @@ commaize(h, p, oldstyle, mci, e) *obp = '\0'; else obuf[sizeof obuf - 1] = '\0'; - return putxline(obuf, strlen(obuf), mci, putflags); - - writeerr: - return false; + putxline(obuf, strlen(obuf), mci, putflags); } - /* ** COPYHEADER -- copy header list ** diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c index be4a455..d3cbce6 100644 --- a/contrib/sendmail/src/mci.c +++ b/contrib/sendmail/src/mci.c @@ -9,11 +9,12 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #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.214 2005/02/04 22:01:45 ca Exp $") #if NETINET || NETINET6 # include <arpa/inet.h> @@ -47,9 +48,11 @@ static int mci_read_persistent __P((SM_FILE_T *, MCI *)); ** MciCacheTimeout is the time (in seconds) that a connection ** is permitted to survive without activity. ** -** We actually try any cached connections by sending a RSET -** before we use them; if the RSET fails we close down the -** connection and reopen it (see smtpprobe()). +** We actually try any cached connections by sending a NOOP +** before we use them; if the NOOP fails we close down the +** connection and reopen it. Note that this means that a +** server SMTP that doesn't support NOOP will hose the +** algorithm -- but that doesn't seem too likely. ** ** The persistent MCI code is donated by Mark Lovell and Paul ** Vixie. It is based on the long term host status code in KJS @@ -1124,9 +1127,6 @@ mci_traverse_persistent(action, pathname) char *newptr; struct dirent *e; char newpath[MAXPATHLEN]; -#if MAXPATHLEN <= MAXNAMLEN - 3 - ERROR "MAXPATHLEN <= MAXNAMLEN - 3" -#endif /* MAXPATHLEN <= MAXNAMLEN - 3 */ if ((d = opendir(pathname)) == NULL) { diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c index 75231da..857d81f 100644 --- a/contrib/sendmail/src/savemail.c +++ b/contrib/sendmail/src/savemail.c @@ -13,9 +13,9 @@ #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.304 2004/10/06 21:36:06 ca Exp $") -static bool errbody __P((MCI *, ENVELOPE *, char *)); +static void errbody __P((MCI *, ENVELOPE *, char *)); static bool pruneroute __P((char *)); /* @@ -432,13 +432,12 @@ savemail(e, sendbody) p = macvalue('g', e); macdefine(&e->e_macro, A_PERM, 'g', e->e_sender); - if (!putfromline(&mcibuf, e) || - !(*e->e_puthdr)(&mcibuf, e->e_header, e, - M87F_OUTER) || - !(*e->e_putbody)(&mcibuf, e, NULL) || - !putline("\n", &mcibuf) || - sm_io_flush(fp, SM_TIME_DEFAULT) == SM_IO_EOF || - sm_io_error(fp) || + putfromline(&mcibuf, e); + (*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER); + (*e->e_putbody)(&mcibuf, e, NULL); + putline("\n", &mcibuf); /* XXX EOL from FileMailer? */ + (void) sm_io_flush(fp, SM_TIME_DEFAULT); + if (sm_io_error(fp) || sm_io_close(fp, SM_TIME_DEFAULT) < 0) state = ESM_PANIC; else @@ -733,14 +732,14 @@ returntosender(msg, returnq, flags, e) ** separator -- any possible MIME separator (unused). ** ** Returns: -** success +** none ** ** Side Effects: ** Outputs the body of an error message. */ /* ARGSUSED2 */ -static bool +static void errbody(mci, e, separator) register MCI *mci; register ENVELOPE *e; @@ -758,16 +757,14 @@ errbody(mci, e, separator) if (bitset(MCIF_INHEADER, mci->mci_flags)) { - if (!putline("", mci)) - goto writeerr; + putline("", mci); mci->mci_flags &= ~MCIF_INHEADER; } if (e->e_parent == NULL) { syserr("errbody: null parent"); - if (!putline(" ----- Original message lost -----\n", mci)) - goto writeerr; - return true; + putline(" ----- Original message lost -----\n", mci); + return; } /* @@ -776,12 +773,11 @@ errbody(mci, e, separator) if (e->e_msgboundary != NULL) { + putline("This is a MIME-encapsulated message", mci); + putline("", mci); (void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); - if (!putline("This is a MIME-encapsulated message", mci) || - !putline("", mci) || - !putline(buf, mci) || - !putline("", mci)) - goto writeerr; + putline(buf, mci); + putline("", mci); } /* @@ -803,36 +799,31 @@ errbody(mci, e, separator) if (!pm_notify && q == NULL && !bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags)) { - if (!putline(" **********************************************", - mci) || - !putline(" ** THIS IS A WARNING MESSAGE ONLY **", - mci) || - !putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **", - mci) || - !putline(" **********************************************", - mci) || - !putline("", mci)) - goto writeerr; + putline(" **********************************************", + mci); + putline(" ** THIS IS A WARNING MESSAGE ONLY **", + mci); + putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **", + mci); + putline(" **********************************************", + mci); + putline("", mci); } (void) sm_snprintf(buf, sizeof buf, "The original message was received at %s", arpadate(ctime(&e->e_parent->e_ctime))); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); expand("from \201_", buf, sizeof buf, e->e_parent); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); /* include id in postmaster copies */ if (pm_notify && e->e_parent->e_id != NULL) { (void) sm_strlcpyn(buf, sizeof buf, 2, "with id ", e->e_parent->e_id); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } - if (!putline("", mci)) - goto writeerr; + putline("", mci); /* ** Output error message header (if specified and available). @@ -858,19 +849,17 @@ errbody(mci, e, separator) { translate_dollars(buf); expand(buf, buf, sizeof buf, e); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } (void) sm_io_close(xfile, SM_TIME_DEFAULT); - if (!putline("\n", mci)) - goto writeerr; + putline("\n", mci); } } else { expand(ErrMsgFile, buf, sizeof buf, e); - if (!putline(buf, mci) || !putline("", mci)) - goto writeerr; + putline(buf, mci); + putline("", mci); } } @@ -888,24 +877,21 @@ errbody(mci, e, separator) if (printheader) { - if (!putline(" ----- The following addresses had permanent fatal errors -----", - mci)) - goto writeerr; + putline(" ----- The following addresses had permanent fatal errors -----", + mci); printheader = false; } (void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), sizeof buf); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); if (q->q_rstatus != NULL) { (void) sm_snprintf(buf, sizeof buf, " (reason: %s)", shortenstring(exitstat(q->q_rstatus), MAXSHORTSTR)); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } if (q->q_alias != NULL) { @@ -913,12 +899,11 @@ errbody(mci, e, separator) " (expanded from: %s)", shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } } - if (!printheader && !putline("", mci)) - goto writeerr; + if (!printheader) + putline("", mci); /* transient non-fatal errors */ printheader = true; @@ -932,28 +917,25 @@ errbody(mci, e, separator) if (printheader) { - if (!putline(" ----- The following addresses had transient non-fatal errors -----", - mci)) - goto writeerr; + putline(" ----- The following addresses had transient non-fatal errors -----", + mci); printheader = false; } (void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), sizeof buf); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); if (q->q_alias != NULL) { (void) sm_snprintf(buf, sizeof buf, " (expanded from: %s)", shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } } - if (!printheader && !putline("", mci)) - goto writeerr; + if (!printheader) + putline("", mci); /* successful delivery notifications */ printheader = true; @@ -986,28 +968,25 @@ errbody(mci, e, separator) if (printheader) { - if (!putline(" ----- The following addresses had successful delivery notifications -----", - mci)) - goto writeerr; + putline(" ----- The following addresses had successful delivery notifications -----", + mci); printheader = false; } (void) sm_snprintf(buf, sizeof buf, "%s (%s)", shortenstring(q->q_paddr, MAXSHORTSTR), p); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); if (q->q_alias != NULL) { (void) sm_snprintf(buf, sizeof buf, " (expanded from: %s)", shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } } - if (!printheader && !putline("", mci)) - goto writeerr; + if (!printheader) + putline("", mci); /* ** Output transcript of errors @@ -1016,9 +995,8 @@ errbody(mci, e, separator) (void) sm_io_flush(smioout, SM_TIME_DEFAULT); if (e->e_parent->e_xfp == NULL) { - if (!putline(" ----- Transcript of session is unavailable -----\n", - mci)) - goto writeerr; + putline(" ----- Transcript of session is unavailable -----\n", + mci); } else { @@ -1029,12 +1007,11 @@ errbody(mci, e, separator) while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf, sizeof buf) != NULL) { - if (printheader && !putline(" ----- Transcript of session follows -----\n", - mci)) - goto writeerr; + if (printheader) + putline(" ----- Transcript of session follows -----\n", + mci); printheader = false; - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } } errno = 0; @@ -1046,12 +1023,11 @@ errbody(mci, e, separator) if (e->e_msgboundary != NULL) { + putline("", mci); (void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); - if (!putline("", mci) || - !putline(buf, mci) || - !putline("Content-Type: message/delivery-status", mci) || - !putline("", mci)) - goto writeerr; + putline(buf, mci); + putline("Content-Type: message/delivery-status", mci); + putline("", mci); /* ** Output per-message information. @@ -1063,15 +1039,13 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "Original-Envelope-Id: %.800s", xuntextify(e->e_parent->e_envid)); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* Reporting-MTA: is us (required) */ (void) sm_snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s", MyHostName); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); /* DSN-Gateway: not relevant since we are not translating */ @@ -1085,15 +1059,13 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "Received-From-MTA: %s; %.800s", p, RealHostName); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* Arrival-Date: -- when it arrived here */ (void) sm_strlcpyn(buf, sizeof buf, 2, "Arrival-Date: ", arpadate(ctime(&e->e_parent->e_ctime))); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); /* Deliver-By-Date: -- when it should have been delivered */ if (IS_DLVR_BY(e->e_parent)) @@ -1104,8 +1076,7 @@ errbody(mci, e, separator) (void) sm_strlcpyn(buf, sizeof buf, 2, "Deliver-By-Date: ", arpadate(ctime(&dbyd))); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* @@ -1148,8 +1119,7 @@ errbody(mci, e, separator) else continue; - if (!putline("", mci)) - goto writeerr; + putline("", mci); /* Original-Recipient: -- passed from on high */ if (q->q_orcpt != NULL) @@ -1157,8 +1127,7 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "Original-Recipient: %.800s", q->q_orcpt); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* Figure out actual recipient */ @@ -1207,8 +1176,7 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "Final-Recipient: %s", q->q_finalrcpt); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* X-Actual-Recipient: -- the real problem address */ @@ -1222,15 +1190,13 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "X-Actual-Recipient: %s", actual); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* Action: -- what happened? */ (void) sm_strlcpyn(buf, sizeof buf, 2, "Action: ", action); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); /* Status: -- what _really_ happened? */ if (q->q_status != NULL) @@ -1242,8 +1208,7 @@ errbody(mci, e, separator) else p = "2.0.0"; (void) sm_strlcpyn(buf, sizeof buf, 2, "Status: ", p); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); /* Remote-MTA: -- who was I talking to? */ if (q->q_statmta != NULL) @@ -1257,8 +1222,7 @@ errbody(mci, e, separator) p = &buf[strlen(buf) - 1]; if (*p == '.') *p = '\0'; - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* Diagnostic-Code: -- actual result from other end */ @@ -1270,8 +1234,7 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "Diagnostic-Code: %s; %.800s", p, q->q_rstatus); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } /* Last-Attempt-Date: -- fine granularity */ @@ -1280,8 +1243,7 @@ errbody(mci, e, separator) (void) sm_strlcpyn(buf, sizeof buf, 2, "Last-Attempt-Date: ", arpadate(ctime(&q->q_statdate))); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); /* Will-Retry-Until: -- for delayed messages only */ if (QS_IS_QUEUEUP(q->q_state)) @@ -1293,8 +1255,7 @@ errbody(mci, e, separator) (void) sm_strlcpyn(buf, sizeof buf, 2, "Will-Retry-Until: ", arpadate(ctime(&xdate))); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } } } @@ -1304,8 +1265,7 @@ errbody(mci, e, separator) ** Output text of original message */ - if (!putline("", mci)) - goto writeerr; + putline("", mci); if (bitset(EF_HAS_DF, e->e_parent->e_flags)) { sendbody = !bitset(EF_NO_BODY_RETN, e->e_parent->e_flags) && @@ -1313,27 +1273,21 @@ errbody(mci, e, separator) if (e->e_msgboundary == NULL) { - if (!putline( - sendbody - ? " ----- Original message follows -----\n" - : " ----- Message header follows -----\n", - mci)) - { - goto writeerr; - } + if (sendbody) + putline(" ----- Original message follows -----\n", mci); + else + putline(" ----- Message header follows -----\n", mci); } else { (void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); (void) sm_strlcpyn(buf, sizeof buf, 2, "Content-Type: ", sendbody ? "message/rfc822" : "text/rfc822-headers"); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); p = hvalue("Content-Transfer-Encoding", e->e_parent->e_header); @@ -1347,62 +1301,43 @@ errbody(mci, e, separator) (void) sm_snprintf(buf, sizeof buf, "Content-Transfer-Encoding: %s", p); - if (!putline(buf, mci)) - goto writeerr; + putline(buf, mci); } } - if (!putline("", mci)) - goto writeerr; + putline("", mci); save_errno = errno; - if (!putheader(mci, e->e_parent->e_header, e->e_parent, - M87F_OUTER)) - goto writeerr; + putheader(mci, e->e_parent->e_header, e->e_parent, M87F_OUTER); errno = save_errno; if (sendbody) - { - if (!putbody(mci, e->e_parent, e->e_msgboundary)) - goto writeerr; - } + putbody(mci, e->e_parent, e->e_msgboundary); else if (e->e_msgboundary == NULL) { - if (!putline("", mci) || - !putline(" ----- Message body suppressed -----", - mci)) - { - goto writeerr; - } + putline("", mci); + putline(" ----- Message body suppressed -----", mci); } } else if (e->e_msgboundary == NULL) { - if (!putline(" ----- No message was collected -----\n", mci)) - goto writeerr; + putline(" ----- No message was collected -----\n", mci); } if (e->e_msgboundary != NULL) { + putline("", mci); (void) sm_strlcpyn(buf, sizeof buf, 3, "--", e->e_msgboundary, "--"); - if (!putline("", mci) || !putline(buf, mci)) - goto writeerr; + putline(buf, mci); } - if (!putline("", mci) || - sm_io_flush(mci->mci_out, SM_TIME_DEFAULT) == SM_IO_EOF) - goto writeerr; + putline("", mci); + (void) sm_io_flush(mci->mci_out, SM_TIME_DEFAULT); /* ** Cleanup and exit */ if (errno != 0) - { - writeerr: syserr("errbody: I/O error"); - return false; - } - return true; } - /* ** SMTPTODSN -- convert SMTP to DSN status code ** @@ -1467,9 +1402,9 @@ smtptodsn(smtpstat) return "5.0.0"; } - if (REPLYTYPE(smtpstat) == 2) + if ((smtpstat / 100) == 2) return "2.0.0"; - if (REPLYTYPE(smtpstat) == 4) + if ((smtpstat / 100) == 4) return "4.0.0"; return "5.0.0"; } diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8 index 2d0284a..65d37b0 100644 --- a/contrib/sendmail/src/sendmail.8 +++ b/contrib/sendmail/src/sendmail.8 @@ -724,13 +724,13 @@ collected statistics /var/spool/mqueue/* temp files .SH SEE ALSO -binmail(1), mail(1), -rmail(1), syslog(3), aliases(5), mailaddr(7), -rc(8) +mail.local(8), +rc(8), +rmail(8) .PP DARPA Internet Request For Comments @@ -746,3 +746,4 @@ The .B sendmail command appeared in 4.2BSD. +.\" $FreeBSD$ |