diff options
author | peter <peter@FreeBSD.org> | 1999-01-12 12:38:06 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-01-12 12:38:06 +0000 |
commit | 5b758ef6d89ac3abe22adbdc3386c76d72691136 (patch) | |
tree | 6c4f3826ab567145a7eba959bc71c7eab01748b1 /contrib/sendmail/src | |
parent | 6788eff0e6370de72568309d3a8b1891341b0991 (diff) | |
download | FreeBSD-src-5b758ef6d89ac3abe22adbdc3386c76d72691136.zip FreeBSD-src-5b758ef6d89ac3abe22adbdc3386c76d72691136.tar.gz |
Merge sendmail 8.9.1 -> 8.9.2 changes into mainline. Some of our changes
were submitted back to sendmail.org (stage 1) and were incorporated.
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r-- | contrib/sendmail/src/aliases.5 | 2 | ||||
-rw-r--r-- | contrib/sendmail/src/conf.c | 265 | ||||
-rw-r--r-- | contrib/sendmail/src/conf.h | 90 | ||||
-rw-r--r-- | contrib/sendmail/src/err.c | 2 | ||||
-rw-r--r-- | contrib/sendmail/src/headers.c | 125 | ||||
-rw-r--r-- | contrib/sendmail/src/mailq.1 | 2 | ||||
-rw-r--r-- | contrib/sendmail/src/mci.c | 12 | ||||
-rw-r--r-- | contrib/sendmail/src/savemail.c | 5 | ||||
-rw-r--r-- | contrib/sendmail/src/sendmail.8 | 7 |
9 files changed, 422 insertions, 88 deletions
diff --git a/contrib/sendmail/src/aliases.5 b/contrib/sendmail/src/aliases.5 index 3fa4d6e..513bf49 100644 --- a/contrib/sendmail/src/aliases.5 +++ b/contrib/sendmail/src/aliases.5 @@ -8,7 +8,7 @@ .\" the sendmail distribution. .\" .\" -.\" @(#)aliases.5 8.8 (Berkeley) 5/19/98 +.\" @(#)aliases.5 8.8 (Berkeley) 5/19/1998 .\" .Dd May 19, 1998 .Dt ALIASES 5 diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index 538ade4..82e7543 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)conf.c 8.431 (Berkeley) 6/25/98"; +static char sccsid[] = "@(#)conf.c 8.450 (Berkeley) 12/17/1998"; #endif /* not lint */ # include "sendmail.h" @@ -217,7 +217,6 @@ setdefaults(e) int i; struct passwd *pw; char buf[MAXNAME]; - extern void inittimeouts __P((char *)); extern void setdefuser __P((void)); extern void setupmaps __P((void)); extern void setupmailers __P((void)); @@ -247,7 +246,7 @@ setdefaults(e) DefGid = 1; /* option g */ setdefuser(); } - TrustedFileUid = 0; + TrustedUid = 0; if (tTd(37, 4)) printf("setdefaults: DefUser=%s, DefUid=%d, DefGid=%d\n", DefUser != NULL ? DefUser : "<1:1>", @@ -292,6 +291,7 @@ setdefaults(e) #ifdef HESIOD_INIT HesiodContext = NULL; #endif + ControlSocketName = NULL; setupmaps(); setupmailers(); setupheaders(); @@ -324,7 +324,6 @@ void setupmailers() { char buf[100]; - extern void makemailer __P((char *)); strcpy(buf, "prog, P=/bin/sh, F=lsoDq9, T=DNS/RFC822/X-Unix, A=sh -c \201u"); makemailer(buf); @@ -838,6 +837,14 @@ switch_map_find(service, maptype, mapreturn) *p++ = '\0'; if (buf[0] == '\0') continue; + if (p == NULL) + { + sm_syslog(LOG_ERR, NOQID, + "Bad line on %.100s: %.100s", + ServiceSwitchFile, + buf); + continue; + } while (isspace(*p)) p++; if (*p == '\0') @@ -1280,10 +1287,10 @@ init_md(argc, argv) #endif #ifdef __QNX__ /* - ** Due to QNX's network distributed nature, you can target a tcpip - ** stack on a different node in the qnx network; this patch lets - ** this feature work. The __sock_locate() must be done before the - ** environment is clear. + ** Due to QNX's network distributed nature, you can target a tcpip + ** stack on a different node in the qnx network; this patch lets + ** this feature work. The __sock_locate() must be done before the + ** environment is clear. */ __sock_locate(); #endif @@ -2047,7 +2054,7 @@ refuseconnections(port) else if (conncnt++ > ConnRateThrottle && ConnRateThrottle > 0) { /* sleep to flatten out connection load */ - setproctitle("deferring connections on port %d: %d per second", + sm_setproctitle(TRUE, "deferring connections on port %d: %d per second", port, ConnRateThrottle); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2059,7 +2066,7 @@ refuseconnections(port) CurrentLA = getla(); if (CurrentLA >= refusela) { - setproctitle("rejecting connections on port %d: load average: %d", + sm_setproctitle(TRUE, "rejecting connections on port %d: load average: %d", port, CurrentLA); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2070,7 +2077,7 @@ refuseconnections(port) if (!enoughdiskspace(MinBlocksFree + 1)) { - setproctitle("rejecting connections on port %d: min free: %d", + sm_setproctitle(TRUE, "rejecting connections on port %d: min free: %d", port, MinBlocksFree); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2081,12 +2088,10 @@ refuseconnections(port) if (MaxChildren > 0 && CurChildren >= MaxChildren) { - extern void proc_list_probe __P((void)); - proc_list_probe(); if (CurChildren >= MaxChildren) { - setproctitle("rejecting connections on port %d: %d children, max %d", + sm_setproctitle(TRUE, "rejecting connections on port %d: %d children, max %d", port, CurChildren, MaxChildren); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2170,12 +2175,12 @@ typedef unsigned int *pt_entry_t; # define SPT_PADCHAR ' ' # endif +#endif /* SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN */ + # ifndef SPT_BUFSIZE # define SPT_BUFSIZE MAXLINE # endif -#endif /* SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN */ - /* ** Pointers for setproctitle. ** This allows "ps" listings to give more useful information. @@ -2320,6 +2325,44 @@ setproctitle(fmt, va_alist) #endif /* SPT_TYPE != SPT_BUILTIN */ /* +** SM_SETPROCTITLE -- set process task and set process title for ps +** +** Possibly set process status and call setproctitle() to +** change the ps display. +** +** Parameters: +** status -- whether or not to store as process status +** fmt -- a printf style format string. +** a, b, c -- possible parameters to fmt. +** +** Returns: +** none. +*/ + +/*VARARGS2*/ +void +# ifdef __STDC__ +sm_setproctitle(bool status, const char *fmt, ...) +# else +sm_setproctitle(status, fmt, va_alist) + bool status; + const char *fmt; + va_dcl +#endif +{ + char buf[SPT_BUFSIZE]; + + VA_LOCAL_DECL + /* print the argument string */ + VA_START(fmt); + (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); + VA_END; + + if (status) + proc_list_set(getpid(), buf); + setproctitle("%s", buf); +} +/* ** WAITFOR -- wait for a particular process id. ** ** Parameters: @@ -2789,8 +2832,8 @@ dgux_inet_addr(host) /* -** this version hacked to add `atend' flag to allow state machine -** to reset if invoked by the program to scan args for a 2nd time +** this version hacked to add `atend' flag to allow state machine +** to reset if invoked by the program to scan args for a 2nd time */ #if defined(LIBC_SCCS) && !defined(lint) @@ -2962,7 +3005,7 @@ char *DefaultUserShells[] = "/bin/bsh", /* Bourne shell */ "/usr/bin/bsh", #endif -#ifdef __svr4__ +#if defined(__svr4__) || defined(__svr5__) "/bin/ksh", /* Korn shell */ "/usr/bin/ksh", #endif @@ -3665,9 +3708,63 @@ setvendor(vendor) } #endif +#if defined(VENDOR_NAME) && defined(VENDOR_CODE) + if (strcasecmp(vendor, VENDOR_NAME) == 0) + { + VendorCode = VENDOR_CODE; + return TRUE; + } +#endif + return FALSE; } /* +** GETVENDOR -- return vendor name based on vendor code +** +** Parameters: +** vendorcode -- numeric representation of vendor. +** +** Returns: +** string containing vendor name. +*/ + +char * +getvendor(vendorcode) + int vendorcode; +{ +#if defined(VENDOR_NAME) && defined(VENDOR_CODE) + /* + ** Can't have the same switch case twice so need to + ** handle VENDOR_CODE outside of switch. It might + ** match one of the existing VENDOR_* codes. + */ + + if (vendorcode == VENDOR_CODE) + return VENDOR_NAME; +#endif + + switch (vendorcode) + { + case VENDOR_BERKELEY: + return "Berkeley"; + + case VENDOR_SUN: + return "Sun"; + + case VENDOR_HP: + return "HP"; + + case VENDOR_IBM: + return "IBM"; + + case VENDOR_SENDMAIL: + return "Sendmail"; + + default: + return "Unknown"; + } +} +/* ** VENDOR_PRE_DEFAULTS, VENDOR_POST_DEFAULTS -- set vendor-specific defaults ** ** Vendor_pre_defaults is called before reading the configuration @@ -3730,7 +3827,7 @@ vendor_daemon_setup(e) if (getluid() != -1) { usrerr("Daemon cannot have LUID"); - exit(EX_USAGE); + finis(FALSE, EX_USAGE); } #endif /* SECUREWARE */ } @@ -4173,11 +4270,88 @@ secureware_setup_secure(uid) rc, uid); break; } - exit(EX_NOPERM); + finis(FALSE, EX_NOPERM); } } #endif /* SECUREWARE */ /* +** ADD_LOCAL_HOST_NAMES -- Add a hostname to class 'w' based on IP address +** +** Add hostnames to class 'w' based on the IP address read from +** the network interface. +** +** Parameters: +** sa -- a pointer to a SOCKADDR containing the address +** +** Returns: +** 0 if successful, -1 if host lookup fails. +*/ + +int +add_hostnames(sa) + SOCKADDR *sa; +{ + struct hostent *hp; + + /* lookup name with IP address */ + switch (sa->sa.sa_family) + { + case AF_INET: + hp = sm_gethostbyaddr((char *) &sa->sin.sin_addr, + sizeof(sa->sin.sin_addr), sa->sa.sa_family); + break; + + default: +#if _FFR_LOG_UNSUPPORTED_FAMILIES + /* XXX: Give warning about unsupported family */ + if (LogLevel > 3) + sm_syslog(LOG_WARNING, NOQID, + "Unsupported address family %d: %.100s", + sa->sa.sa_family, anynet_ntoa(sa)); +#endif + return -1; + } + + if (hp == NULL) + { + int save_errno = errno; + + if (LogLevel > 3) + sm_syslog(LOG_WARNING, NOQID, + "gethostbyaddr(%.100s) failed: %d\n", + anynet_ntoa(sa), +#if NAMED_BIND + h_errno +#else + -1 +#endif + ); + errno = save_errno; + return -1; + } + + /* save its cname */ + if (!wordinclass((char *) hp->h_name, 'w')) + { + setclass('w', (char *) hp->h_name); + if (tTd(0, 4)) + printf("\ta.k.a.: %s\n", hp->h_name); + } + + /* save all it aliases name */ + while (*hp->h_aliases) + { + if (!wordinclass(*hp->h_aliases, 'w')) + { + setclass('w', *hp->h_aliases); + if (tTd(0, 4)) + printf("\ta.k.a.: %s\n", *hp->h_aliases); + } + hp->h_aliases++; + } + return 0; +} +/* ** LOAD_IF_NAMES -- load interface-specific names into $=w ** ** Parameters: @@ -4254,9 +4428,8 @@ load_if_names() for (i = 0; i < ifc.ifc_len; ) { struct ifreq *ifr = (struct ifreq *) &ifc.ifc_buf[i]; - struct sockaddr *sa = &ifr->ifr_addr; + SOCKADDR *sa = (SOCKADDR *) &ifr->ifr_addr; struct in_addr ia; - struct hostent *hp; #ifdef SIOCGIFFLAGS struct ifreq ifrf; #endif @@ -4264,14 +4437,14 @@ load_if_names() extern char *inet_ntoa(); #ifdef BSD4_4_SOCKADDR - if (sa->sa_len > sizeof ifr->ifr_addr) - i += sizeof ifr->ifr_name + sa->sa_len; + if (sa->sa.sa_len > sizeof ifr->ifr_addr) + i += sizeof ifr->ifr_name + sa->sa.sa_len; else #endif i += sizeof *ifr; if (tTd(0, 20)) - printf("%s\n", anynet_ntoa((SOCKADDR *) sa)); + printf("%s\n", anynet_ntoa(sa)); if (ifr->ifr_addr.sa_family != AF_INET) continue; @@ -4290,7 +4463,7 @@ load_if_names() continue; /* extract IP address from the list*/ - ia = (((struct sockaddr_in *) sa)->sin_addr); + ia = sa->sin.sin_addr; if (ia.s_addr == INADDR_ANY || ia.s_addr == INADDR_NONE) { message("WARNING: interface %s is UP with %s address", @@ -4313,41 +4486,7 @@ load_if_names() if (bitset(IFF_LOOPBACK, IFRFREF.ifr_flags)) continue; - /* lookup name with IP address */ - hp = sm_gethostbyaddr((char *) &ia, sizeof(ia), AF_INET); - if (hp == NULL) - { - if (LogLevel > 3) - sm_syslog(LOG_WARNING, NOQID, - "gethostbyaddr(%.100s) failed: %d\n", - inet_ntoa(ia), -#if NAMED_BIND - h_errno); -#else - -1); -#endif - continue; - } - - /* save its cname */ - if (!wordinclass((char *) hp->h_name, 'w')) - { - setclass('w', (char *) hp->h_name); - if (tTd(0, 4)) - printf("\ta.k.a.: %s\n", hp->h_name); - } - - /* save all it aliases name */ - while (*hp->h_aliases) - { - if (!wordinclass(*hp->h_aliases, 'w')) - { - setclass('w', *hp->h_aliases); - if (tTd(0, 4)) - printf("\ta.k.a.: %s\n", *hp->h_aliases); - } - hp->h_aliases++; - } + (void) add_hostnames(sa); } free(ifc.ifc_buf); close(s); @@ -4412,7 +4551,7 @@ sm_syslog(level, id, fmt, va_alist) extern int SyslogErrno; extern char *DoprEnd; VA_LOCAL_DECL - extern void sm_dopr __P((char *, const char *, ...)); + extern void sm_dopr __P((char *, const char *, va_list)); SyslogErrno = errno; if (id == NULL) diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h index a8ad46e..b9cdc68 100644 --- a/contrib/sendmail/src/conf.h +++ b/contrib/sendmail/src/conf.h @@ -9,7 +9,7 @@ * the sendmail distribution. * * - * @(#)conf.h 8.372 (Berkeley) 6/4/98 + * @(#)conf.h 8.380 (Berkeley) 11/9/1998 */ /* @@ -64,6 +64,11 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # define MACBUFSIZE 4096 /* max expanded macro buffer size */ # define TOBUFSIZE 512 /* max buffer to hold address list */ # define MAXSHORTSTR 203 /* max short string length */ +# if _FFR_MAX_MIME_HEADER_LENGTH +# define MAXMACNAMELEN 25 /* max macro name length */ +# else +# define MAXMACNAMELEN 20 /* max macro name length */ +# endif /********************************************************************** ** Compilation options. @@ -344,12 +349,12 @@ typedef int pid_t; # define GIDSET_T gid_t # define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ # define SFS_BAVAIL f_bfree /* alternate field name */ +# define SYSLOG_BUFSIZE 512 # ifdef IRIX6 # define STAT64 1 # define QUAD_T unsigned long long # define LA_TYPE LA_IRIX6 /* figure out at run time */ # define SAFENFSPATHCONF 0 /* pathconf(2) lies on NFS filesystems */ -# define SYSLOG_BUFSIZE 512 # else # define LA_TYPE LA_INT @@ -674,6 +679,41 @@ typedef int pid_t; #endif +/* +** Apple Rhapsody +** Contributed by Wilfredo Sanchez <wsanchez@apple.com> +*/ + +#ifdef __APPLE__ +# define HASFCHMOD 1 /* has fchmod(2) syscall */ +# define HASFLOCK 1 /* has flock(2) syscall */ +# define HASUNAME 1 /* has uname(2) syscall */ +# define HASUNSETENV 1 +# define HASSETSID 1 /* has the setsid(2) POSIX syscall */ +# define HASINITGROUPS 1 +# define HASSETVBUF 1 +# define HASSETREUID 1 +# define USESETEUID 1 /* has useable seteuid(2) call */ +# define HASLSTAT 1 +# define HASSETRLIMIT 1 +# define HASWAITPID 1 +# define HASSTRERROR 1 /* has strerror(3) */ +# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */ +# define USESTRERROR 1 /* has strerror(3) */ +# define HASGETDTABLESIZE 1 +# define HASGETUSERSHELL 1 +# define NEEDGETOPT 1 /* need a replacement for getopt(3) */ +# define BSD4_4_SOCKADDR /* has sa_len */ +# define NETLINK 1 /* supports AF_LINK */ +# define HAS_ST_GEN 1 /* has st_gen field in stat struct */ +# define GIDSET_T gid_t +# define LA_TYPE LA_SUBR /* use getloadavg(3) */ +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ +# define SPT_TYPE SPT_PSSTRINGS +# define SPT_PADCHAR '\0' /* pad process title with nulls */ +# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ +#endif + /* ** 4.4 BSD @@ -821,7 +861,7 @@ typedef int pid_t; # define SPT_TYPE SPT_BUILTIN # endif # if __FreeBSD_version >= 222000 /* 2.2.2-release and later */ -# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */ +# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */ # endif # endif # ifndef SPT_TYPE @@ -1219,9 +1259,9 @@ extern void *malloc(); ** Florian La Roche <rzsfl@rz.uni-sb.de> ** Karl London <karl@borg.demon.co.uk> ** -** Last compiled against: [06/10/96 @ 09:21:40 PM (Monday)] -** sendmail 8.8-a4 named bind-4.9.4-T4B db-1.85 -** gcc 2.7.2 libc-5.3.12 linux 2.0.0 +** Last compiled against: [07/21/98 @ 11:47:34 AM (Tuesday)] +** sendmail 8.9.1 bind-8.1.2 db-2.4.14 +** gcc-2.8.1 glibc-2.0.94 linux-2.1.109 ** ** NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style ** file locking is no longer allowed. In particular, make sure @@ -1231,6 +1271,7 @@ extern void *malloc(); #ifdef __linux__ # define BSD 1 /* include BSD defines */ +# define USESETEUID 0 /* Have it due to POSIX, but doesn't work */ # define NEEDGETOPT 1 /* need a replacement for getopt(3) */ # define HASUNAME 1 /* use System V uname(2) system call */ # define HASUNSETENV 1 /* has unsetenv(3) call */ @@ -1258,7 +1299,7 @@ extern void *malloc(); # ifndef _PATH_SENDMAILPID # define _PATH_SENDMAILPID "/var/run/sendmail.pid" # endif -# define TZ_TYPE TZ_TNAME +# define TZ_TYPE TZ_TZNAME # include <sys/sysmacros.h> # undef atol /* wounded in <stdlib.h> */ #endif @@ -1487,6 +1528,37 @@ typedef int pid_t; # endif #endif +/* +** System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatiblity Libs ie. native) +** +** Contributed by Paul Gampe <paulg@apnic.net> +*/ + +#ifdef __svr5__ +# include <sys/mkdev.h> +# define __svr4__ +# define SYS5SIGNALS 1 +# define HASSETSID 1 +# define HASSETREUID 1 +# define HASWAITPID 1 +# define HASGETDTABLESIZE 1 +# define GIDSET_T gid_t +# define SOCKADDR_LEN_T size_t +# define SOCKOPT_LEN_T size_t +# ifndef _PATH_UNIX +# define _PATH_UNIX "/stand/unix" +# endif +# define SPT_PADCHAR '\0' /* pad process title with nulls */ +# define SYSLOG_BUFSIZE 1024 /* unsure */ +# ifndef _PATH_VENDOR_CF +# define _PATH_VENDOR_CF "/etc/sendmail.cf" +# endif +# ifndef _PATH_SENDMAILPID +# define _PATH_SENDMAILPID "/etc/sendmail.pid" +# endif +#endif + +/* ###################################################################### */ /* ** UnixWare 2.x @@ -1519,7 +1591,9 @@ typedef int pid_t; # define LA_TYPE LA_ZERO # undef WIFEXITED # undef WEXITSTATUS -# define _PATH_UNIX "/unix" +# ifndef _PATH_UNIX +# define _PATH_UNIX "/unix" +# endif # ifndef _PATH_VENDOR_CF # define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf" # endif diff --git a/contrib/sendmail/src/err.c b/contrib/sendmail/src/err.c index a07d62d..38a3576 100644 --- a/contrib/sendmail/src/err.c +++ b/contrib/sendmail/src/err.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)err.c 8.74 (Berkeley) 6/4/98"; +static char sccsid[] = "@(#)err.c 8.74 (Berkeley) 6/4/1998"; #endif /* not lint */ # include "sendmail.h" diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index 91a4261..500e375 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)headers.c 8.127 (Berkeley) 6/4/98"; +static char sccsid[] = "@(#)headers.c 8.134 (Berkeley) 11/29/1998"; #endif /* not lint */ # include <errno.h> @@ -521,8 +521,8 @@ eatheader(e, full) #if 0 /* - ** Change functionality so a fatal error on an - ** address doesn't affect the entire envelope. + ** Change functionality so a fatal error on an + ** address doesn't affect the entire envelope. */ /* delete fatal errors generated by this address */ @@ -1198,6 +1198,59 @@ putheader(mci, hdr, e) xputs(p); } +#if _FFR_MAX_MIME_HEADER_LENGTH + /* heuristic shortening of MIME fields to avoid MUA overflows */ + if (MaxMimeFieldLength > 0 && + wordinclass(h->h_field, + macid("{checkMIMEFieldHeaders}", NULL))) + { + extern bool fix_mime_header __P((char *)); + + if (fix_mime_header(h->h_value)) + { + sm_syslog(LOG_ALERT, e->e_id, + "Truncated MIME %s header due to field size (possible attack)", + h->h_field); + if (tTd(34, 11)) + printf(" truncated MIME %s header due to field size (possible attack)\n", + h->h_field); + } + } + + if (MaxMimeHeaderLength > 0 && + wordinclass(h->h_field, + macid("{checkMIMETextHeaders}", NULL))) + { + if (strlen(h->h_value) > MaxMimeHeaderLength) + { + h->h_value[MaxMimeHeaderLength - 1] = '\0'; + sm_syslog(LOG_ALERT, e->e_id, + "Truncated long MIME %s header (possible attack)", + h->h_field); + if (tTd(34, 11)) + printf(" truncated long MIME %s header (possible attack)\n", + h->h_field); + } + } + + if (MaxMimeHeaderLength > 0 && + wordinclass(h->h_field, + macid("{checkMIMEHeaders}", NULL))) + { + extern bool shorten_rfc822_string __P((char *, int)); + + if (shorten_rfc822_string(h->h_value, MaxMimeHeaderLength)) + { + sm_syslog(LOG_ALERT, e->e_id, + "Truncated long MIME %s header (possible attack)", + h->h_field); + if (tTd(34, 11)) + printf(" truncated long MIME %s header (possible attack)\n", + h->h_field); + } + } +#endif + /* suppress Content-Transfer-Encoding: if we are MIMEing */ if (bitset(H_CTE, h->h_flags) && bitset(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME, mci->mci_flags)) @@ -1568,3 +1621,69 @@ copyheader(header) return ret; } +/* +** FIX_MIME_HEADER -- possibly truncate/rebalance parameters in a MIME header +** +** Run through all of the parameters of a MIME header and +** possibly truncate and rebalance the parameter according +** to MaxMimeFieldLength. +** +** Parameters: +** string -- the full header +** +** Returns: +** TRUE if the header was modified, FALSE otherwise +** +** Side Effects: +** string modified in place +*/ + +bool +fix_mime_header(string) + char *string; +{ + bool modified = FALSE; + char *begin = string; + char *end; + extern char *find_character __P((char *, char)); + extern bool shorten_rfc822_string __P((char *, int)); + + if (string == NULL || *string == '\0') + return FALSE; + + /* Split on each ';' */ + while ((end = find_character(begin, ';')) != NULL) + { + char save = *end; + char *bp; + + *end = '\0'; + + /* Shorten individual parameter */ + if (shorten_rfc822_string(begin, MaxMimeFieldLength)) + modified = TRUE; + + /* Collapse the possibly shortened string with rest */ + bp = begin + strlen(begin); + if (bp != end) + { + char *ep = end; + + *end = save; + end = bp; + + /* copy character by character due to overlap */ + while (*ep != '\0') + *bp++ = *ep++; + *bp = '\0'; + } + else + *end = save; + if (*end == '\0') + break; + + /* Move past ';' */ + begin = end + 1; + } + return modified; +} diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1 index ed6c0f6..bead1a2 100644 --- a/contrib/sendmail/src/mailq.1 +++ b/contrib/sendmail/src/mailq.1 @@ -8,7 +8,7 @@ .\" the sendmail distribution. .\" .\" -.\" @(#)mailq.1 8.10 (Berkeley) 5/19/98 +.\" @(#)mailq.1 8.10 (Berkeley) 5/19/1998 .\" .Dd May 19, 1998 .Dt MAILQ 1 diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c index 9e1e3b6..8ebb7a0 100644 --- a/contrib/sendmail/src/mci.c +++ b/contrib/sendmail/src/mci.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)mci.c 8.82 (Berkeley) 6/15/98"; +static char sccsid[] = "@(#)mci.c 8.83 (Berkeley) 10/13/1998"; #endif /* not lint */ #include "sendmail.h" @@ -505,7 +505,7 @@ mci_dump_all(logit) mci_dump(MciCache[i], logit); } /* -** MCI_LOCK_HOST -- Lock host while sending. +** MCI_LOCK_HOST -- Lock host while sending. ** ** If we are contacting a host, we'll need to ** update the status information in the host status @@ -645,7 +645,7 @@ mci_unlock_host(mci) errno = saveErrno; } /* -** MCI_LOAD_PERSISTENT -- load persistent host info +** MCI_LOAD_PERSISTENT -- load persistent host info ** ** Load information about host that is kept ** in common for all running sendmails. @@ -1018,8 +1018,8 @@ mci_traverse_persistent(action, pathname) *hostptr = '\0'; /* - ** Do something with the file containing the persistent - ** information. + ** Do something with the file containing the persistent + ** information. */ ret = (*action)(pathname, host); } @@ -1169,7 +1169,7 @@ mci_purge_persistent(pathname, hostname) return 0; } /* -** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname +** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname ** ** Given `host', convert from a.b.c to $QueueDir/.hoststat/c./b./a, ** putting the result into `path'. if `createflag' is set, intervening diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c index c7ae3d9..53e1a51 100644 --- a/contrib/sendmail/src/savemail.c +++ b/contrib/sendmail/src/savemail.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)savemail.c 8.138 (Berkeley) 6/17/98"; +static char sccsid[] = "@(#)savemail.c 8.139 (Berkeley) 8/5/1998"; #endif /* not lint */ # include "sendmail.h" @@ -91,8 +91,7 @@ savemail(e, sendbody) RF_COPYPARSE|RF_SENDERADDR, '\0', NULL, e) == NULL) { syserr("553 Cannot parse Postmaster!"); - ExitStat = EX_SOFTWARE; - finis(); + finis(TRUE, EX_SOFTWARE); } } e->e_to = NULL; diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8 index 7738e12..be31d2e 100644 --- a/contrib/sendmail/src/sendmail.8 +++ b/contrib/sendmail/src/sendmail.8 @@ -8,9 +8,9 @@ .\" the sendmail distribution. .\" .\" -.\" @(#)sendmail.8 8.19 (Berkeley) 5/19/98 +.\" @(#)sendmail.8 8.20 (Berkeley) 8/2/1998 .\" -.Dd May 19, 1998 +.Dd August 2, 1998 .Dt SENDMAIL 8 .Os BSD 4 .Sh NAME @@ -277,6 +277,9 @@ 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. +.It Fl - +Stop processing command flags and use the rest of the arguments +as addresses. .El .Ss Options There are also a number of processing options that may be set. |