From 3c5a1e863a66866807948f160122c79d2dd388f5 Mon Sep 17 00:00:00 2001 From: gshapiro Date: Sat, 29 Mar 2003 19:12:53 +0000 Subject: Import sendmail 8.12.9 --- contrib/sendmail/src/README | 7 ++- contrib/sendmail/src/collect.c | 7 ++- contrib/sendmail/src/conf.c | 128 ++++++++++++++++++++++++++++++++++++-- contrib/sendmail/src/deliver.c | 17 ++++- contrib/sendmail/src/headers.c | 8 ++- contrib/sendmail/src/main.c | 11 +++- contrib/sendmail/src/milter.c | 38 ++++++----- contrib/sendmail/src/parseaddr.c | 17 ++++- contrib/sendmail/src/queue.c | 12 ++-- contrib/sendmail/src/readcf.c | 28 ++++++++- contrib/sendmail/src/sendmail.h | 5 +- contrib/sendmail/src/sm_resolve.c | 21 ++++--- contrib/sendmail/src/srvrsmtp.c | 4 +- contrib/sendmail/src/tls.c | 2 +- contrib/sendmail/src/usersmtp.c | 16 ++--- contrib/sendmail/src/version.c | 4 +- 16 files changed, 263 insertions(+), 62 deletions(-) (limited to 'contrib/sendmail/src') diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README index ba9d126..7686b6c 100644 --- a/contrib/sendmail/src/README +++ b/contrib/sendmail/src/README @@ -9,7 +9,7 @@ # the sendmail distribution. # # -# $Id: README,v 8.355.2.13 2003/01/15 19:17:15 ca Exp $ +# $Id: README,v 8.355.2.14 2003/03/27 21:39:29 ca Exp $ # This directory contains the source files for sendmail(TM). @@ -478,6 +478,9 @@ USE_ENVIRON Set this to 1 to access process environment variables from parameter of main(). USE_DOUBLE_FORK By default this is on (1). Set it to 0 to suppress the extra fork() used to avoid intermediate zombies. +ALLOW_255 Do not convert (char)0xff to (char)0x7f in headers etc. + This can also be done at runtime with the command line + option -d82.101. +-----------------------+ @@ -1794,4 +1797,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.13 $, last update $Date: 2003/01/15 19:17:15 $ ) +(Version $Revision: 8.355.2.14 $, last update $Date: 2003/03/27 21:39:29 $ ) diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c index 6ebd049..0e50ca0 100644 --- a/contrib/sendmail/src/collect.c +++ b/contrib/sendmail/src/collect.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: collect.c,v 8.242.2.3 2002/12/03 17:06:30 gshapiro Exp $") +SM_RCSID("@(#)$Id: collect.c,v 8.242.2.4 2003/03/28 17:34:39 ca Exp $") static void collecttimeout __P((time_t)); static void dferror __P((SM_FILE_T *volatile, char *, ENVELOPE *)); @@ -444,6 +444,7 @@ collect(fp, smtpmode, hdrp, e) OpMode != MD_ARPAFTP)) { + SM_ASSERT(pbp < peekbuf + sizeof(peekbuf)); *pbp++ = c; c = '.'; } @@ -455,11 +456,14 @@ collect(fp, smtpmode, hdrp, e) else { /* push back the ".\rx" */ + SM_ASSERT(pbp < peekbuf + sizeof(peekbuf)); *pbp++ = c; if (OpMode != MD_SMTP && OpMode != MD_DAEMON && OpMode != MD_ARPAFTP) { + SM_ASSERT(pbp < peekbuf + + sizeof(peekbuf)); *pbp++ = '\r'; c = '.'; } @@ -625,6 +629,7 @@ nextstate: } /* trim off trailing CRLF or NL */ + SM_ASSERT(bp > buf); if (*--bp != '\n' || *--bp != '\r') bp++; *bp = '\0'; diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index 29e8a21..be083b4 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: conf.c,v 8.972.2.27 2003/01/15 19:17:14 ca Exp $") +SM_RCSID("@(#)$Id: conf.c,v 8.972.2.35 2003/03/28 05:46:09 ca Exp $") #include @@ -329,6 +329,8 @@ setdefaults(e) DontProbeInterfaces = DPI_PROBEALL; DoubleBounceAddr = "postmaster"; MaxHeadersLength = MAXHDRSLEN; + MaxMimeHeaderLength = MAXLINE; + MaxMimeFieldLength = MaxMimeHeaderLength / 2; MaxForwardEntries = 0; FastSplit = 1; #if SASL @@ -3081,7 +3083,7 @@ static char *DefaultUserShells[] = "/bin/pam", "/usr/bin/keysh", /* key shell (extended Korn shell) */ "/bin/posix/sh", - "/sbin/sh" + "/sbin/sh", # endif /* V4FS */ # endif /* __hpux */ # if defined(_AIX3) || defined(_AIX4) @@ -5881,202 +5883,318 @@ char *OsCompileOptions[] = char *FFRCompileOptions[] = { #if _FFR_ADAPTIVE_EOL + /* tries to be smart about \r\n versus \n from broken clients */ + /* known to be broken, do not use */ "_FFR_ADAPTIVE_EOL", #endif /* _FFR_ADAPTIVE_EOL */ #if _FFR_ALLOW_SASLINFO + /* DefaultAuthInfo can be specified by user. */ + /* DefaultAuthInfo doesn't really work in 8.12 anymore. */ "_FFR_ALLOW_SASLINFO", #endif /* _FFR_ALLOW_SASLINFO */ #if _FFR_ALLOW_S0_ERROR_4XX + /* Allow for tempfail from S0 (ruleset 0). */ "_FFR_ALLOW_S0_ERROR_4XX", #endif /* _FFR_ALLOW_S0_ERROR_4XX */ #if _FFR_BESTMX_BETTER_TRUNCATION + /* Better truncation of list of MX records for dns map. */ "_FFR_BESTMX_BETTER_TRUNCATION", #endif /* _FFR_BESTMX_BETTER_TRUNCATION */ +#if _FFR_BLOCK_PROXIES + /* + ** Try to deal with open HTTP proxies that are used to send spam + ** by recognizing some commands from them. + */ + + "_FFR_BLOCK_PROXIES", +#endif /* _FFR_BLOCK_PROXIES */ #if _FFR_CACHE_LPC + /* Cache connections to LCP based mailers */ /* Christophe Wolfhugel of France Telecom Oleane */ "_FFR_CACHE_LPC", #endif /* _FFR_CACHE_LPC */ #if _FFR_CATCH_BROKEN_MTAS + /* Deal with MTAs that send a reply during the DATA phase. */ "_FFR_CATCH_BROKEN_MTAS", #endif /* _FFR_CATCH_BROKEN_MTAS */ #if _FFR_CATCH_LONG_STRINGS + /* Report long address strings instead of silently ignoring them. */ "_FFR_CATCH_LONG_STRINGS", #endif /* _FFR_CATCH_LONG_STRINGS */ #if _FFR_CHECK_EOM + /* Enable check_eom ruleset */ "_FFR_CHECK_EOM", #endif /* _FFR_CHECK_EOM */ #if _FFR_CHK_QUEUE + /* Stricter checks about queue directory permissions. */ "_FFR_CHK_QUEUE", #endif /* _FFR_CHK_QUEUE */ #if _FFR_CONTROL_MSTAT + /* Extended daemon status. */ "_FFR_CONTROL_MSTAT", #endif /* _FFR_CONTROL_MSTAT */ #if _FFR_DAEMON_NETUNIX + /* Allow local (not just TCP) socket connection to server. */ "_FFR_DAEMON_NETUNIX", #endif /* _FFR_DAEMON_NETUNIX */ #if _FFR_DEAL_WITH_ERROR_SSL + /* Deal with SSL errors by recognizing them as EOF. */ "_FFR_DEAL_WITH_ERROR_SSL", #endif /* _FFR_DEAL_WITH_ERROR_SSL */ #if _FFR_DEPRECATE_MAILER_FLAG_I + /* What it says :-) */ "_FFR_DEPRECATE_MAILER_FLAG_I", #endif /* _FFR_DEPRECATE_MAILER_FLAG_I */ #if _FFR_DIGUNIX_SAFECHOWN + /* Properly set SAFECHOWN (include/sm/conf.h) for Digital UNIX */ /* Problem noted by Anne Bennett of Concordia University */ "_FFR_DIGUNIX_SAFECHOWN", #endif /* _FFR_DIGUNIX_SAFECHOWN */ #if _FFR_DNSMAP_ALIASABLE + /* Allow dns map type to be used for aliases. */ /* Don Lewis of TDK */ "_FFR_DNSMAP_ALIASABLE", #endif /* _FFR_DNSMAP_ALIASABLE */ #if _FFR_DNSMAP_BASE + /* Specify a "base" domain for DNS lookups. */ "_FFR_DNSMAP_BASE", #endif /* _FFR_DNSMAP_BASE */ #if _FFR_DNSMAP_MULTI + /* Allow multiple return values for DNS map. */ "_FFR_DNSMAP_MULTI", # if _FFR_DNSMAP_MULTILIMIT + /* Limit number of return values for DNS map. */ "_FFR_DNSMAP_MULTILIMIT", # endif /* _FFR_DNSMAP_MULTILIMIT */ #endif /* _FFR_DNSMAP_MULTI */ #if _FFR_DONTLOCKFILESFORREAD_OPTION + /* Enable DontLockFilesForRead option. */ "_FFR_DONTLOCKFILESFORREAD_OPTION", #endif /* _FFR_DONTLOCKFILESFORREAD_OPTION */ -# if _FFR_DONT_STOP_LOOKING +#if _FFR_DONT_STOP_LOOKING + /* Continue with DNS lookups on ECONNREFUSED and TRY_AGAIN. */ /* Noted by Neil Rickert of Northern Illinois University */ "_FFR_DONT_STOP_LOOKING", -# endif /* _FFR_DONT_STOP_LOOKING */ +#endif /* _FFR_DONT_STOP_LOOKING */ #if _FFR_DOTTED_USERNAMES + /* Allow usernames with '.' */ "_FFR_DOTTED_USERNAMES", #endif /* _FFR_DOTTED_USERNAMES */ #if _FFR_DROP_TRUSTUSER_WARNING + /* + ** Don't issue this warning: + ** "readcf: option TrustedUser may cause problems on systems + ** which do not support fchown() if UseMSP is not set. + */ + "_FFR_DROP_TRUSTUSER_WARNING", #endif /* _FFR_DROP_TRUSTUSER_WARNING */ #if _FFR_FIX_DASHT + /* + ** If using -t, force not sending to argv recipients, even + ** if they are mentioned in the headers. + */ + "_FFR_FIX_DASHT", #endif /* _FFR_FIX_DASHT */ #if _FFR_FORWARD_SYSERR + /* Cause a "syserr" if forward file isn't "safe". */ "_FFR_FORWARD_SYSERR", #endif /* _FFR_FORWARD_SYSERR */ #if _FFR_GEN_ORCPT + /* Generate a ORCPT DSN arg if not already provided */ "_FFR_GEN_ORCPT", #endif /* _FFR_GEN_ORCPT */ #if _FFR_GROUPREADABLEAUTHINFOFILE + /* Allow group readable DefaultAuthInfo file. */ "_FFR_GROUPREADABLEAUTHINFOFILE", #endif /* _FFR_GROUPREADABLEAUTHINFOFILE */ #if _FFR_HANDLE_ISO8859_GECOS + /* + ** Allow ISO 8859 characters in GECOS field: replace them + ** ith ASCII "equivalent". + */ + /* Peter Eriksson of Linkopings universitet */ "_FFR_HANDLE_ISO8859_GECOS", #endif /* _FFR_HANDLE_ISO8859_GECOS */ #if _FFR_HDR_TYPE + /* Set 'h' in {addr_type} for headers. */ "_FFR_HDR_TYPE", #endif /* _FFR_HDR_TYPE */ #if _FFR_HPUX_NSSWITCH + /* Use nsswitch on HP-UX */ "_FFR_HPUX_NSSWITCH", #endif /* _FFR_HPUX_NSSWITCH */ #if _FFR_IGNORE_EXT_ON_HELO + /* Ignore extensions offered in response to HELO */ "_FFR_IGNORE_EXT_ON_HELO", #endif /* _FFR_IGNORE_EXT_ON_HELO */ #if _FFR_LDAP_RECURSION + /* Support LDAP recursion in LDAP responses */ /* Andrew Baucom */ "_FFR_LDAP_RECURSION", #endif /* _FFR_LDAP_RECURSION */ #if _FFR_LDAP_SETVERSION + /* New LDAP map option for setting LDAP protocol version */ "_FFR_LDAP_SETVERSION", #endif /* _FFR_LDAP_SETVERSION */ #if _FFR_LDAP_URI + /* Support LDAP URI form of specifying host/port (and allows ldaps) */ "_FFR_LDAP_URI", #endif /* _FFR_LDAP_URI */ #if _FFR_MAX_FORWARD_ENTRIES + /* Try to limit number of .forward entries */ + /* (doesn't work) */ /* Randall S. Winchester of the University of Maryland */ "_FFR_MAX_FORWARD_ENTRIES", #endif /* _FFR_MAX_FORWARD_ENTRIES */ #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_PERDAEMON + /* Per DaemonPortOptions InputMailFilter lists */ "_FFR_MILTER_PERDAEMON", # endif /* _FFR_MILTER_PERDAEMON */ #endif /* MILTER */ #if _FFR_NODELAYDSN_ON_HOLD + /* Do not issue a DELAY DSN for mailers that use the hold flag. */ /* Steven Pitzl */ "_FFR_NODELAYDSN_ON_HOLD", #endif /* _FFR_NODELAYDSN_ON_HOLD */ #if _FFR_NO_PIPE + /* Disable PIPELINING, delay client if used. */ "_FFR_NO_PIPE", #endif /* _FFR_NO_PIPE */ #if _FFR_QUARANTINE + /* Quarantine items in the queue */ "_FFR_QUARANTINE", #endif /* _FFR_QUARANTINE */ #if _FFR_QUEUEDELAY + /* Exponential queue delay; disabled in 8.13 since it isn't used. */ "_FFR_QUEUEDELAY", #endif /* _FFR_QUEUEDELAY */ #if _FFR_QUEUE_GROUP_SORTORDER + /* Allow QueueSortOrder per queue group. */ /* XXX: Still need to actually use qgrp->qg_sortorder */ "_FFR_QUEUE_GROUP_SORTORDER", #endif /* _FFR_QUEUE_GROUP_SORTORDER */ #if _FFR_QUEUE_MACRO + /* Define {queue} macro. */ "_FFR_QUEUE_MACRO", #endif /* _FFR_QUEUE_MACRO */ +#if _FFR_QUEUERETURN_DSN + /* + ** Provide an option for different Timeout.queue{warn,return} for + ** DSN messages. These days, queues are filled with bounces for + ** spam that will never make it to the sender and therefore slow + ** down queue runs until they timeout. + */ + + "_FFR_QUEUERETURN_DSN", +#endif /* _FFR_QUEUERETURN_DSN */ #if _FFR_QUEUE_RUN_PARANOIA + /* Additional checks when doing queue runs. */ "_FFR_QUEUE_RUN_PARANOIA", #endif /* _FFR_QUEUE_RUN_PARANOIA */ #if _FFR_QUEUE_SCHED_DBG + /* Debug output for the queue scheduler. */ "_FFR_QUEUE_SCHED_DBG", #endif /* _FFR_QUEUE_SCHED_DBG */ #if _FFR_REDIRECTEMPTY + /* + ** envelope <> can't be sent to mailing lists, only owner- + ** send spam of this type to owner- of the list + ** ---- to stop spam from going to mailing lists. + */ + "_FFR_REDIRECTEMPTY", #endif /* _FFR_REDIRECTEMPTY */ #if _FFR_REJECT_LOG + /* Log when we start/stop rejecting connections due to load, etc */ "_FFR_REJECT_LOG", #endif /* _FFR_REJECT_LOG */ #if _FFR_REQ_DIR_FSYNC_OPT + /* Add cf option to fsync() directories */ "_FFR_REQ_DIR_FSYNC_OPT", #endif /* _FFR_REQ_DIR_FSYNC_OPT */ #if _FFR_RESET_MACRO_GLOBALS + /* Allow macro 'j' to be set dynamically via rulesets. */ "_FFR_RESET_MACRO_GLOBALS", #endif /* _FFR_RESET_MACRO_GLOBALS */ #if _FFR_RESPOND_ALL - /* in vacation */ + /* in vacation: respond to every message, not just once per interval */ "_FFR_RESPOND_ALL", #endif /* _FFR_RESPOND_ALL */ #if _FFR_RHS + /* Random shuffle for queue sorting. */ "_FFR_RHS", #endif /* _FFR_RHS */ #if _FFR_SASL_OPT_M + /* Support SASL's SASL_SEC_MUTUAL_AUTH option */ "_FFR_SASL_OPT_M", #endif /* _FFR_SASL_OPT_M */ #if _FFR_SELECT_SHM + /* Auto-select of shared memory key */ "_FFR_SELECT_SHM", #endif /* _FFR_SELECT_SHM */ #if _FFR_SHM_STATUS + /* Donated code (unused). */ "_FFR_SHM_STATUS", #endif /* _FFR_SHM_STATUS */ #if _FFR_SMFI_OPENSOCKET + /* libmilter: smfi_opensocket() to force the socket open early */ "_FFR_SMFI_OPENSOCKET", #endif /* _FFR_SMFI_OPENSOCKET */ #if _FFR_SMTP_SSL + /* Support for smtps (SMTP over SSL) */ "_FFR_SMTP_SSL", #endif /* _FFR_SMTP_SSL */ #if _FFR_SOFT_BOUNCE + /* Turn all errors into temporary errors. */ "_FFR_SOFT_BOUNCE", #endif /* _FFR_SOFT_BOUNCE */ #if _FFR_SPT_ALIGN + /* + ** It looks like the Compaq Tru64 5.1A now aligns argv and envp to 64 + ** bit alignment, so unless each piece of argv and envp is a multiple + ** of 8 bytes (including terminating NULL), initsetproctitle() won't + ** use any of the space beyond argv[0]. Be sure to set SPT_ALIGN_SIZE + ** if you use this FFR. + */ + /* Chris Adams of HiWAAY Informations Services */ "_FFR_SPT_ALIGN", #endif /* _FFR_SPT_ALIGN */ #if _FFR_STRIPBACKSL + /* + ** Strip backslash from addresses (so sender doesn't + ** decide to ignore forward) + */ + "_FFR_STRIPBACKSL", #endif /* _FFR_STRIPBACKSL */ #if _FFR_TIMERS + /* Donated code (unused). */ "_FFR_TIMERS", #endif /* _FFR_TIMERS */ #if _FFR_TLS_1 + /* More STARTTLS options, e.g., secondary certs. */ "_FFR_TLS_1", #endif /* _FFR_TLS_1 */ #if _FFR_TRUSTED_QF + /* + ** If we don't own the file mark it as unsafe. + ** However, allow TrustedUser to own it as well + ** in case TrustedUser manipulates the queue. + */ + "_FFR_TRUSTED_QF", #endif /* _FFR_TRUSTED_QF */ #if _FFR_USE_SETLOGIN + /* Use setlogin() */ /* Peter Philipp */ "_FFR_USE_SETLOGIN", #endif /* _FFR_USE_SETLOGIN */ diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c index 2cb6e3f..af6e41f 100644 --- a/contrib/sendmail/src/deliver.c +++ b/contrib/sendmail/src/deliver.c @@ -14,7 +14,7 @@ #include #include -SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.15 2003/02/07 17:57:43 ca Exp $") +SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.18 2003/03/28 17:34:39 ca Exp $") #if HASSETUSERCONTEXT # include @@ -1158,7 +1158,7 @@ coloncmp(a, b) /* Need to account for IPv6 bracketed addresses */ if (*a == '[') braclev++; - else if (*a == '[' && braclev > 0) + else if (*a == ']' && braclev > 0) braclev--; else if (*a == ':' && braclev <= 0) { @@ -1626,7 +1626,7 @@ deliver(e, firstto) } #if _FFR_STRIPBACKSL /* - ** Strip one leading backslash if requesting and the + ** Strip one leading backslash if requested and the ** next character is alphanumerical (the latter can ** probably relaxed a bit, see RFC2821). */ @@ -4719,7 +4719,11 @@ putbody(mci, e, separator) { pos += bp - buf; if (c != '\r') + { + SM_ASSERT(pbp < peekbuf + + sizeof(peekbuf)); *pbp++ = c; + } } bp = buf; @@ -4759,6 +4763,7 @@ putbody(mci, e, separator) } /* had a naked carriage return */ + SM_ASSERT(pbp < peekbuf + sizeof(peekbuf)); *pbp++ = c; c = '\r'; ostate = OS_INLINE; @@ -4787,7 +4792,11 @@ putch: else if ((d = sm_io_getc(e->e_dfp, SM_TIME_DEFAULT)) != SM_IO_EOF) + { + SM_ASSERT(pbp < peekbuf + + sizeof(peekbuf)); *pbp++ = d; + } if (d == '\n' || d == SM_IO_EOF) { @@ -4837,6 +4846,8 @@ putch: mci->mci_mailer->m_eol); } ostate = OS_HEAD; + SM_ASSERT(pbp < peekbuf + + sizeof(peekbuf)); *pbp++ = c; continue; } diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index d9966b1..890c280 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: headers.c,v 8.266.4.4 2003/01/18 00:41:48 gshapiro Exp $") +SM_RCSID("@(#)$Id: headers.c,v 8.266.4.5 2003/03/12 22:42:52 gshapiro Exp $") static size_t fix_mime_header __P((HDR *, ENVELOPE *)); static int priencode __P((char *)); @@ -771,6 +771,12 @@ eatheader(e, full, log) e->e_timeoutclass = TOC_NONURGENT; } +#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)) + e->e_timeoutclass = TOC_DSN; +#endif /* _FFR_QUEUERETURN_DSN */ + /* date message originated */ p = hvalue("posted-date", e->e_header); if (p == NULL) diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c index e79d923..dbe9ce5 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.20 2003/02/07 17:57:44 ca Exp $") +SM_RCSID("@(#)$Id: main.c,v 8.887.2.22 2003/03/06 18:38:08 ca Exp $") #if NETINET || NETINET6 @@ -128,6 +128,7 @@ int SyslogPrefixLen; /* estimated length of syslog prefix */ { \ if (extraprivs && \ OpMode != MD_DELIVER && OpMode != MD_SMTP && \ + OpMode != MD_ARPAFTP && \ OpMode != MD_VERIFY && OpMode != MD_TEST) \ { \ (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, \ @@ -392,6 +393,7 @@ main(argc, argv, envp) # endif /* ! OPTIONS */ #endif /* _FFR_QUARANTINE */ + /* Set to 0 to allow -b; need to check optarg before using it! */ opterr = 0; while ((j = getopt(argc, argv, OPTIONS)) != -1) { @@ -442,6 +444,13 @@ main(argc, argv, envp) break; case 'L': + if (optarg == NULL) + { + (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, + "option requires an argument -- '%c'", + (char) j); + return EX_USAGE; + } j = SM_MIN(strlen(optarg), 24) + 1; sysloglabel = xalloc(j); (void) sm_strlcpy(sysloglabel, optarg, j); diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c index 305c304..077578b 100644 --- a/contrib/sendmail/src/milter.c +++ b/contrib/sendmail/src/milter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2003 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: milter.c,v 8.197.2.6 2002/12/30 05:54:00 ca Exp $") +SM_RCSID("@(#)$Id: milter.c,v 8.197.2.7 2003/03/22 18:54:25 ca Exp $") #if MILTER # include @@ -46,8 +46,18 @@ static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1]; } # if _FFR_QUARANTINE -# define MILTER_CHECK_ERROR(action) \ - if (tTd(71, 101)) \ +# define MILTER_CHECK_ERROR(initial, action) \ + if (!initial && tTd(71, 100)) \ + { \ + if (e->e_quarmsg == NULL) \ + { \ + e->e_quarmsg = sm_rpool_strdup_x(e->e_rpool, \ + "filter failure"); \ + macdefine(&e->e_macro, A_PERM, macid("{quarantine}"), \ + e->e_quarmsg); \ + } \ + } \ + else if (tTd(71, 101)) \ { \ if (e->e_quarmsg == NULL) \ { \ @@ -64,7 +74,7 @@ static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1]; else \ action; # else /* _FFR_QUARANTINE */ -# define MILTER_CHECK_ERROR(action) \ +# define MILTER_CHECK_ERROR(initial, action) \ if (bitnset(SMF_TEMPFAIL, m->mf_flags)) \ *state = SMFIR_TEMPFAIL; \ else if (bitnset(SMF_REJECT, m->mf_flags)) \ @@ -1915,7 +1925,7 @@ milter_send_command(m, command, data, sz, e, state) m->mf_timeout[SMFTO_WRITE], e); if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(return NULL); + MILTER_CHECK_ERROR(false, return NULL); return NULL; } @@ -1924,7 +1934,7 @@ milter_send_command(m, command, data, sz, e, state) m->mf_timeout[SMFTO_READ], e); if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(return NULL); + MILTER_CHECK_ERROR(false, return NULL); return NULL; } @@ -2043,7 +2053,7 @@ milter_command(command, data, sz, macros, e, state) /* previous problem? */ if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(continue); + MILTER_CHECK_ERROR(false, continue); break; } @@ -2058,7 +2068,7 @@ milter_command(command, data, sz, macros, e, state) milter_send_macros(m, macros, command, e); if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(continue); + MILTER_CHECK_ERROR(false, continue); break; } } @@ -3062,7 +3072,7 @@ milter_init(e, state) m->mf_sock = milter_open(m, false, e); if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(continue); + MILTER_CHECK_ERROR(true, continue); break; } @@ -3084,7 +3094,7 @@ milter_init(e, state) /* if negotation failure, close socket */ milter_error(m, e); - MILTER_CHECK_ERROR(continue); + MILTER_CHECK_ERROR(true, continue); } if (MilterLogLevel > 9) sm_syslog(LOG_INFO, e->e_id, @@ -3541,7 +3551,7 @@ milter_data(e, state) /* previous problem? */ if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(continue); + MILTER_CHECK_ERROR(false, continue); break; } @@ -3602,7 +3612,7 @@ milter_data(e, state) "milter_data(%s): EOM ACK/NAK timeout", m->mf_name); milter_error(m, e); - MILTER_CHECK_ERROR(break); + MILTER_CHECK_ERROR(false, break); break; } @@ -3790,7 +3800,7 @@ milter_data(e, state) if (m->mf_state == SMFS_ERROR) { - MILTER_CHECK_ERROR(continue); + MILTER_CHECK_ERROR(false, continue); goto finishup; } } diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c index 296d01c..6acc86d 100644 --- a/contrib/sendmail/src/parseaddr.c +++ b/contrib/sendmail/src/parseaddr.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.4 2003/01/18 00:41:48 gshapiro Exp $") +SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.6 2003/03/27 02:39:53 ca Exp $") static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *)); static int callsubr __P((char**, int, ENVELOPE *)); @@ -608,7 +608,7 @@ unsigned char TokTypeNoC[256] = }; -#define NOCHAR -1 /* signal nothing in lookahead token */ +#define NOCHAR (-1) /* signal nothing in lookahead token */ char ** prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab) @@ -694,6 +694,7 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab) /* see if there is room */ if (q >= &pvpbuf[pvpbsize - 5]) { + addrtoolong: usrerr("553 5.1.1 Address too long"); if (strlen(addr) > MAXNAME) addr[MAXNAME] = '\0'; @@ -705,11 +706,15 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab) } /* squirrel it away */ +#if !ALLOW_255 + if ((char) c == (char) -1 && !tTd(82, 101)) + c &= 0x7f; +#endif /* !ALLOW_255 */ *q++ = c; } /* read a new input character */ - c = *p++; + c = (*p++) & 0x00ff; if (c == '\0') { /* diagnose and patch up bad syntax */ @@ -764,6 +769,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab) } else if (c != '!' || state == QST) { + /* see if there is room */ + if (q >= &pvpbuf[pvpbsize - 5]) + goto addrtoolong; *q++ = '\\'; continue; } @@ -849,6 +857,9 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab) /* new token */ if (tok != q) { + /* see if there is room */ + if (q >= &pvpbuf[pvpbsize - 5]) + goto addrtoolong; *q++ = '\0'; if (tTd(22, 36)) { diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c index 0d618ed..b488b5f 100644 --- a/contrib/sendmail/src/queue.c +++ b/contrib/sendmail/src/queue.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: queue.c,v 8.863.2.28 2003/02/11 17:17:22 ca Exp $") +SM_RCSID("@(#)$Id: queue.c,v 8.863.2.30 2003/03/20 00:20:16 ca Exp $") #include @@ -32,11 +32,11 @@ SM_RCSID("@(#)$Id: queue.c,v 8.863.2.28 2003/02/11 17:17:22 ca Exp $") #if _FFR_QUEUEDELAY # define QF_VERSION 7 /* version number of this queue format */ static time_t queuedelay __P((ENVELOPE *)); -#define queuedelay_qfver_unsupported(qfver) false +# define queuedelay_qfver_unsupported(qfver) false #else /* _FFR_QUEUEDELAY */ # define QF_VERSION 6 /* version number of this queue format */ # define queuedelay(e) MinQueueAge -#define queuedelay_qfver_unsupported(qfver) ((qfver) == 5 || (qfver) == 7) +# define queuedelay_qfver_unsupported(qfver) ((qfver) == 5 || (qfver) == 7) #endif /* _FFR_QUEUEDELAY */ #if _FFR_QUARANTINE static char queue_letter __P((ENVELOPE *, int)); @@ -219,7 +219,7 @@ int *PRSATmpCnt; /* offset for queue_shm */ # define OFF_QUEUE_SHM(p) (((char *) (p)) + SHM_OFF_HEAD + sizeof(FileSys) + sizeof(int) * 2) -#define QSHM_ENTRIES(i) QShm[i].qs_entries +# define QSHM_ENTRIES(i) QShm[i].qs_entries /* basic size of shared memory segment */ # define SM_T_SIZE (SHM_OFF_HEAD + sizeof(FileSys) + sizeof(int) * 2) @@ -3316,8 +3316,8 @@ strrev(fwd) #if _FFR_RHS -#define NASCII 128 -#define NCHAR 256 +# define NASCII 128 +# define NCHAR 256 static unsigned char ShuffledAlphabet[NCHAR]; diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c index b527265..f3e72ad 100644 --- a/contrib/sendmail/src/readcf.c +++ b/contrib/sendmail/src/readcf.c @@ -13,7 +13,7 @@ #include -SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.7 2002/11/10 19:13:11 ca Exp $") +SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.8 2003/03/12 22:42:52 gshapiro Exp $") #if NETINET || NETINET6 # include @@ -3976,6 +3976,12 @@ static struct timeoutinfo { "starttls", TO_STARTTLS }, #define TO_ACONNECT 0x23 { "aconnect", TO_ACONNECT }, +#if _FFR_QUEUERETURN_DSN +# define TO_QUEUEWARN_DSN 0x24 + { "queuewarn.dsn", TO_QUEUEWARN_DSN }, +# define TO_QUEUERETURN_DSN 0x25 + { "queuereturn.dsn", TO_QUEUERETURN_DSN }, +#endif /* _FFR_QUEUERETURN_DSN */ { NULL, 0 }, }; @@ -4094,6 +4100,9 @@ settimeout(name, val, sticky) TimeOuts.to_q_warning[TOC_NORMAL] = toval; TimeOuts.to_q_warning[TOC_URGENT] = toval; TimeOuts.to_q_warning[TOC_NONURGENT] = toval; +#if _FFR_QUEUERETURN_DSN + TimeOuts.to_q_warning[TOC_DSN] = toval; +#endif /* _FFR_QUEUERETURN_DSN */ addopts = 2; break; @@ -4112,11 +4121,21 @@ settimeout(name, val, sticky) TimeOuts.to_q_warning[TOC_NONURGENT] = toval; break; +#if _FFR_QUEUERETURN_DSN + case TO_QUEUEWARN_DSN: + toval = convtime(val, 'h'); + TimeOuts.to_q_warning[TOC_DSN] = toval; + break; +#endif /* _FFR_QUEUERETURN_DSN */ + case TO_QUEUERETURN: toval = convtime(val, 'd'); TimeOuts.to_q_return[TOC_NORMAL] = toval; TimeOuts.to_q_return[TOC_URGENT] = toval; TimeOuts.to_q_return[TOC_NONURGENT] = toval; +#if _FFR_QUEUERETURN_DSN + TimeOuts.to_q_return[TOC_DSN] = toval; +#endif /* _FFR_QUEUERETURN_DSN */ addopts = 2; break; @@ -4135,6 +4154,13 @@ settimeout(name, val, sticky) TimeOuts.to_q_return[TOC_NONURGENT] = toval; break; +#if _FFR_QUEUERETURN_DSN + case TO_QUEUERETURN_DSN: + toval = convtime(val, 'd'); + TimeOuts.to_q_return[TOC_DSN] = toval; + break; +#endif /* _FFR_QUEUERETURN_DSN */ + case TO_HOSTSTATUS: MciInfoTimeout = toval; break; diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h index 2bfad15..1092398 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.16 2003/01/18 00:41:50 gshapiro Exp $"; +SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.17 2003/03/12 22:42:52 gshapiro Exp $"; # endif /* ! lint */ #endif /* _DEFINE */ @@ -2021,6 +2021,9 @@ EXTERN struct #define TOC_NORMAL 0 /* normal delivery */ #define TOC_URGENT 1 /* urgent delivery */ #define TOC_NONURGENT 2 /* non-urgent delivery */ +#if _FFR_QUEUERETURN_DSN +# define TOC_DSN 3 /* DSN delivery */ +#endif /* _FFR_QUEUERETURN_DSN */ /* resolver timeout specifiers */ #define RES_TO_FIRST 0 /* first attempt */ diff --git a/contrib/sendmail/src/sm_resolve.c b/contrib/sendmail/src/sm_resolve.c index a6f5862..8828fd1 100644 --- a/contrib/sendmail/src/sm_resolve.c +++ b/contrib/sendmail/src/sm_resolve.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers. + * Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -46,7 +46,7 @@ # if NAMED_BIND # include "sm_resolve.h" -SM_RCSID("$Id: sm_resolve.c,v 8.24.4.6 2002/06/25 04:22:41 ca Exp $") +SM_RCSID("$Id: sm_resolve.c,v 8.24.4.7 2003/03/22 22:55:37 ca Exp $") static struct stot { @@ -172,10 +172,10 @@ parse_dns_reply(data, len) DNS_REPLY_T *r; RESOURCE_RECORD_T **rr; - r = (DNS_REPLY_T *) xalloc(sizeof(*r)); - memset(r, 0, sizeof(*r)); + r = (DNS_REPLY_T *) sm_malloc(sizeof(*r)); if (r == NULL) return NULL; + memset(r, 0, sizeof(*r)); p = data; @@ -227,12 +227,13 @@ parse_dns_reply(data, len) dns_free_data(r); return NULL; } - *rr = (RESOURCE_RECORD_T *) xalloc(sizeof(**rr)); + *rr = (RESOURCE_RECORD_T *) sm_malloc(sizeof(**rr)); if (*rr == NULL) { dns_free_data(r); return NULL; } + memset(*rr, 0, sizeof(**rr)); (*rr)->rr_domain = sm_strdup(host); if ((*rr)->rr_domain == NULL) { @@ -274,7 +275,7 @@ parse_dns_reply(data, len) } l = strlen(host) + 1; (*rr)->rr_u.rr_mx = (MX_RECORD_T *) - xalloc(sizeof(*((*rr)->rr_u.rr_mx)) + l); + sm_malloc(sizeof(*((*rr)->rr_u.rr_mx)) + l); if ((*rr)->rr_u.rr_mx == NULL) { dns_free_data(r); @@ -295,7 +296,7 @@ parse_dns_reply(data, len) } l = strlen(host) + 1; (*rr)->rr_u.rr_srv = (SRV_RECORDT_T*) - xalloc(sizeof(*((*rr)->rr_u.rr_srv)) + l); + sm_malloc(sizeof(*((*rr)->rr_u.rr_srv)) + l); if ((*rr)->rr_u.rr_srv == NULL) { dns_free_data(r); @@ -330,7 +331,7 @@ parse_dns_reply(data, len) dns_free_data(r); return NULL; } - (*rr)->rr_u.rr_txt = (char *) xalloc(txtlen + 1); + (*rr)->rr_u.rr_txt = (char *) sm_malloc(txtlen + 1); if ((*rr)->rr_u.rr_txt == NULL) { dns_free_data(r); @@ -341,8 +342,8 @@ parse_dns_reply(data, len) break; default: - (*rr)->rr_u.rr_data = (unsigned char*) xalloc(size); - if (size != 0 && (*rr)->rr_u.rr_data == NULL) + (*rr)->rr_u.rr_data = (unsigned char*) sm_malloc(size); + if ((*rr)->rr_u.rr_data == NULL) { dns_free_data(r); return NULL; diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c index 2be4d65..a7f03dd 100644 --- a/contrib/sendmail/src/srvrsmtp.c +++ b/contrib/sendmail/src/srvrsmtp.c @@ -16,7 +16,7 @@ # include #endif /* MILTER */ -SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.21 2003/01/15 19:17:14 ca Exp $") +SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.22 2003/02/19 02:45:40 ca Exp $") #if SASL || STARTTLS # include @@ -517,8 +517,6 @@ smtp(nullserver, d_flags, e) } hostname = macvalue('j', e); - - #if SASL sasl_ok = bitset(SRV_OFFER_AUTH, features); n_mechs = 0; diff --git a/contrib/sendmail/src/tls.c b/contrib/sendmail/src/tls.c index 10a6fe2..a74c691 100644 --- a/contrib/sendmail/src/tls.c +++ b/contrib/sendmail/src/tls.c @@ -10,7 +10,7 @@ #include -SM_RCSID("@(#)$Id: tls.c,v 8.79.4.2 2003/01/23 23:16:24 ca Exp $") +SM_RCSID("@(#)$Id: tls.c,v 8.79.4.4 2003/03/20 00:03:42 ca Exp $") #if STARTTLS # include diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c index 3a7d54f..59a23e9 100644 --- a/contrib/sendmail/src/usersmtp.c +++ b/contrib/sendmail/src/usersmtp.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 -SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.8 2002/12/12 17:40:07 ca Exp $") +SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.9 2003/03/15 23:57:52 gshapiro Exp $") #include @@ -2823,6 +2823,7 @@ smtpgetstat(m, mci, e) ENVELOPE *e; { int r; + int off; int status, xstat; char *enhsc; @@ -2844,13 +2845,12 @@ smtpgetstat(m, mci, e) else status = EX_PROTOCOL; if (bitset(MCIF_ENHSTAT, mci->mci_flags) && - (r = isenhsc(SmtpReplyBuffer + 4, ' ')) > 0) - r += 5; + (off = isenhsc(SmtpReplyBuffer + 4, ' ')) > 0) + off += 5; else - r = 4; - e->e_statmsg = sm_rpool_strdup_x(e->e_rpool, &SmtpReplyBuffer[r]); - mci_setstat(mci, xstat, ENHSCN(enhsc, smtptodsn(r)), - SmtpReplyBuffer); + off = 4; + e->e_statmsg = sm_rpool_strdup_x(e->e_rpool, &SmtpReplyBuffer[off]); + mci_setstat(mci, xstat, ENHSCN(enhsc, smtptodsn(r)), SmtpReplyBuffer); if (LogLevel > 1 && status == EX_PROTOCOL) { sm_syslog(LOG_CRIT, e->e_id, diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c index d8a2983..da877d7 100644 --- a/contrib/sendmail/src/version.c +++ b/contrib/sendmail/src/version.c @@ -13,6 +13,6 @@ #include -SM_RCSID("@(#)$Id: version.c,v 8.104.2.14 2003/01/15 17:55:43 ca Exp $") +SM_RCSID("@(#)$Id: version.c,v 8.104.2.15 2003/03/19 21:19:53 ca Exp $") -char Version[] = "8.12.8"; +char Version[] = "8.12.9"; -- cgit v1.1