diff options
Diffstat (limited to 'contrib/sendmail/src')
25 files changed, 245 insertions, 178 deletions
diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4 index ad9e1c9..d88d35b 100644 --- a/contrib/sendmail/src/Makefile.m4 +++ b/contrib/sendmail/src/Makefile.m4 @@ -2,7 +2,7 @@ # This Makefile is designed to work on any reasonably current version of # "make" program. # -# @(#)Makefile.m4 8.25 (Berkeley) 10/5/1998 +# @(#)Makefile.m4 8.26 (Berkeley) 1/23/1999 # # C compiler @@ -103,16 +103,18 @@ MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8') MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8') MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0') -ALL= sendmail aliases.${MAN5SRC} mailq.${MAN1SRC} newaliases.${MAN1SRC} sendmail.${MAN8SRC} +ALL= sendmail sendmail.st aliases.${MAN5SRC} mailq.${MAN1SRC} newaliases.${MAN1SRC} sendmail.${MAN8SRC} all: ${ALL} sendmail: ${BEFORE} ${OBJS} ${CC} -o sendmail ${LDOPTS} ${LIBDIRS} ${OBJS} ${LIBS} - cp /dev/null sendmail.st undivert(3) +sendmail.st: + cp /dev/null sendmail.st + aliases.${MAN5SRC}: aliases.5 ${NROFF} ${MANDOC} aliases.5 > aliases.${MAN5SRC} diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README index 817b3a4..7106e8c 100644 --- a/contrib/sendmail/src/README +++ b/contrib/sendmail/src/README @@ -8,7 +8,7 @@ # the sendmail distribution. # # -# @(#)README 8.209 (Berkeley) 10/6/1998 +# @(#)README 8.211 (Berkeley) 2/2/1999 # This directory contains the source files for sendmail(TM). @@ -115,8 +115,8 @@ HESIOD Support for Hesiod (from the DEC/Athena distribution). You work. You may be able to get this to work with the MIT/Athena version of Hesiod, but that's likely to be a lot of work. LDAPMAP Lightweight Directory Lookup Protocol support. You will - have to install the UMich ldap and lber libraries to use - this flag. + have to install the UMich or OpenLDAP ldap and lber + libraries to use this flag. MAP_REGEX Regular Expression support. You will need to use an operating system which comes with the POSIX regex() routines or install a regexp library such as libregex from @@ -1078,6 +1078,12 @@ Linux to LIBS. Data structures may change and you'd be asking for a core dump. + A number of problems have been reported regarding the Linux 2.2.0 + kernel. So far, these problems have been tracked down to syslog() + and DNS resolution. We believe the problem is with the poll() + implementation in the Linux 2.2.0 kernel and poll()-aware versions + of glib (at least up to 2.0.111). + AIX 4.2 The AIX m4 implements a different mechanism for ifdef which is inconsistent with other versions of m4. Therefore, it will not @@ -1315,6 +1321,9 @@ LDAP The software has been in production on Solaris.2.5.1 at Stanford for over 2 years. + The LDAP map supports both the UMich LDAP 3.2 and 3.3 libraries as + well as the OpenLDAP (http://www.openldap.org/) libraries. + TCP Wrappers If you are using -DTCPWRAPPERS to get TCP Wrappers support you will also need to install libwrap.a and modify your site.config.m4 file @@ -1452,4 +1461,4 @@ version.c The version number and information about this Eric Allman -(Version 8.209, last update 10/6/1998 17:10:21) +(Version 8.211, last update 2/2/1999 15:28:18) diff --git a/contrib/sendmail/src/arpadate.c b/contrib/sendmail/src/arpadate.c index 1b539b6..c02decd 100644 --- a/contrib/sendmail/src/arpadate.c +++ b/contrib/sendmail/src/arpadate.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)arpadate.c 8.12 (Berkeley) 5/19/1998"; +static char sccsid[] = "@(#)arpadate.c 8.14 (Berkeley) 2/2/1999"; #endif /* not lint */ # include "sendmail.h" @@ -73,7 +73,7 @@ arpadate(ud) ** to resolve the timezone. */ - (void) time(&t); + t = curtime(); if (ud == NULL) ud = ctime(&t); @@ -156,7 +156,12 @@ arpadate(ud) { extern char *tzname[]; - tz = tzname[lt->tm_isdst]; + if (lt->tm_isdst > 0) + tz = tzname[1]; + else if (lt->tm_isdst == 0) + tz = tzname[0]; + else + tz = NULL; } #endif #if TZ_TYPE == TZ_TIMEZONE diff --git a/contrib/sendmail/src/clock.c b/contrib/sendmail/src/clock.c index aab301c..e6466e6 100644 --- a/contrib/sendmail/src/clock.c +++ b/contrib/sendmail/src/clock.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)clock.c 8.34 (Berkeley) 6/4/1998"; +static char sccsid[] = "@(#)clock.c 8.35 (Berkeley) 2/2/1999"; #endif /* not lint */ # include "sendmail.h" @@ -60,7 +60,7 @@ setevent(intvl, func, arg) } wasblocked = blocksignal(SIGALRM); - (void) time(&now); + now = curtime(); /* search event queue for correct position */ for (evp = &EventQueue; (ev = *evp) != NULL; evp = &ev->ev_link) diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c index 7e68f40..a8916b1 100644 --- a/contrib/sendmail/src/collect.c +++ b/contrib/sendmail/src/collect.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)collect.c 8.91 (Berkeley) 8/19/1998"; +static char sccsid[] = "@(#)collect.c 8.93 (Berkeley) 1/26/1999"; #endif /* not lint */ # include <errno.h> @@ -78,8 +78,7 @@ collect(fp, smtpmode, hdrp, e) volatile int istate; volatile int mstate; u_char *volatile pbp; - int nhdrlines = 0; - int hdrlinelen = 0; + int hdrslen = 0; u_char peekbuf[8]; char dfname[MAXQFNAME]; char bufbuf[MAXLINE]; @@ -201,7 +200,6 @@ collect(fp, smtpmode, hdrp, e) switch (istate) { case IS_BOL: - hdrlinelen = 0; if (c == '.') { istate = IS_DOT; @@ -309,18 +307,18 @@ bufferchar: else if (c != '\0') { *bp++ = c; - if (MaxHeaderLineLength > 0 && - ++hdrlinelen > MaxHeaderLineLength) + if (MaxHeadersLength > 0 && + ++hdrslen > MaxHeadersLength) { sm_syslog(LOG_NOTICE, e->e_id, - "header line too long (%d max) from %s during message collect", - MaxHeaderLineLength, + "headers too large (%d max) from %s during message collect", + MaxHeadersLength, CurHostName != NULL ? CurHostName : "localhost"); errno = 0; e->e_flags |= EF_CLRQUEUE; e->e_status = "5.6.0"; - usrerr("552 Header line too long (%d max)", - MaxHeaderLineLength); + usrerr("552 Headers too large (%d max)", + MaxHeadersLength); mstate = MS_DISCARD; } } @@ -356,22 +354,6 @@ nextstate: goto nextstate; } - if (MaxHeaderLines > 0 && - ++nhdrlines > MaxHeaderLines) - { - sm_syslog(LOG_NOTICE, e->e_id, - "too many header lines (%d max) from %s during message collect", - MaxHeaderLines, - CurHostName != NULL ? CurHostName : "localhost"); - errno = 0; - e->e_flags |= EF_CLRQUEUE; - e->e_status = "5.6.0"; - usrerr("552 Too many header lines (%d max)", - MaxHeaderLines); - mstate = MS_DISCARD; - break; - } - /* check for possible continuation line */ do { diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index 2544de6..3cfa73b 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.450 (Berkeley) 12/17/1998"; +static char sccsid[] = "@(#)conf.c 8.452 (Berkeley) 1/26/1999"; #endif /* not lint */ # include "sendmail.h" @@ -284,8 +284,7 @@ setdefaults(e) ColonOkInAddr = TRUE; DontLockReadFiles = TRUE; DoubleBounceAddr = "postmaster"; - MaxHeaderLines = MAXHDRLINES; - MaxHeaderLineLength = MAXHDRLINELEN; + MaxHeadersLength = MAXHDRSLEN; snprintf(buf, sizeof buf, "%s%sdead.letter", _PATH_VARTMP, _PATH_VARTMP[sizeof _PATH_VARTMP - 2] == '/' ? "" : "/"); diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h index 8e5a637..6097c27 100644 --- a/contrib/sendmail/src/conf.h +++ b/contrib/sendmail/src/conf.h @@ -9,7 +9,7 @@ * the sendmail distribution. * * - * @(#)conf.h 8.380 (Berkeley) 11/9/1998 + * @(#)conf.h 8.385 (Berkeley) 1/28/1999 */ /* @@ -69,11 +69,8 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # else # define MAXMACNAMELEN 20 /* max macro name length */ # endif -# ifndef MAXHDRLINES -# define MAXHDRLINES 1000 /* max lines in a message header */ -# endif -# ifndef MAXHDRLINELEN -# define MAXHDRLINELEN SMTPLINELIM /* max length of a header line */ +# ifndef MAXHDRSLEN +# define MAXHDRSLEN (32 * 1024) /* max size of message headers */ # endif /********************************************************************** @@ -1302,10 +1299,12 @@ extern void *malloc(); # endif # define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() impl */ # define SPT_PADCHAR '\0' /* pad process title with nulls */ +# ifndef TZ_TYPE +# define TZ_TYPE TZ_NONE /* no standard for Linux */ +# endif # ifndef _PATH_SENDMAILPID # define _PATH_SENDMAILPID "/var/run/sendmail.pid" # endif -# define TZ_TYPE TZ_TZNAME # include <sys/sysmacros.h> # undef atol /* wounded in <stdlib.h> */ #endif diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c index 157ca08..415818c 100644 --- a/contrib/sendmail/src/control.c +++ b/contrib/sendmail/src/control.c @@ -8,7 +8,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)control.c 8.17 (Berkeley) 12/1/1998"; +static char sccsid[] = "@(#)control.c 8.18 (Berkeley) 1/17/1999"; #endif /* not lint */ #include "sendmail.h" @@ -70,8 +70,7 @@ opencontrolsocket() { int save_errno = errno; - (void) close(ControlSocket); - ControlSocket = -1; + clrcontrol(); errno = save_errno; return -1; } @@ -88,6 +87,7 @@ opencontrolsocket() ControlSocketName, errstring(save_errno)); message("050 ownership change on %s failed: %s", ControlSocketName, errstring(save_errno)); + closecontrolsocket(TRUE); errno = save_errno; return -1; } diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c index b74a7a7..ae6b004 100644 --- a/contrib/sendmail/src/daemon.c +++ b/contrib/sendmail/src/daemon.c @@ -15,9 +15,9 @@ #ifndef lint #ifdef DAEMON -static char sccsid[] = "@(#)daemon.c 8.234 (Berkeley) 12/17/1998 (with daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (with daemon mode)"; #else -static char sccsid[] = "@(#)daemon.c 8.234 (Berkeley) 12/17/1998 (without daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (without daemon mode)"; #endif #endif /* not lint */ @@ -178,8 +178,8 @@ getrequests(e) if (opencontrolsocket() < 0) sm_syslog(LOG_WARNING, NOQID, - "daemon could not open control socket: %s", - errstring(errno)); + "daemon could not open control socket %s: %s", + ControlSocketName, errstring(errno)); (void) setsignal(SIGCHLD, reapchild); @@ -503,7 +503,7 @@ getrequests(e) } /* parent -- keep track of children */ - snprintf(status, MAXLINE, "SMTP server child for %s", + snprintf(status, sizeof status, "SMTP server child for %s", anynet_ntoa(&RealHostAddr)); proc_list_add(pid, status); (void) releasesignal(SIGCHLD); diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c index e70f17e..ed03328 100644 --- a/contrib/sendmail/src/deliver.c +++ b/contrib/sendmail/src/deliver.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 8.366 (Berkeley) 12/18/1998"; +static char sccsid[] = "@(#)deliver.c 8.367 (Berkeley) 1/18/1999"; #endif /* not lint */ #include "sendmail.h" @@ -2003,7 +2003,7 @@ do_transfer: mci->mci_contentlen = 0; putfromline(mci, e); - (*e->e_puthdr)(mci, e->e_header, e); + (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER); (*e->e_putbody)(mci, e, NULL); /* get the exit status */ @@ -3569,7 +3569,7 @@ mailfile(filename, mailer, ctladdr, sfflags, e) #endif putfromline(&mcibuf, e); - (*e->e_puthdr)(&mcibuf, e->e_header, e); + (*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER); (*e->e_putbody)(&mcibuf, e, NULL); putline("\n", &mcibuf); if (fflush(f) < 0 || ferror(f)) diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c index a279c0e..ec79be8 100644 --- a/contrib/sendmail/src/domain.c +++ b/contrib/sendmail/src/domain.c @@ -14,9 +14,9 @@ #ifndef lint #if NAMED_BIND -static char sccsid[] = "@(#)domain.c 8.80 (Berkeley) 12/17/1998 (with name server)"; +static char sccsid[] = "@(#)domain.c 8.81 (Berkeley) 1/21/1999 (with name server)"; #else -static char sccsid[] = "@(#)domain.c 8.80 (Berkeley) 12/17/1998 (without name server)"; +static char sccsid[] = "@(#)domain.c 8.81 (Berkeley) 1/21/1999 (without name server)"; #endif #endif /* not lint */ @@ -446,7 +446,6 @@ bestmx_map_lookup(map, name, av, statp) int *statp; { int nmx; - auto int rcode; int saveopts = _res.options; int i, len = 0; char *p; @@ -454,7 +453,7 @@ bestmx_map_lookup(map, name, av, statp) char buf[PSBUFSIZE / 2]; _res.options &= ~(RES_DNSRCH|RES_DEFNAMES); - nmx = getmxrr(name, mxhosts, FALSE, &rcode); + nmx = getmxrr(name, mxhosts, FALSE, statp); _res.options = saveopts; if (nmx <= 0) return NULL; diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c index a17aa8c..2cc90d6 100644 --- a/contrib/sendmail/src/envelope.c +++ b/contrib/sendmail/src/envelope.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)envelope.c 8.121 (Berkeley) 12/18/1998"; +static char sccsid[] = "@(#)envelope.c 8.122 (Berkeley) 1/25/1999"; #endif /* not lint */ #include "sendmail.h" @@ -800,7 +800,7 @@ setsender(from, e, delimptr, delimchar, internal) if (FullName != NULL && !internal) define('x', FullName, e); } - else if (!internal && OpMode != MD_DAEMON) + else if (!internal && OpMode != MD_DAEMON && OpMode != MD_SMTP) { if (e->e_from.q_home == NULL) { diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index fcf1d9c..6c43dcb 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.134 (Berkeley) 11/29/1998"; +static char sccsid[] = "@(#)headers.c 8.136 (Berkeley) 1/26/1999"; #endif /* not lint */ # include <errno.h> @@ -77,6 +77,7 @@ chompheader(line, def, hdrp, e) bool headeronly; STAB *s; struct hdrinfo *hi; + bool nullheader = FALSE; BITMAP mopts; if (tTd(31, 6)) @@ -123,11 +124,17 @@ chompheader(line, def, hdrp, e) return 0; } *fvalue = '\0'; - fvalue = p; /* strip field value on front */ - if (*fvalue == ' ') - fvalue++; + if (*p == ' ') + p++; + fvalue = p; + + /* if the field is null, go ahead and use the default */ + while (isascii(*p) && isspace(*p)) + p++; + if (*p == '\0') + nullheader = TRUE; /* security scan: long field names are end-of-header */ if (strlen(fname) > 100) @@ -236,6 +243,11 @@ chompheader(line, def, hdrp, e) bitset(H_DEFAULT, h->h_flags) && !bitset(H_FORCE, h->h_flags)) { + if (nullheader) + { + /* user-supplied value was null */ + return 0; + } h->h_value = NULL; if (!cond) { @@ -1149,6 +1161,7 @@ crackaddr(addr) ** mci -- the connection information. ** h -- the header to put. ** e -- envelope to use. +** flags -- MIME conversion flags. ** ** Returns: ** none. @@ -1165,10 +1178,11 @@ crackaddr(addr) #endif void -putheader(mci, hdr, e) +putheader(mci, hdr, e, flags) register MCI *mci; HDR *hdr; register ENVELOPE *e; + int flags; { register HDR *h; char buf[MAX(MAXLINE,BUFSIZ)]; @@ -1251,9 +1265,16 @@ putheader(mci, hdr, e) } #endif - /* suppress Content-Transfer-Encoding: if we are MIMEing */ + /* + ** Suppress Content-Transfer-Encoding: if we are MIMEing + ** and we are potentially converting from 8 bit to 7 bit + ** MIME. If converting, add a new CTE header in + ** mime8to7(). + */ if (bitset(H_CTE, h->h_flags) && - bitset(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME, mci->mci_flags)) + bitset(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME, + mci->mci_flags) && + !bitset(M87F_NO8TO7, flags)) { if (tTd(34, 11)) printf(" (skipped (content-transfer-encoding))\n"); diff --git a/contrib/sendmail/src/ldap_map.h b/contrib/sendmail/src/ldap_map.h index 97eb29e..7d40329 100644 --- a/contrib/sendmail/src/ldap_map.h +++ b/contrib/sendmail/src/ldap_map.h @@ -14,7 +14,7 @@ ** Please go to him for support -- since I (Eric) don't run LDAP, I ** can't help you at all. ** -** @(#)ldap_map.h 8.10 (Berkeley) 9/14/1998 +** @(#)ldap_map.h 8.12 (Berkeley) 2/2/1999 */ #ifndef _LDAP_MAP_H @@ -68,4 +68,24 @@ typedef struct ldap_map_struct LDAP_MAP_STRUCT; # define DEFAULT_LDAP_MAP_LDAP_OPTIONS 0 #endif /* LDAP_REFERRALS */ +/* +** ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1. +** Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations +** and assume (falsely) that all old API implementations are broken. +** (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT) +*/ + +#if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) +# define USE_LDAP_INIT 1 +#endif + +/* +** LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x, +** hence ldap_set_option() must not exist. +*/ + +#if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) +# define USE_LDAP_SET_OPTION 1 +#endif + #endif /* _LDAP_MAP_H */ diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c index 787ae07..8fc3387f 100644 --- a/contrib/sendmail/src/map.c +++ b/contrib/sendmail/src/map.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)map.c 8.256 (Berkeley) 11/15/1998"; +static char sccsid[] = "@(#)map.c 8.261 (Berkeley) 2/2/1999"; #endif /* not lint */ #include "sendmail.h" @@ -1877,9 +1877,11 @@ db_map_close(map) ** opened by another process will interfere ** with the shared memory and locks of the parent ** process leaving things in a bad state. - ** + */ + + /* ** If this map was not opened by the current - ** process, do not close it here but recover + ** process, do not close the map but recover ** the file descriptor. */ if (map->map_pid != getpid()) @@ -2670,7 +2672,7 @@ ldap_map_start(map) ev = setevent(lmap->timeout.tv_sec, ldaptimeout, 0); } -#ifdef LDAP_VERSION3 +#ifdef USE_LDAP_INIT ld = ldap_init(lmap->ldaphost,lmap->ldapport); #else ld = ldap_open(lmap->ldaphost,lmap->ldapport); @@ -2691,23 +2693,26 @@ ldap_map_start(map) return FALSE; } -#ifdef LDAP_VERSION3 +#ifdef USE_LDAP_SET_OPTION ldap_set_option(ld, LDAP_OPT_DEREF, &lmap->deref); ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &lmap->timelimit); ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &lmap->sizelimit); - ldap_set_option(ld, LDAP_OPT_REFERRALS, &lmap->ldap_options); - - /* ld needs to be cast into the map struct */ - lmap->ld = ld; - return TRUE; + ldap_set_option(ld, LDAP_OPT_REFERRALS, + bitset(LDAP_OPT_REFERRALS, lmap->ldap_options) ? + LDAP_OPT_ON : LDAP_OPT_OFF); #else - /* From here on in we can use ldap internal timelimits */ ld->ld_deref = lmap->deref; ld->ld_timelimit = lmap->timelimit; ld->ld_sizelimit = lmap->sizelimit; ld->ld_options = lmap->ldap_options; +#endif +#ifdef USE_LDAP_INIT + /* ld needs to be cast into the map struct */ + lmap->ld = ld; + return TRUE; +#else if (ldap_bind_s(ld, lmap->binddn,lmap->passwd,lmap->method) != LDAP_SUCCESS) { if (!bitset(MF_OPTIONAL, map->map_mflags)) @@ -2729,19 +2734,33 @@ ldap_map_start(map) /* -** LDAP_MAP_CLOSE -- close ldap map +** LDAP_MAP_STOP -- close the ldap connection */ void -ldap_map_close(map) +ldap_map_stop(map) MAP *map; { - LDAP_MAP_STRUCT *lmap ; + LDAP_MAP_STRUCT *lmap; + lmap = (LDAP_MAP_STRUCT *) map->map_db1; if (lmap->ld != NULL) + { ldap_unbind(lmap->ld); + lmap->ld = NULL; + } } +/* +** LDAP_MAP_CLOSE -- close ldap map +*/ + +void +ldap_map_close(map) + MAP *map; +{ + ldap_map_stop(map); +} #ifdef SUNET_ID /* @@ -2855,8 +2874,8 @@ ldap_map_lookup(map, name, av, statp) lmap->attr, lmap->attrsonly, &(lmap->timeout), &(lmap->res)) != LDAP_SUCCESS) { - /* try close/opening map */ - ldap_map_close(map); + /* try stopping/starting map */ + ldap_map_stop(map); if (!ldap_map_start(map)) { result = NULL; @@ -2918,7 +2937,7 @@ ldap_map_lookup(map, name, av, statp) ldap_value_free(attr_values); if (lmap != NULL) ldap_msgfree(lmap->res); - ldap_map_close(map); + ldap_map_stop(map); return result ; } diff --git a/contrib/sendmail/src/mime.c b/contrib/sendmail/src/mime.c index a1429cb..7156891 100644 --- a/contrib/sendmail/src/mime.c +++ b/contrib/sendmail/src/mime.c @@ -14,7 +14,7 @@ # include <string.h> #ifndef lint -static char sccsid[] = "@(#)mime.c 8.70 (Berkeley) 11/10/1998"; +static char sccsid[] = "@(#)mime.c 8.71 (Berkeley) 1/18/1999"; #endif /* not lint */ /* @@ -308,7 +308,7 @@ mime8to7(mci, header, e, boundaries, flags) collect(e->e_dfp, FALSE, &hdr, e); if (tTd(43, 101)) putline("+++after collect", mci); - putheader(mci, hdr, e); + putheader(mci, hdr, e, flags); if (tTd(43, 101)) putline("+++after putheader", mci); bt = mime8to7(mci, hdr, e, boundaries, flags); @@ -360,7 +360,7 @@ mime8to7(mci, header, e, boundaries, flags) collect(e->e_dfp, FALSE, &hdr, e); if (tTd(43, 101)) putline("+++after collect", mci); - putheader(mci, hdr, e); + putheader(mci, hdr, e, flags); if (tTd(43, 101)) putline("+++after putheader", mci); if (hvalue("MIME-Version", hdr) == NULL) @@ -442,11 +442,16 @@ mime8to7(mci, header, e, boundaries, flags) if (sectionhighbits == 0) { /* no encoding necessary */ - if (cte != NULL && bitset(MCIF_INMIME, mci->mci_flags)) + if (cte != NULL && + bitset(MCIF_INMIME, mci->mci_flags) && + !bitset(M87F_NO8TO7, flags)) { /* - ** Skip _unless_ in MIME mode; see putheader() for the - ** counterpart where this is skipped _if_ in MIME mode. + ** Skip _unless_ in MIME mode and potentially + ** converting from 8 bit to 7 bit MIME. See + ** putheader() for the counterpart where the + ** CTE header is skipped in the opposite + ** situation. */ snprintf(buf, sizeof buf, diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c index 65e777a..b02fc08 100644 --- a/contrib/sendmail/src/queue.c +++ b/contrib/sendmail/src/queue.c @@ -14,9 +14,9 @@ #ifndef lint #if QUEUE -static char sccsid[] = "@(#)queue.c 8.210 (Berkeley) 10/15/1998 (with queueing)"; +static char sccsid[] = "@(#)queue.c 8.211 (Berkeley) 1/25/1999 (with queueing)"; #else -static char sccsid[] = "@(#)queue.c 8.210 (Berkeley) 10/15/1998 (without queueing)"; +static char sccsid[] = "@(#)queue.c 8.211 (Berkeley) 1/25/1999 (without queueing)"; #endif #endif /* not lint */ @@ -348,8 +348,7 @@ queueup(e, announce) { extern bool bitzerop __P((BITMAP)); - /* don't output null headers */ - if (h->h_value == NULL || h->h_value[0] == '\0') + if (h->h_value == NULL) continue; /* don't output resent headers on non-resent messages */ diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c index ab81027..df40097 100644 --- a/contrib/sendmail/src/readcf.c +++ b/contrib/sendmail/src/readcf.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)readcf.c 8.235 (Berkeley) 8/18/1998"; +static char sccsid[] = "@(#)readcf.c 8.238 (Berkeley) 1/28/1999"; #endif /* not lint */ # include "sendmail.h" @@ -1527,9 +1527,9 @@ struct optioninfo #define O_CONTROLSOCKET 0xa9 { "ControlSocketName", O_CONTROLSOCKET, FALSE }, #endif -#if _FFR_MAX_HEADER_LINES -#define O_MAXHDRLINES 0xaa - { "MaxHeaderLines", O_MAXHDRLINES, FALSE }, +#if _FFR_MAX_HEADERS_LENGTH +#define O_MAXHDRSLEN 0xaa + { "MaxHeadersLength", O_MAXHDRSLEN, FALSE }, #endif { NULL, '\0', FALSE } }; @@ -2470,22 +2470,13 @@ setoption(opt, val, safe, sticky, e) break; #endif -#if _FFR_MAX_HEADER_LINES - case O_MAXHDRLINES: - p = strchr(val, '/'); - if (p != NULL) - *p++ = '\0'; - MaxHeaderLines = atoi(val); - if (p != NULL && *p != '\0') - MaxHeaderLineLength = atoi(p); - - if (MaxHeaderLines > 0 && - MaxHeaderLines < 50) - printf("Warning: MaxHeaderLines: header line limit set lower than 50\n"); +#if _FFR_MAX_HEADERS_LENGTH + case O_MAXHDRSLEN: + MaxHeadersLength = atoi(val); - if (MaxHeaderLineLength > 0 && - MaxHeaderLineLength < MAXHDRLINELEN) - printf("Warning: MaxHeaderLines: header line length limit set lower than %d\n", MAXHDRLINELEN); + if (MaxHeadersLength > 0 && + MaxHeadersLength < (MAXHDRSLEN / 2)) + printf("Warning: MaxHeadersLength: headers length limit set lower than %d\n", MAXHDRSLEN); break; #endif diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c index 59412a8..f7e221f 100644 --- a/contrib/sendmail/src/recipient.c +++ b/contrib/sendmail/src/recipient.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)recipient.c 8.161 (Berkeley) 12/18/1998"; +static char sccsid[] = "@(#)recipient.c 8.163 (Berkeley) 1/23/1999"; #endif /* not lint */ # include "sendmail.h" @@ -1195,6 +1195,7 @@ resetuid: { /* don't do any more now */ ctladdr->q_flags |= QVERIFIED; + ctladdr->q_flags &= ~QDONTSEND; e->e_nrcpts++; xfclose(fp, "include", fname); return rval; @@ -1409,6 +1410,8 @@ self_reference(a, e) c = a; while (c != NULL) { + if (tTd(27, 10)) + printf(" %s", c->q_user); if (bitnset(M_HASPWENT, c->q_mailer->m_flags)) { if (tTd(27, 2)) @@ -1427,6 +1430,22 @@ self_reference(a, e) if (tTd(27, 2)) printf("failed\n"); } + else + { + /* if local delivery, compare usernames */ + if (bitnset(M_LOCALMAILER, c->q_mailer->m_flags) && + b->q_mailer == c->q_mailer) + { + if (tTd(27, 2)) + printf("\t... local match (%s)\n", c->q_user); + if (sameaddr(b, c)) + return b; + else + return c; + } + } + if (tTd(27, 10)) + printf("\n"); c = c->q_alias; } diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c index f15c8de..6a18ee6 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.139 (Berkeley) 8/5/1998"; +static char sccsid[] = "@(#)savemail.c 8.140 (Berkeley) 1/18/1999"; #endif /* not lint */ # include "sendmail.h" @@ -395,7 +395,7 @@ savemail(e, sendbody) mcibuf.mci_contentlen = 0; putfromline(&mcibuf, e); - (*e->e_puthdr)(&mcibuf, e->e_header, e); + (*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER); (*e->e_putbody)(&mcibuf, e, NULL); putline("\n", &mcibuf); (void) fflush(fp); @@ -1139,7 +1139,7 @@ errbody(mci, e, separator) } } putline("", mci); - putheader(mci, e->e_parent->e_header, e->e_parent); + putheader(mci, e->e_parent->e_header, e->e_parent, M87F_OUTER); if (sendbody) putbody(mci, e->e_parent, e->e_msgboundary); else if (e->e_msgboundary == NULL) diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h index 3c73699..ff2697e 100644 --- a/contrib/sendmail/src/sendmail.h +++ b/contrib/sendmail/src/sendmail.h @@ -9,7 +9,7 @@ * the sendmail distribution. * * - * @(#)sendmail.h 8.292 (Berkeley) 11/21/1998 + * @(#)sendmail.h 8.295 (Berkeley) 1/26/1999 */ /* @@ -19,7 +19,7 @@ # ifdef _DEFINE # define EXTERN # ifndef lint -static char SmailSccsId[] = "@(#)sendmail.h 8.292 11/21/1998"; +static char SmailSccsId[] = "@(#)sendmail.h 8.295 1/26/1999"; # endif # else /* _DEFINE */ # define EXTERN extern @@ -464,7 +464,7 @@ struct envelope short e_sendmode; /* message send mode */ short e_errormode; /* error return mode */ short e_timeoutclass; /* message timeout class */ - void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *)); + void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int)); /* function to put header of message */ void (*e_putbody)__P((MCI *, ENVELOPE *, char *)); /* function to put body of message */ @@ -522,7 +522,7 @@ extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *)); extern void dropenvelope __P((ENVELOPE *, bool)); extern void clearenvelope __P((ENVELOPE *, bool)); -extern void putheader __P((MCI *, HDR *, ENVELOPE *)); +extern void putheader __P((MCI *, HDR *, ENVELOPE *, int)); extern void putbody __P((MCI *, ENVELOPE *, char *)); /* ** Message priority classes. @@ -1258,8 +1258,7 @@ EXTERN gid_t RunAsGid; /* GID to become for bulk of run */ EXTERN int MaxRcptPerMsg; /* max recipients per SMTP message */ EXTERN bool DoQueueRun; /* non-interrupt time queue run needed */ EXTERN u_long ConnectOnlyTo; /* override connection address (for testing) */ -EXTERN int MaxHeaderLines; /* max lines of headers per message */ -EXTERN int MaxHeaderLineLength; /* max length of a header line */ +EXTERN int MaxHeadersLength; /* max length of headers */ #if _FFR_DSN_RRT_OPTION EXTERN bool RrtImpliesDsn; /* turn Return-Receipt-To: into DSN */ #endif diff --git a/contrib/sendmail/src/udb.c b/contrib/sendmail/src/udb.c index a279aff..96c6513 100644 --- a/contrib/sendmail/src/udb.c +++ b/contrib/sendmail/src/udb.c @@ -14,9 +14,9 @@ #ifndef lint #if USERDB -static char sccsid [] = "@(#)udb.c 8.70 (Berkeley) 12/21/1998 (with USERDB)"; +static char sccsid [] = "@(#)udb.c 8.71 (Berkeley) 1/17/1999 (with USERDB)"; #else -static char sccsid [] = "@(#)udb.c 8.70 (Berkeley) 12/21/1998 (without USERDB)"; +static char sccsid [] = "@(#)udb.c 8.71 (Berkeley) 1/17/1999 (without USERDB)"; #endif #endif @@ -1164,11 +1164,7 @@ badspec: #endif if (tTd(28, 1)) { -#if DB_VERSION_MAJOR < 2 - printf("_udbx_init: db->close(%s)\n", -#else printf("_udbx_init: db->close(%s)\n", -#endif up->udb_dbname); } } @@ -1242,11 +1238,7 @@ _udbx_close() } if (tTd(28, 1)) { -#if DB_VERSION_MAJOR < 2 - printf("_udbx_init: db->close(%s)\n", -#else printf("_udbx_init: db->close(%s)\n", -#endif up->udb_dbname); } #endif diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c index 99ea646..c82942b 100644 --- a/contrib/sendmail/src/usersmtp.c +++ b/contrib/sendmail/src/usersmtp.c @@ -14,9 +14,9 @@ #ifndef lint #if SMTP -static char sccsid[] = "@(#)usersmtp.c 8.108 (Berkeley) 10/6/1998 (with SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.111 (Berkeley) 2/3/1999 (with SMTP)"; #else -static char sccsid[] = "@(#)usersmtp.c 8.108 (Berkeley) 10/6/1998 (without SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.111 (Berkeley) 2/3/1999 (without SMTP)"; #endif #endif /* not lint */ @@ -327,7 +327,6 @@ smtpmailfrom(m, mci, e) ENVELOPE *e; { int r; - int l; char *bufp; char *bodytype; char buf[MAXNAME + 1]; @@ -337,11 +336,12 @@ smtpmailfrom(m, mci, e) printf("smtpmailfrom: CurHost=%s\n", CurHostName); /* set up appropriate options to include */ + bufp = optbuf; if (bitset(MCIF_SIZE, mci->mci_flags) && e->e_msgsize > 0) snprintf(optbuf, sizeof optbuf, " SIZE=%ld", e->e_msgsize); else strcpy(optbuf, ""); - l = sizeof optbuf - strlen(optbuf) - 1; + bufp = &optbuf[strlen(optbuf)]; bodytype = e->e_bodytype; if (bitset(MCIF_8BITMIME, mci->mci_flags)) @@ -352,11 +352,12 @@ smtpmailfrom(m, mci, e) !bitset(EF_DONT_MIME, e->e_flags) && !bitnset(M_8BITS, m->m_flags)) bodytype = "8BITMIME"; - if (bodytype != NULL && strlen(bodytype) + 7 < l) + if (bodytype != NULL && + SPACELEFT(optbuf, bufp) > strlen(bodytype) + 7) { - strcat(optbuf, " BODY="); - strcat(optbuf, bodytype); - l -= strlen(optbuf); + snprintf(bufp, SPACELEFT(optbuf, bufp), + " BODY=%s", bodytype); + bufp += strlen(bufp); } } else if (bitnset(M_8BITS, m->m_flags) || @@ -387,22 +388,23 @@ smtpmailfrom(m, mci, e) if (bitset(MCIF_DSN, mci->mci_flags)) { - if (e->e_envid != NULL && strlen(e->e_envid) < (SIZE_T) (l - 7)) + if (e->e_envid != NULL && + SPACELEFT(optbuf, bufp) > strlen(e->e_envid) + 7) { - strcat(optbuf, " ENVID="); - strcat(optbuf, e->e_envid); - l -= strlen(optbuf); + snprintf(bufp, SPACELEFT(optbuf, bufp), + " ENVID=%s", e->e_envid); + bufp += strlen(bufp); } /* RET= parameter */ - if (bitset(EF_RET_PARAM, e->e_flags) && l >= 9) + if (bitset(EF_RET_PARAM, e->e_flags) && + SPACELEFT(optbuf, bufp) > 9) { - strcat(optbuf, " RET="); - if (bitset(EF_NO_BODY_RETN, e->e_flags)) - strcat(optbuf, "HDRS"); - else - strcat(optbuf, "FULL"); - l -= 9; + snprintf(bufp, SPACELEFT(optbuf, bufp), + " RET=%s", + bitset(EF_NO_BODY_RETN, e->e_flags) ? + "HDRS" : "FULL"); + bufp += strlen(bufp); } } @@ -529,11 +531,11 @@ smtprcpt(to, m, mci, e) ENVELOPE *e; { register int r; - int l; + char *bufp; char optbuf[MAXLINE]; strcpy(optbuf, ""); - l = sizeof optbuf - 1; + bufp = &optbuf[strlen(optbuf)]; if (bitset(MCIF_DSN, mci->mci_flags)) { /* NOTIFY= parameter */ @@ -543,37 +545,38 @@ smtprcpt(to, m, mci, e) { bool firstone = TRUE; - strcat(optbuf, " NOTIFY="); + strcat(bufp, " NOTIFY="); if (bitset(QPINGONSUCCESS, to->q_flags)) { - strcat(optbuf, "SUCCESS"); + strcat(bufp, "SUCCESS"); firstone = FALSE; } if (bitset(QPINGONFAILURE, to->q_flags)) { if (!firstone) - strcat(optbuf, ","); - strcat(optbuf, "FAILURE"); + strcat(bufp, ","); + strcat(bufp, "FAILURE"); firstone = FALSE; } if (bitset(QPINGONDELAY, to->q_flags)) { if (!firstone) - strcat(optbuf, ","); - strcat(optbuf, "DELAY"); + strcat(bufp, ","); + strcat(bufp, "DELAY"); firstone = FALSE; } if (firstone) - strcat(optbuf, "NEVER"); - l -= strlen(optbuf); + strcat(bufp, "NEVER"); + bufp += strlen(bufp); } /* ORCPT= parameter */ - if (to->q_orcpt != NULL && strlen(to->q_orcpt) + 7 < l) + if (to->q_orcpt != NULL && + SPACELEFT(optbuf, bufp) > strlen(to->q_orcpt) + 7) { - strcat(optbuf, " ORCPT="); - strcat(optbuf, to->q_orcpt); - l -= strlen(optbuf); + snprintf(bufp, SPACELEFT(optbuf, bufp), + " ORCPT=%s", to->q_orcpt); + bufp += strlen(bufp); } } @@ -673,7 +676,7 @@ smtpdata(m, mci, e) smtprset(m, mci, e); return EX_UNAVAILABLE; } - else if (r != 354) + else if (REPLYTYPE(r) != 3) { if (LogLevel > 1) { @@ -713,7 +716,7 @@ smtpdata(m, mci, e) ** Output the actual message. */ - (*e->e_puthdr)(mci, e->e_header, e); + (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER); (*e->e_putbody)(mci, e, NULL); /* diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c index 785d362..0cb8992 100644 --- a/contrib/sendmail/src/util.c +++ b/contrib/sendmail/src/util.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)util.c 8.167 (Berkeley) 12/1/1998"; +static char sccsid[] = "@(#)util.c 8.168 (Berkeley) 1/21/1999"; #endif /* not lint */ # include "sendmail.h" @@ -1026,6 +1026,7 @@ sfgets(buf, siz, fp, timeout, during) { register EVENT *ev = NULL; register char *p; + int save_errno; if (fp == NULL) { @@ -1043,7 +1044,6 @@ sfgets(buf, siz, fp, timeout, during) "timeout waiting for input from %.100s during %s", CurHostName ? CurHostName : "local", during); - errno = 0; buf[0] = '\0'; #if XDEBUG checkfd012(during); @@ -1051,6 +1051,7 @@ sfgets(buf, siz, fp, timeout, during) if (TrafficLogFile != NULL) fprintf(TrafficLogFile, "%05d <<< [TIMEOUT]\n", (int) getpid()); + errno = 0; return (NULL); } ev = setevent(timeout, readtimeout, 0); @@ -1058,6 +1059,7 @@ sfgets(buf, siz, fp, timeout, during) /* try to read */ p = NULL; + errno = 0; while (!feof(fp) && !ferror(fp)) { errno = 0; @@ -1066,6 +1068,7 @@ sfgets(buf, siz, fp, timeout, during) break; clearerr(fp); } + save_errno = errno; /* clear the event if it has not sprung */ clrevent(ev); @@ -1077,6 +1080,7 @@ sfgets(buf, siz, fp, timeout, during) buf[0] = '\0'; if (TrafficLogFile != NULL) fprintf(TrafficLogFile, "%05d <<< [EOF]\n", (int) getpid()); + errno = save_errno; return (NULL); } if (TrafficLogFile != NULL) diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c index 8e8707b..6f9d05e 100644 --- a/contrib/sendmail/src/version.c +++ b/contrib/sendmail/src/version.c @@ -11,7 +11,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)version.c 8.9.2.1 (Berkeley) 12/29/1998"; +static char sccsid[] = "@(#)version.c 8.9.3.1 (Berkeley) 2/4/1999"; #endif /* not lint */ -char Version[] = "8.9.2"; +char Version[] = "8.9.3"; |