diff options
author | gshapiro <gshapiro@FreeBSD.org> | 2001-02-28 00:19:57 +0000 |
---|---|---|
committer | gshapiro <gshapiro@FreeBSD.org> | 2001-02-28 00:19:57 +0000 |
commit | e4882e48c06ee9963c8275992cd9767a29e01c05 (patch) | |
tree | 931d99d3910ebafc6a747029ff208f01292f5d8b /contrib/sendmail/src | |
parent | 2143eb84286d79cdfaa711372954774a827fee31 (diff) | |
parent | 8d82727087db5182be90a20f20175cc720c5d1e5 (diff) | |
download | FreeBSD-src-e4882e48c06ee9963c8275992cd9767a29e01c05.zip FreeBSD-src-e4882e48c06ee9963c8275992cd9767a29e01c05.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r73188,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/sendmail/src')
24 files changed, 471 insertions, 168 deletions
diff --git a/contrib/sendmail/src/README b/contrib/sendmail/src/README index e4e62a1..fc8917a 100644 --- a/contrib/sendmail/src/README +++ b/contrib/sendmail/src/README @@ -1,4 +1,4 @@ -# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. +# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. # All rights reserved. # Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. # Copyright (c) 1988 @@ -9,7 +9,7 @@ # the sendmail distribution. # # -# $Id: README,v 8.263.2.1.2.27 2000/12/16 16:46:02 gshapiro Exp $ +# $Id: README,v 8.263.2.1.2.32 2001/01/29 23:45:22 gshapiro Exp $ # This directory contains the source files for sendmail(TM). @@ -631,9 +631,10 @@ YOU HEADACHES! When attempting to canonify a hostname, some broken name servers will return SERVFAIL (a temporary failure) on T_AAAA (IPv6) lookups. If you want to excuse this behavior, compile sendmail with --D_FFR_WORKAROUND_BROKEN_NAMESERVERS. However, instead, we recommend catching -the problem and reporting it to the name server administrator so we can rid -the world of broken name servers. +-D_FFR_WORKAROUND_BROKEN_NAMESERVERS and add WorkAroundBrokenAAAA to your +ResolverOptions setting. However, instead, we recommend catching the +problem and reporting it to the name server administrator so we can rid the +world of broken name servers. +----------------------------------------+ | STARTTLS COMPILATION AND CONFIGURATION | @@ -1038,6 +1039,12 @@ IRIX 6.x If you are using XFS filesystem, avoid using the -32 ABI switch to the cc compiler if possible. + Broken inet_aton and inet_ntoa on IRIX using gcc: There's + a problem with gcc on IRIX, i.e., gcc can't pass structs + less than 16 bits long unless they are 8 bits; IRIX 6.2 has + some other sized structs. See + http://www.bitmechanic.com/mail-archives/mysql/current/0418.html + IRIX 6.4 The IRIX 6.5.4 version of /bin/m4 does not work properly with sendmail. Either install fw_m4.sw.m4 off the Freeware_May99 CD and @@ -1096,8 +1103,10 @@ BSDI (BSD/386) 1.0, NetBSD 0.9, FreeBSD 1.0 determined to continue to use your old, buggy version (or as a shortcut to get sendmail working -- I'm sure you have the best intentions to port a modern version of BIND), you can - copy ../contrib/oldbind.compat.c into sendmail and add - oldbind.compat.o to OBJADD in the Makefile. + copy ../contrib/oldbind.compat.c into sendmail and add the + following to devtools/Site/site.config.m4: + + APPENDDEF(`confOBJADD', `oldbind.compat.o') A/UX Date: Tue, 12 Oct 1993 18:28:28 -0400 (EDT) @@ -1236,6 +1245,17 @@ Linux "#include <syslog.h>" to the SFIO version of stdio.h as the very first line. +glibc + glibc 2.2.1 (and possibly other versions) changed the value of + __RES in resolv.h but failed to actually provide the IPv6 API + changes that the change implied. Therefore, compiling with + -DNETINET6 fails. + + Workarounds: + 1) Compile without -DNETINET6 + 2) Build against a real BIND 8.2.2 include/lib tree + 3) Wait for glibc to fix it + AIX 4.X The AIX 4.X linker uses library paths specified during compilation using -L for run-time shared library searches. Therefore, it is @@ -1268,7 +1288,7 @@ AIX 4.3.3 Workarounds: 1) Compile without -DNETINET6 - 2) Build against a real Bind 8.2.2 include/lib tree + 2) Build against a real BIND 8.2.2 include/lib tree 3) Wait for IBM to fix it AIX 4.X @@ -1668,4 +1688,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.263.2.1.2.27 $, last update $Date: 2000/12/16 16:46:02 $ ) +(Version $Revision: 8.263.2.1.2.32 $, last update $Date: 2001/01/29 23:45:22 $ ) diff --git a/contrib/sendmail/src/bf.h b/contrib/sendmail/src/bf.h index d7d6303..8fc86ae 100644 --- a/contrib/sendmail/src/bf.h +++ b/contrib/sendmail/src/bf.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 1999 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999, 2001 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: bf.h,v 8.5 1999/11/04 19:31:25 ca Exp $ + * $Id: bf.h,v 8.5.16.2 2001/02/14 04:07:27 gshapiro Exp $ * * Contributed by Exactis.com, Inc. * @@ -20,6 +20,7 @@ extern FILE *bfdup __P((FILE *)); extern int bfcommit __P((FILE *)); extern int bfrewind __P((FILE *)); extern int bftruncate __P((FILE *)); +extern int bffsync __P((FILE *)); extern int bfclose __P((FILE *)); extern bool bftest __P((FILE *)); diff --git a/contrib/sendmail/src/bf_portable.c b/contrib/sendmail/src/bf_portable.c index 4de0af3..3c09cec 100644 --- a/contrib/sendmail/src/bf_portable.c +++ b/contrib/sendmail/src/bf_portable.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -11,7 +11,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: bf_portable.c,v 8.25.4.3 2000/06/29 21:21:58 gshapiro Exp $"; +static char id[] = "@(#)$Id: bf_portable.c,v 8.25.4.5 2001/02/14 04:07:27 gshapiro Exp $"; #endif /* ! lint */ #if SFIO @@ -283,6 +283,47 @@ bftruncate(fp) } /* +** BFFSYNC -- fsync the fd associated with the FILE * +** +** Parameters: +** fp -- FILE * to fsync +** +** Returns: +** 0 on success, -1 on error +** +** Sets errno: +** EINVAL if FILE * not bfcommitted yet. +** any value of errno specified by fsync() +*/ + +int +bffsync(fp) + FILE *fp; +{ + int fd; + struct bf *bfp; + + /* Get associated bf structure */ + bfp = bflookup(fp); + + /* If called on a normal FILE *, noop */ + if (bfp != NULL && !bfp->bf_committed) + fd = -1; + else + fd = fileno(fp); + + if (tTd(58, 10)) + dprintf("bffsync: fd = %d\n", fd); + + if (fd < 0) + { + errno = EINVAL; + return -1; + } + return fsync(fd); +} + +/* ** BFCLOSE -- close a buffered file ** ** Parameters: diff --git a/contrib/sendmail/src/bf_torek.c b/contrib/sendmail/src/bf_torek.c index ab129d4..d58abc9 100644 --- a/contrib/sendmail/src/bf_torek.c +++ b/contrib/sendmail/src/bf_torek.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -11,7 +11,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: bf_torek.c,v 8.19.18.2 2000/09/17 17:04:26 gshapiro Exp $"; +static char id[] = "@(#)$Id: bf_torek.c,v 8.19.18.4 2001/02/14 04:07:27 gshapiro Exp $"; #endif /* ! lint */ #if SFIO @@ -381,6 +381,51 @@ bftruncate(fp) } /* +** BFFSYNC -- fsync the fd associated with the FILE * +** +** Parameters: +** fp -- FILE * to fsync +** +** Returns: +** 0 on success, -1 on error +** +** Sets errno: +** EINVAL if FILE * not bfcommitted yet. +** any value of errno specified by fsync() +*/ + +int +bffsync(fp) + FILE *fp; +{ + int fd; + struct bf *bfp; + + if (bftest(fp)) + { + /* Get bf structure */ + bfp = (struct bf *)fp->_cookie; + + if (bfp->bf_ondisk && bfp->bf_committed) + fd = bfp->bf_disk_fd; + else + fd = -1; + } + else + fd = fileno(fp); + + if (tTd(58, 10)) + dprintf("bffsync: fd = %d\n", fd); + + if (fd < 0) + { + errno = EINVAL; + return -1; + } + return fsync(fd); +} + +/* ** BFCLOSE -- close a buffered file ** ** Parameters: diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c index c6c5f78..d1c7f1c 100644 --- a/contrib/sendmail/src/collect.c +++ b/contrib/sendmail/src/collect.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: collect.c,v 8.136.4.8 2000/10/09 00:50:04 gshapiro Exp $"; +static char id[] = "@(#)$Id: collect.c,v 8.136.4.15 2001/02/21 01:05:59 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -84,7 +84,6 @@ collect(fp, smtpmode, hdrp, e) volatile int hdrslen = 0; volatile int numhdrs = 0; volatile int dfd; - volatile int afd; volatile int rstat = EX_OK; u_char *volatile pbp; u_char peekbuf[8]; @@ -102,6 +101,8 @@ collect(fp, smtpmode, hdrp, e) if (!headeronly) { struct stat stbuf; + long sff = SFF_OPENASROOT; + (void) strlcpy(dfname, queuename(e, 'd'), sizeof dfname); #if _FFR_QUEUE_FILE_MODE @@ -110,18 +111,21 @@ collect(fp, smtpmode, hdrp, e) if (bitset(S_IWGRP, QueueFileMode)) oldumask = umask(002); - df = bfopen(dfname, QueueFileMode, DataFileBufferSize, - SFF_OPENASROOT); + df = bfopen(dfname, QueueFileMode, + DataFileBufferSize, sff); if (bitset(S_IWGRP, QueueFileMode)) (void) umask(oldumask); } #else /* _FFR_QUEUE_FILE_MODE */ - df = bfopen(dfname, FileMode, DataFileBufferSize, - SFF_OPENASROOT); + df = bfopen(dfname, FileMode, DataFileBufferSize, sff); #endif /* _FFR_QUEUE_FILE_MODE */ if (df == NULL) { - syserr("Cannot create %s", dfname); + HoldErrs = FALSE; + if (smtpmode) + syserr("421 4.3.5 Unable to create data file"); + else + syserr("Cannot create %s", dfname); e->e_flags |= EF_NO_BODY_RETN; finis(TRUE, ExitStat); /* NOTREACHED */ @@ -346,8 +350,9 @@ bufferchar: else if (c != '\0') { *bp++ = c; + hdrslen++; if (MaxHeadersLength > 0 && - ++hdrslen > MaxHeadersLength) + hdrslen > MaxHeadersLength) { sm_syslog(LOG_NOTICE, e->e_id, "headers too large (%d max) from %s during message collect", @@ -496,13 +501,6 @@ readerr: /* skip next few clauses */ /* EMPTY */ } - else if ((afd = fileno(df)) >= 0 && fsync(afd) < 0) - { - dferror(df, "fsync", e); - flush_errors(TRUE); - finis(TRUE, ExitStat); - /* NOTREACHED */ - } else if (bfcommit(df) < 0) { int save_errno = errno; @@ -527,6 +525,13 @@ readerr: flush_errors(TRUE); finis(save_errno != EEXIST, ExitStat); } + else if (bffsync(df) < 0) + { + dferror(df, "bffsync", e); + flush_errors(TRUE); + finis(TRUE, ExitStat); + /* NOTREACHED */ + } else if (bfclose(df) < 0) { dferror(df, "bfclose", e); diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c index dda2761..95506ab 100644 --- a/contrib/sendmail/src/control.c +++ b/contrib/sendmail/src/control.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -9,7 +9,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: control.c,v 8.44.14.13 2000/12/28 21:25:52 gshapiro Exp $"; +static char id[] = "@(#)$Id: control.c,v 8.44.14.15 2001/01/22 19:00:22 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c index e29d774..f4b07d4 100644 --- a/contrib/sendmail/src/daemon.c +++ b/contrib/sendmail/src/daemon.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -16,9 +16,9 @@ #ifndef lint # ifdef DAEMON -static char id[] = "@(#)$Id: daemon.c,v 8.401.4.41 2000/12/28 23:46:43 gshapiro Exp $ (with daemon mode)"; +static char id[] = "@(#)$Id: daemon.c,v 8.401.4.51 2001/02/23 18:57:27 geir Exp $ (with daemon mode)"; # else /* DAEMON */ -static char id[] = "@(#)$Id: daemon.c,v 8.401.4.41 2000/12/28 23:46:43 gshapiro Exp $ (without daemon mode)"; +static char id[] = "@(#)$Id: daemon.c,v 8.401.4.51 2001/02/23 18:57:27 geir Exp $ (without daemon mode)"; # endif /* DAEMON */ #endif /* ! lint */ @@ -461,9 +461,29 @@ getrequests(e) FD_ISSET(Daemons[idx].d_socket, &readfds)) { lotherend = Daemons[idx].d_socksize; + memset(&RealHostAddr, '\0', + sizeof RealHostAddr); t = accept(Daemons[idx].d_socket, (struct sockaddr *)&RealHostAddr, &lotherend); + + /* + ** If remote side closes before + ** accept() finishes, sockaddr + ** might not be fully filled in. + */ + + if (t >= 0 && + (lotherend == 0 || +# ifdef BSD4_4_SOCKADDR + RealHostAddr.sa.sa_len == 0 || +# endif /* BSD4_4_SOCKADDR */ + RealHostAddr.sa.sa_family != Daemons[idx].d_addr.sa.sa_family)) + { + (void) close(t); + t = -1; + errno = EINVAL; + } olddaemon = curdaemon = idx; break; } @@ -477,10 +497,30 @@ getrequests(e) struct sockaddr_un sa_un; lotherend = sizeof sa_un; + memset(&sa_un, '\0', sizeof sa_un); t = accept(ControlSocket, (struct sockaddr *)&sa_un, &lotherend); - control = TRUE; + + /* + ** If remote side closes before + ** accept() finishes, sockaddr + ** might not be fully filled in. + */ + + if (t >= 0 && + (lotherend == 0 || +# ifdef BSD4_4_SOCKADDR + sa_un.sun_len == 0 || +# endif /* BSD4_4_SOCKADDR */ + sa_un.sun_family != AF_UNIX)) + { + (void) close(t); + t = -1; + errno = EINVAL; + } + if (t >= 0) + control = TRUE; } # else /* NETUNIX */ if (curdaemon == -1) @@ -1614,7 +1654,8 @@ makeconnection(host, port, mci, e) /* Set up the address for outgoing connection. */ if (bitnset(D_BINDIF, d_flags) && - (p = macvalue(macid("{if_addr}", NULL), e)) != NULL) + (p = macvalue(macid("{if_addr}", NULL), e)) != NULL && + *p != '\0') { # if NETINET6 char p6[INET6_ADDRSTRLEN]; @@ -1628,18 +1669,13 @@ makeconnection(host, port, mci, e) { # if NETINET case AF_INET: - if ((clt_addr.sin.sin_addr.s_addr = inet_addr(p)) - != INADDR_NONE) + clt_addr.sin.sin_addr.s_addr = inet_addr(p); + if (clt_addr.sin.sin_addr.s_addr != INADDR_NONE && + clt_addr.sin.sin_addr.s_addr != INADDR_LOOPBACK) { clt_bind = TRUE; socksize = sizeof (struct sockaddr_in); } - else if (clt_addr.sin.sin_port != 0) - { - clt_addr.sin.sin_addr.s_addr = INADDR_ANY; - clt_bind = TRUE; - socksize = sizeof (struct sockaddr_in); - } break; # endif /* NETINET */ @@ -1650,15 +1686,9 @@ makeconnection(host, port, mci, e) else strlcpy(p6, p, sizeof p6); if (inet_pton(AF_INET6, p6, - &clt_addr.sin6.sin6_addr) == 1) - { - clt_bind = TRUE; - socksize = sizeof (struct sockaddr_in6); - } - else if (clt_addr.sin6.sin6_port != 0) + &clt_addr.sin6.sin6_addr) == 1 && + !IN6_IS_ADDR_LOOPBACK(&clt_addr.sin6.sin6_addr)) { - if (IN6_IS_ADDR_UNSPECIFIED(&clt_addr.sin6.sin6_addr)) - clt_addr.sin6.sin6_addr = in6addr_any; clt_bind = TRUE; socksize = sizeof (struct sockaddr_in6); } @@ -1721,7 +1751,7 @@ makeconnection(host, port, mci, e) */ # if NAMED_BIND - h_errno = 0; + SM_SET_H_ERRNO(0); # endif /* NAMED_BIND */ errno = 0; memset(&CurHostAddr, '\0', sizeof CurHostAddr); @@ -2396,10 +2426,8 @@ myhostname(hostbuf, size) { register struct hostent *hp; - if (gethostname(hostbuf, size) < 0) - { + if (gethostname(hostbuf, size) < 0 || hostbuf[0] == '\0') (void) strlcpy(hostbuf, "localhost", size); - } hp = sm_gethostbyname(hostbuf, InetMode); if (hp == NULL) return NULL; @@ -3045,7 +3073,7 @@ host_map_lookup(map, name, av, statp) : s->s_namecanon.nc_cname); errno = s->s_namecanon.nc_errno; # if NAMED_BIND - h_errno = s->s_namecanon.nc_herrno; + SM_SET_H_ERRNO(s->s_namecanon.nc_herrno); # endif /* NAMED_BIND */ *statp = s->s_namecanon.nc_stat; if (*statp == EX_TEMPFAIL) @@ -3221,6 +3249,8 @@ myhostname(hostbuf, size) fixcrlf(hostbuf, TRUE); (void) fclose(f); } + if (hostbuf[0] == '\0') + (void) strlcpy(hostbuf, "localhost", size); return NULL; } /* diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c index 440b1db..689ceeb 100644 --- a/contrib/sendmail/src/deliver.c +++ b/contrib/sendmail/src/deliver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.56 2000/12/19 01:16:12 gshapiro Exp $"; +static char id[] = "@(#)$Id: deliver.c,v 8.600.2.1.2.66 2001/02/25 23:30:35 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -1132,7 +1132,7 @@ deliver(e, firstto) if (*mvp == NULL) { - /* running SMTP */ + /* running LMTP or SMTP */ #if SMTP clever = TRUE; *pvp = NULL; @@ -1142,6 +1142,14 @@ deliver(e, firstto) return EX_SOFTWARE; #endif /* SMTP */ } + else if (bitnset(M_LMTP, m->m_flags)) + { + /* not running LMTP */ + sm_syslog(LOG_ERR, NULL, + "Warning: mailer %s: LMTP flag (F=z) turned off", + m->m_name); + clrbitn(M_LMTP, m->m_flags); + } /* ** At this point *mvp points to the argument with $u. We @@ -1235,7 +1243,7 @@ deliver(e, firstto) continue; } #if NAMED_BIND - h_errno = 0; + SM_SET_H_ERRNO(0); #endif /* NAMED_BIND */ ovr = TRUE; @@ -1498,7 +1506,7 @@ deliver(e, firstto) } errno = 0; #if NAMED_BIND - h_errno = 0; + SM_SET_H_ERRNO(0); #endif /* NAMED_BIND */ CurHostName = NULL; @@ -2267,7 +2275,7 @@ reconnect: /* after switching to an authenticated connection */ !DONE_STARTTLS(mci->mci_flags)) { int olderrors; - bool hasdot; + int dotpos; bool usetls; bool saveQuickAbort = QuickAbort; bool saveSuprErrs = SuprErrs; @@ -2275,6 +2283,7 @@ reconnect: /* after switching to an authenticated connection */ # if _FFR_TLS_CLT1 char *p; # endif /* _FFR_TLS_CLT1 */ + char *srvname; extern SOCKADDR CurHostAddr; rcode = EX_OK; @@ -2296,11 +2305,25 @@ reconnect: /* after switching to an authenticated connection */ } # endif /* _FFR_TLS_CLT1 */ - hasdot = CurHostName[strlen(CurHostName) - 1] == '.'; - if (hasdot) - CurHostName[strlen(CurHostName) - 1] = '\0'; + if (mci->mci_host != NULL) + { + srvname = mci->mci_host; + dotpos = strlen(srvname) - 1; + if (dotpos >= 0) + { + if (srvname[dotpos] == '.') + srvname[dotpos] = '\0'; + else + dotpos = -1; + } + } + else + { + srvname = ""; + dotpos = -1; + } define(macid("{server_name}", NULL), - newstr(CurHostName), e); + newstr(srvname), e); if (CurHostAddr.sa.sa_family != 0) define(macid("{server_addr}", NULL), newstr(anynet_ntoa(&CurHostAddr)), e); @@ -2314,7 +2337,7 @@ reconnect: /* after switching to an authenticated connection */ olderrors = Errors; QuickAbort = FALSE; SuprErrs = TRUE; - if (rscheck("try_tls", CurHostName, NULL, + if (rscheck("try_tls", srvname, NULL, e, TRUE, FALSE, 8, host) != EX_OK || Errors > olderrors) usetls = FALSE; @@ -2323,9 +2346,9 @@ reconnect: /* after switching to an authenticated connection */ # endif /* _FFR_TLS_O_T */ } - /* undo change of CurHostName */ - if (hasdot) - CurHostName[strlen(CurHostName)] = '.'; + /* undo change of srvname */ + if (dotpos >= 0) + srvname[dotpos] = '.'; if (usetls) { if ((rcode = starttls(m, mci, e)) == EX_OK) @@ -2562,7 +2585,7 @@ do_transfer: rcode = mci->mci_exitstat; errno = mci->mci_errno; #if NAMED_BIND - h_errno = mci->mci_herrno; + SM_SET_H_ERRNO(mci->mci_herrno); #endif /* NAMED_BIND */ if (rcode == EX_OK) { @@ -2593,6 +2616,18 @@ do_transfer: /* get the exit status */ rcode = endmailer(mci, e, pv); + if (rcode == EX_TEMPFAIL && + SmtpError[0] == '\0') + { + /* + ** Need an e_message for mailq display. + ** We set SmtpError as + */ + + snprintf(SmtpError, sizeof SmtpError, + "%s mailer (%s) exited with EX_TEMPFAIL", + m->m_name, m->m_mailer); + } } else #if SMTP @@ -3345,7 +3380,7 @@ giveresponse(status, dsn, m, mci, ctladdr, xstart, e) } errno = 0; #if NAMED_BIND - h_errno = 0; + SM_SET_H_ERRNO(0); #endif /* NAMED_BIND */ } /* @@ -5228,6 +5263,8 @@ endtls(ssl, side) SSL *ssl; char *side; { + int ret = EX_OK; + if (ssl != NULL) { int r; @@ -5238,7 +5275,7 @@ endtls(ssl, side) sm_syslog(LOG_WARNING, NOQID, "SSL_shutdown %s failed: %d", side, r); - return EX_SOFTWARE; + ret = EX_SOFTWARE; } else if (r == 0) { @@ -5246,12 +5283,12 @@ endtls(ssl, side) sm_syslog(LOG_WARNING, NOQID, "SSL_shutdown %s not done", side); - return EX_SOFTWARE; + ret = EX_SOFTWARE; } SSL_free(ssl); ssl = NULL; } - return EX_OK; + return ret; } # endif /* STARTTLS */ #endif /* SMTP */ diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c index 39126dd..18a092b 100644 --- a/contrib/sendmail/src/domain.c +++ b/contrib/sendmail/src/domain.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1986, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -15,9 +15,9 @@ #ifndef lint # if NAMED_BIND -static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (with name server)"; +static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.8 2001/02/12 21:40:19 gshapiro Exp $ (with name server)"; # else /* NAMED_BIND */ -static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.6 2000/12/19 02:50:33 gshapiro Exp $ (without name server)"; +static char id[] = "@(#)$Id: domain.c,v 8.114.6.1.2.8 2001/02/12 21:40:19 gshapiro Exp $ (without name server)"; # endif /* NAMED_BIND */ #endif /* ! lint */ @@ -356,7 +356,7 @@ punt: if (TryNullMXList) { - h_errno = 0; + SM_SET_H_ERRNO(0); errno = 0; h = sm_gethostbyname(host, AF_INET); if (h == NULL) @@ -370,7 +370,7 @@ punt: return -1; } # if NETINET6 - h_errno = 0; + SM_SET_H_ERRNO(0); errno = 0; h = sm_gethostbyname(host, AF_INET6); if (h == NULL && @@ -752,7 +752,7 @@ cnameloop: ** broken. */ - h_errno = TRY_AGAIN; + SM_SET_H_ERRNO(TRY_AGAIN); *statp = EX_TEMPFAIL; /* @@ -769,18 +769,22 @@ cnameloop: */ #if _FFR_WORKAROUND_BROKEN_NAMESERVERS - /* - ** Only return if not TRY_AGAIN as an - ** attempt with a different qtype may - ** succeed (res_querydomain() calls - ** res_query() calls res_send() which - ** sets errno to ETIMEDOUT if the - ** nameservers could be contacted but - ** didn't give an answer). - */ + if (WorkAroundBrokenAAAA) + { + /* + ** Only return if not TRY_AGAIN as an + ** attempt with a different qtype may + ** succeed (res_querydomain() calls + ** res_query() calls res_send() which + ** sets errno to ETIMEDOUT if the + ** nameservers could be contacted but + ** didn't give an answer). + */ - if (qtype != T_ANY && errno != ETIMEDOUT) - return FALSE; + if (qtype != T_ANY && + errno != ETIMEDOUT) + return FALSE; + } #else /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */ if (qtype != T_ANY) return FALSE; @@ -931,7 +935,7 @@ cnameloop: host); CurEnv->e_message = newstr(ebuf); } - h_errno = NO_RECOVERY; + SM_SET_H_ERRNO(NO_RECOVERY); *statp = EX_CONFIG; return FALSE; } diff --git a/contrib/sendmail/src/macro.c b/contrib/sendmail/src/macro.c index 1a32182..70e18e4 100644 --- a/contrib/sendmail/src/macro.c +++ b/contrib/sendmail/src/macro.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: macro.c,v 8.40.16.7 2000/10/09 15:49:06 gshapiro Exp $"; +static char id[] = "@(#)$Id: macro.c,v 8.40.16.9 2001/02/22 01:16:55 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -295,6 +295,8 @@ macvalue(n, e) if (p != NULL) return p; + if (e == e->e_parent) + break; e = e->e_parent; } return NULL; diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c index 5097b58..bf976e0 100644 --- a/contrib/sendmail/src/main.c +++ b/contrib/sendmail/src/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 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 @@ #ifndef lint static char copyright[] = -"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\ +"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\ All rights reserved.\n\ Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.\n\ Copyright (c) 1988, 1993\n\ @@ -21,7 +21,7 @@ static char copyright[] = #endif /* ! lint */ #ifndef lint -static char id[] = "@(#)$Id: main.c,v 8.485.4.38 2000/12/19 02:50:33 gshapiro Exp $"; +static char id[] = "@(#)$Id: main.c,v 8.485.4.44 2001/02/08 14:06:55 ca Exp $"; #endif /* ! lint */ #define _DEFINE @@ -1062,7 +1062,8 @@ main(argc, argv, envp) /* set up the $=m class now, after .cf has a chance to redefine $m */ expand("\201m", jbuf, sizeof jbuf, CurEnv); - setclass('m', jbuf); + if (jbuf[0] != '\0') + setclass('m', jbuf); /* probe interfaces and locate any additional names */ if (!DontProbeInterfaces) @@ -1231,8 +1232,10 @@ main(argc, argv, envp) /* full names can't have newlines */ if (strchr(FullName, '\n') != NULL) { - FullName = full = newstr(denlstring(FullName, TRUE, TRUE)); + full = newstr(denlstring(FullName, TRUE, TRUE)); + FullName = full; } + /* check for characters that may have to be quoted */ if (!rfc822_string(FullName)) { @@ -1241,6 +1244,7 @@ main(argc, argv, envp) ** as a comment so crackaddr() doesn't destroy ** the name portion of the address. */ + FullName = addquotes(FullName); if (full != NULL) free(full); @@ -1295,10 +1299,13 @@ main(argc, argv, envp) /* our name for SMTP codes */ expand("\201j", jbuf, sizeof jbuf, CurEnv); - MyHostName = jbuf; - if (strchr(jbuf, '.') == NULL) + if (jbuf[0] == '\0') + MyHostName = newstr("localhost"); + else + MyHostName = jbuf; + if (strchr(MyHostName, '.') == NULL) message("WARNING: local host name (%s) is not qualified; fix $j in config file", - jbuf); + MyHostName); /* make certain that this name is part of the $=w class */ setclass('w', MyHostName); @@ -1855,7 +1862,7 @@ main(argc, argv, envp) } else p = newstr(fv); - CurEnv->e_auth_param = newstr(xtextify(p, NULL)); + CurEnv->e_auth_param = newstr(xtextify(p, "=")); } } if (macvalue('s', CurEnv) == NULL) @@ -1866,6 +1873,7 @@ main(argc, argv, envp) CurEnv->e_to = NULL; CurEnv->e_flags |= EF_GLOBALERRS; HoldErrs = FALSE; + SuperSafe = FALSE; usrerr("Recipient names must be specified"); /* collect body for UUCP return */ diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c index 8fb0cfd..4a10c81 100644 --- a/contrib/sendmail/src/map.c +++ b/contrib/sendmail/src/map.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1992, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: map.c,v 8.414.4.34 2000/12/18 18:00:43 ca Exp $"; +static char id[] = "@(#)$Id: map.c,v 8.414.4.39 2001/02/22 18:56:22 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -52,7 +52,7 @@ static bool db_map_open __P((MAP *, int, char *, DBTYPE, DB_INFO *)); static bool db_map_open __P((MAP *, int, char *, DBTYPE, void **)); # endif /* DB_VERSION_MAJOR > 2 */ #endif /* NEWDB */ -static bool extract_canonname __P((char *, char *, char[], int)); +static bool extract_canonname __P((char *, char *, char *, char[], int)); #ifdef LDAPMAP static void ldapmap_clear __P((LDAPMAP_STRUCT *)); static STAB *ldapmap_findconn __P((LDAPMAP_STRUCT *)); @@ -767,11 +767,10 @@ getcanonname(host, hbsize, trymx) #if NAMED_BIND if (got_tempfail) - h_errno = TRY_AGAIN; + SM_SET_H_ERRNO(TRY_AGAIN); else - h_errno = HOST_NOT_FOUND; + SM_SET_H_ERRNO(HOST_NOT_FOUND); #endif /* NAMED_BIND */ - return FALSE; } /* @@ -779,6 +778,7 @@ getcanonname(host, hbsize, trymx) ** ** Parameters: ** name -- the name against which to match. +** dot -- where to reinsert '.' to get FQDN ** line -- the /etc/hosts line. ** cbuf -- the location to store the result. ** cbuflen -- the size of cbuf. @@ -789,8 +789,9 @@ getcanonname(host, hbsize, trymx) */ static bool -extract_canonname(name, line, cbuf, cbuflen) +extract_canonname(name, dot, line, cbuf, cbuflen) char *name; + char *dot; char *line; char cbuf[]; int cbuflen; @@ -819,6 +820,14 @@ extract_canonname(name, line, cbuf, cbuflen) } if (strcasecmp(name, p) == 0) found = TRUE; + else if (dot != NULL) + { + /* try looking for the FQDN as well */ + *dot = '.'; + if (strcasecmp(name, p) == 0) + found = TRUE; + *dot = '\0'; + } } if (found && strchr(cbuf, '.') == NULL) { @@ -1623,6 +1632,10 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) ret = db->open(db, buf, NULL, dbtype, flags, DBMMODE); if (ret != 0) { +#ifdef DB_OLD_VERSION + if (ret == DB_OLD_VERSION) + ret = EINVAL; +#endif /* DB_OLD_VERSION */ (void) db->close(db, 0); db = NULL; } @@ -2258,7 +2271,7 @@ nis_getcanonname(name, hbsize, statp) *statp = EX_UNAVAILABLE; return FALSE; } - shorten_hostname(nbuf); + (void) shorten_hostname(nbuf); keylen = strlen(nbuf); if (yp_domain == NULL) @@ -2302,13 +2315,13 @@ nis_getcanonname(name, hbsize, statp) free(vp); if (tTd(38, 44)) dprintf("got record `%s'\n", host_record); - if (!extract_canonname(nbuf, host_record, cbuf, sizeof cbuf)) + if (!extract_canonname(nbuf, NULL, host_record, cbuf, sizeof cbuf)) { /* this should not happen, but.... */ *statp = EX_NOHOST; return FALSE; } - if (hbsize < strlen(cbuf)) + if (hbsize <= strlen(cbuf)) { *statp = EX_UNAVAILABLE; return FALSE; @@ -2639,7 +2652,7 @@ nisplus_getcanonname(name, hbsize, statp) return FALSE; } (void) strlcpy(nbuf, name, sizeof nbuf); - shorten_hostname(nbuf); + (void) shorten_hostname(nbuf); p = strchr(nbuf, '.'); if (p == NULL) @@ -3937,7 +3950,7 @@ ldapmap_parseargs(map, args) if ((ptr = strchr(p, ' ')) != NULL) *ptr = '\0'; - syserr("Deref must be [never|always|search|find] not %s in map %s", + syserr("Deref must be [never|always|search|find] (not %s) in map %s", p, map->map_mname); if (ptr != NULL) *ptr = ' '; @@ -3972,7 +3985,7 @@ ldapmap_parseargs(map, args) if ((ptr = strchr(p, ' ')) != NULL) *ptr = '\0'; - syserr("Scope must be [base|one|sub] not %s in map %s", + syserr("Scope must be [base|one|sub] (not %s) in map %s", p, map->map_mname); if (ptr != NULL) *ptr = ' '; @@ -4044,7 +4057,7 @@ ldapmap_parseargs(map, args) if ((ptr = strchr(p, ' ')) != NULL) *ptr = '\0'; - syserr("Method for binding must be [none|simple|krbv4] not %s in map %s", + syserr("Method for binding must be [none|simple|krbv4] (not %s) in map %s", p, map->map_mname); if (ptr != NULL) *ptr = ' '; @@ -4312,6 +4325,7 @@ void ldapmap_set_defaults(spec) char *spec; { + STAB *class; MAP map; /* Allocate and set the default values */ @@ -4320,7 +4334,17 @@ ldapmap_set_defaults(spec) ldapmap_clear(LDAPDefaults); memset(&map, '\0', sizeof map); + + /* look up the class */ + class = stab("ldap", ST_MAPCLASS, ST_FIND); + if (class == NULL) + { + syserr("readcf: LDAPDefaultSpec: class ldap not available"); + return; + } + map.map_class = &class->s_mapclass; map.map_db1 = (ARBPTR_T) LDAPDefaults; + map.map_mname = "O LDAPDefaultSpec"; (void) ldapmap_parseargs(&map, spec); @@ -5412,7 +5436,7 @@ ni_getcanonname(name, hbsize, statp) *statp = EX_UNAVAILABLE; return FALSE; } - shorten_hostname(nbuf); + (void) shorten_hostname(nbuf); /* we only accept single token search key */ if (strchr(nbuf, '.')) @@ -5832,6 +5856,7 @@ text_getcanonname(name, hbsize, statp) int *statp; { bool found; + char *dot; FILE *f; char linebuf[MAXLINE]; char cbuf[MAXNAME + 1]; @@ -5846,7 +5871,7 @@ text_getcanonname(name, hbsize, statp) return FALSE; } (void) strlcpy(nbuf, name, sizeof nbuf); - shorten_hostname(nbuf); + dot = shorten_hostname(nbuf); f = fopen(HostsFile, "r"); if (f == NULL) @@ -5862,7 +5887,8 @@ text_getcanonname(name, hbsize, statp) if (p != NULL) *p = '\0'; if (linebuf[0] != '\0') - found = extract_canonname(nbuf, linebuf, cbuf, sizeof cbuf); + found = extract_canonname(nbuf, dot, linebuf, + cbuf, sizeof cbuf); } (void) fclose(f); if (!found) diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c index a248090..0698573 100644 --- a/contrib/sendmail/src/milter.c +++ b/contrib/sendmail/src/milter.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -9,7 +9,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: milter.c,v 8.50.4.41 2000/12/27 21:35:32 gshapiro Exp $"; +static char id[] = "@(#)$Id: milter.c,v 8.50.4.44 2001/01/23 19:43:57 gshapiro Exp $"; #endif /* ! lint */ #if _FFR_MILTER @@ -261,7 +261,7 @@ milter_sysread(m, buf, sz, to, e) } curl += len; - if (len == 0 || len >= sz) + if (len == 0 || curl >= sz) break; } @@ -1810,7 +1810,11 @@ milter_send_command(m, command, data, sz, e, state) case SMFIR_ACCEPT: /* this filter is done with message/connection */ - m->mf_state = SMFS_DONE; + if (command == SMFIC_HELO || + command == SMFIC_CONNECT) + m->mf_state = SMFS_CLOSABLE; + else + m->mf_state = SMFS_DONE; break; case SMFIR_CONTINUE: @@ -2092,7 +2096,7 @@ milter_per_connection_check(e) { struct milter *m = InputFilters[i]; - if (m->mf_state == SMFS_DONE) + if (m->mf_state == SMFS_CLOSABLE) milter_quit_filter(m, e); } } @@ -2936,11 +2940,31 @@ milter_helo(helo, e, state) ENVELOPE *e; char *state; { + int i; char *response; if (tTd(64, 10)) dprintf("milter_helo(%s)\n", helo); + /* HELO/EHLO can come after encryption is negotiated */ + for (i = 0; InputFilters[i] != NULL; i++) + { + struct milter *m = InputFilters[i]; + + switch (m->mf_state) + { + case SMFS_INMSG: + /* abort in message filters */ + milter_abort_filter(m, e); + /* FALLTHROUGH */ + + case SMFS_DONE: + /* reset done filters */ + m->mf_state = SMFS_OPEN; + break; + } + } + response = milter_command(SMFIC_HELO, helo, strlen(helo) + 1, MilterHeloMacros, e, state); milter_per_connection_check(e); diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c index fd4f34b..0a2d8ad 100644 --- a/contrib/sendmail/src/parseaddr.c +++ b/contrib/sendmail/src/parseaddr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.9 2000/10/09 03:14:48 gshapiro Exp $"; +static char id[] = "@(#)$Id: parseaddr.c,v 8.234.4.11 2001/02/14 04:07:27 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -2727,7 +2727,11 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host) MapOpenErr = FALSE; (void) rewrite(pvp, rsno, 0, e); if (MapOpenErr) - usrerrenh("4.3.0", "451 Temporary failure"); + { + usrerrenh("4.3.0", "451 Temporary failure"); + rstat = EX_TEMPFAIL; + goto finis; + } if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET || pvp[1] == NULL || (strcmp(pvp[1], "error") != 0 && diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c index 590aed9..f94498e 100644 --- a/contrib/sendmail/src/queue.c +++ b/contrib/sendmail/src/queue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -16,9 +16,9 @@ #ifndef lint # if QUEUE -static char id[] = "@(#)$Id: queue.c,v 8.343.4.38 2000/12/08 14:33:02 ca Exp $ (with queueing)"; +static char id[] = "@(#)$Id: queue.c,v 8.343.4.44 2001/02/22 00:55:35 ca Exp $ (with queueing)"; # else /* QUEUE */ -static char id[] = "@(#)$Id: queue.c,v 8.343.4.38 2000/12/08 14:33:02 ca Exp $ (without queueing)"; +static char id[] = "@(#)$Id: queue.c,v 8.343.4.44 2001/02/22 00:55:35 ca Exp $ (without queueing)"; # endif /* QUEUE */ #endif /* ! lint */ @@ -835,6 +835,7 @@ run_single_queue(queuedir, forkflag, verbose) CurEnv = &QueueEnvelope; e = newenvelope(&QueueEnvelope, CurEnv); e->e_flags = BlankEnvelope.e_flags; + e->e_parent = NULL; /* make sure we have disconnected from parent */ if (forkflag) @@ -1558,7 +1559,7 @@ workcmpf1(a, b) return b->w_lock - a->w_lock; /* job priority */ - return a->w_pri - b->w_pri; + return workcmpf0(a, b); } /* ** WORKCMPF2 -- second compare function for ordering work based on host name. @@ -1599,7 +1600,7 @@ workcmpf2(a, b) return i; /* job priority */ - return a->w_pri - b->w_pri; + return workcmpf0(a, b); } /* ** WORKCMPF3 -- simple submission-time-only compare function. diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c index 942ca5b..fa99423 100644 --- a/contrib/sendmail/src/readcf.c +++ b/contrib/sendmail/src/readcf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: readcf.c,v 8.382.4.31 2000/12/18 18:00:43 ca Exp $"; +static char id[] = "@(#)$Id: readcf.c,v 8.382.4.38 2001/02/17 00:05:12 geir Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -844,6 +844,8 @@ fileclass(class, filename, fmt, safe, optional) ** T -- the mailer type (for DSNs) ** U -- the uid to run as ** W -- the time to wait at the end +** m -- maximum messages per connection +** / -- new root directory ** The first word is the canonical name of the mailer. ** ** Returns: @@ -2059,7 +2061,9 @@ setoption(opt, val, safe, sticky, e) if (val[0] == '\0') HelpFile = "helpfile"; else + { HelpFile = newstr(val); + } break; case 'h': /* maximum hop count */ @@ -2094,6 +2098,13 @@ setoption(opt, val, safe, sticky, e) HasWildcardMX = !clearmode; continue; } +#if _FFR_WORKAROUND_BROKEN_NAMESERVERS + if (sm_strcasecmp(q, "WorkAroundBrokenAAAA") == 0) + { + WorkAroundBrokenAAAA = !clearmode; + continue; + } +#endif /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */ for (rfp = ResolverFlags; rfp->rf_name != NULL; rfp++) { if (strcasecmp(q, rfp->rf_name) == 0) @@ -2248,7 +2259,9 @@ setoption(opt, val, safe, sticky, e) if (val[0] == '\0') StatFile = "statistics"; else + { StatFile = newstr(val); + } break; case 's': /* be super safe, even if expensive */ @@ -2549,7 +2562,9 @@ setoption(opt, val, safe, sticky, e) case O_HSDIR: /* persistent host status directory */ if (val[0] != '\0') + { HostStatDir = newstr(val); + } break; case O_SINGTHREAD: /* single thread deliveries (requires hsdir) */ diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c index d144792..258e7e2 100644 --- a/contrib/sendmail/src/recipient.c +++ b/contrib/sendmail/src/recipient.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: recipient.c,v 8.231.14.8 2000/09/14 23:32:27 gshapiro Exp $"; +static char id[] = "@(#)$Id: recipient.c,v 8.231.14.10 2001/02/14 04:07:30 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h index 9a6698a..ffb0b33 100644 --- a/contrib/sendmail/src/sendmail.h +++ b/contrib/sendmail/src/sendmail.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -20,7 +20,7 @@ #ifdef _DEFINE # define EXTERN # ifndef lint -static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.45 2000/12/28 23:46:44 gshapiro Exp $"; +static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.50 2001/02/22 18:56:24 gshapiro Exp $"; # endif /* ! lint */ #else /* _DEFINE */ # define EXTERN extern @@ -152,6 +152,9 @@ static char SmailId[] = "@(#)$Id: sendmail.h,v 8.517.4.45 2000/12/28 23:46:44 gs #ifndef INT32SZ # define INT32SZ 4 /* size of a 32 bit integer in bytes */ #endif /* ! INT32SZ */ +#ifndef INADDR_LOOPBACK +# define INADDR_LOOPBACK 0x7f000001 /* loopback address */ +#endif /* ! INADDR_LOOPBACK */ /* ** Error return from inet_addr(3), in case not defined in /usr/include. @@ -1377,6 +1380,7 @@ struct milter # define SMFS_OPEN 'O' /* connected to remote milter filter */ # define SMFS_INMSG 'M' /* currently servicing a message */ # define SMFS_DONE 'D' /* done with current message */ +# define SMFS_CLOSABLE 'Q' /* done with current connection */ # define SMFS_ERROR 'E' /* error state */ # define SMFS_READY 'R' /* ready for action */ @@ -1692,6 +1696,9 @@ EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */ EXTERN bool SuperSafe; /* be extra careful, even if expensive */ EXTERN bool SuprErrs; /* set if we are suppressing errors */ EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */ +#if _FFR_WORKAROUND_BROKEN_NAMESERVERS +EXTERN bool WorkAroundBrokenAAAA; /* some nameservers return SERVFAIL on AAAA queries */ +#endif /* _FFR_WORKAROUND_BROKEN_NAMESERVERS */ EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */ EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */ EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */ @@ -2063,7 +2070,7 @@ extern void setuserenv __P((const char *, const char *)); extern void settime __P((ENVELOPE *)); extern char *sfgets __P((char *, int, FILE *, time_t, char *)); extern char *shortenstring __P((const char *, int)); -extern void shorten_hostname __P((char [])); +extern char *shorten_hostname __P((char [])); extern bool shorten_rfc822_string __P((char *, size_t)); extern SIGFUNC_DECL sigusr1 __P((int)); extern SIGFUNC_DECL sighup __P((int)); diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c index 78443a8..72d22c0 100644 --- a/contrib/sendmail/src/srvrsmtp.c +++ b/contrib/sendmail/src/srvrsmtp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -16,9 +16,9 @@ #ifndef lint # if SMTP -static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.66 2000/12/18 18:00:44 ca Exp $ (with SMTP)"; +static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.67 2001/01/07 19:31:05 gshapiro Exp $ (with SMTP)"; # else /* SMTP */ -static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.66 2000/12/18 18:00:44 ca Exp $ (without SMTP)"; +static char id[] = "@(#)$Id: srvrsmtp.c,v 8.471.2.2.2.67 2001/01/07 19:31:05 gshapiro Exp $ (without SMTP)"; # endif /* SMTP */ #endif /* ! lint */ @@ -1159,7 +1159,7 @@ smtp(nullserver, d_flags, e) if (gothello) { usrerr("503 %s Duplicate HELO/EHLO", - MyHostName); + MyHostName); break; } diff --git a/contrib/sendmail/src/stats.c b/contrib/sendmail/src/stats.c index 880f3d9..e03de5f 100644 --- a/contrib/sendmail/src/stats.c +++ b/contrib/sendmail/src/stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: stats.c,v 8.36.14.3 2000/09/17 17:04:27 gshapiro Exp $"; +static char id[] = "@(#)$Id: stats.c,v 8.36.14.5 2001/02/14 04:07:30 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> diff --git a/contrib/sendmail/src/udb.c b/contrib/sendmail/src/udb.c index 91d03f1..9b8ccd0 100644 --- a/contrib/sendmail/src/udb.c +++ b/contrib/sendmail/src/udb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-1999, 2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -15,9 +15,9 @@ #ifndef lint # if USERDB -static char id[] = "@(#)$Id: udb.c,v 8.111 1999/11/16 02:04:04 gshapiro Exp $ (with USERDB)"; +static char id[] = "@(#)$Id: udb.c,v 8.111.16.1 2001/01/04 18:18:37 gshapiro Exp $ (with USERDB)"; # else /* USERDB */ -static char id[] = "@(#)$Id: udb.c,v 8.111 1999/11/16 02:04:04 gshapiro Exp $ (without USERDB)"; +static char id[] = "@(#)$Id: udb.c,v 8.111.16.1 2001/01/04 18:18:37 gshapiro Exp $ (without USERDB)"; # endif /* USERDB */ #endif /* ! lint */ @@ -1011,6 +1011,10 @@ _udbx_init(e) 0644); if (ret != 0) { +#ifdef DB_OLD_VERSION + if (ret == DB_OLD_VERSION) + ret = EINVAL; +#endif /* DB_OLD_VERSION */ (void) up->udb_dbp->close(up->udb_dbp, 0); up->udb_dbp = NULL; } diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c index bfce56a..83034dc 100644 --- a/contrib/sendmail/src/usersmtp.c +++ b/contrib/sendmail/src/usersmtp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -15,9 +15,9 @@ #ifndef lint # if SMTP -static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.18 2000/12/20 16:36:11 ca Exp $ (with SMTP)"; +static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.24 2001/02/21 00:59:09 gshapiro Exp $ (with SMTP)"; # else /* SMTP */ -static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.18 2000/12/20 16:36:11 ca Exp $ (without SMTP)"; +static char id[] = "@(#)$Id: usersmtp.c,v 8.245.4.24 2001/02/21 00:59:09 gshapiro Exp $ (without SMTP)"; # endif /* SMTP */ #endif /* ! lint */ @@ -844,6 +844,7 @@ safesaslfile(context, file) if (file == NULL || *file == '\0') return SASL_OK; + sff = SFF_SAFEDIRPATH|SFF_NOWLINK|SFF_NOGWFILES|SFF_NOWWFILES|SFF_ROOTOK; if ((p = strrchr(file, '/')) == NULL) p = file; @@ -873,12 +874,13 @@ safesaslfile(context, file) } # endif /* SASL <= 10515 */ - if ((r = safefile(file, RunAsUid, RunAsGid, RunAsUserName, sff, + p = file; + if ((r = safefile(p, RunAsUid, RunAsGid, RunAsUserName, sff, S_IRUSR, NULL)) == 0) return SASL_OK; if (LogLevel >= 11 || (r != ENOENT && LogLevel >= 9)) sm_syslog(LOG_WARNING, NOQID, "error: safesasl(%s) failed: %s", - file, errstring(r)); + p, errstring(r)); return SASL_CONTINUE; } @@ -1528,7 +1530,7 @@ smtpmailfrom(m, mci, e) else { smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName, - *bufp == '@' ? ',' : ':', bufp, optbuf); + *bufp == '@' ? ',' : ':', bufp, optbuf); } SmtpPhase = mci->mci_phase = "client MAIL"; sm_setproctitle(TRUE, e, "%s %s: %s", qid_printname(e), @@ -1943,6 +1945,8 @@ smtpdata(m, mci, e) else r = 4; e->e_statmsg = newstr(&SmtpReplyBuffer[r]); + SmtpPhase = mci->mci_phase = "idle"; + sm_setproctitle(TRUE, e, "%s: %s", CurHostName, mci->mci_phase); if (rstat != EX_PROTOCOL) return rstat; if (LogLevel > 1) @@ -2116,6 +2120,17 @@ smtpquit(m, mci, e) } /* ** SMTPRSET -- send a RSET (reset) command +** +** Parameters: +** m -- a pointer to the mailer. +** mci -- the mailer connection information. +** e -- the current envelope. +** +** Returns: +** none. +** +** Side Effects: +** closes the connection if there is no reply to RSET. */ void @@ -2154,6 +2169,15 @@ smtprset(m, mci, e) } /* ** SMTPPROBE -- check the connection state +** +** Parameters: +** mci -- the mailer connection information. +** +** Returns: +** none. +** +** Side Effects: +** closes the connection if there is no reply to RSET. */ int diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c index e71627f..6b301cb 100644 --- a/contrib/sendmail/src/util.c +++ b/contrib/sendmail/src/util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.15 2000/10/18 23:46:07 ca Exp $"; +static char id[] = "@(#)$Id: util.c,v 8.225.2.1.2.19 2001/02/22 18:56:24 gshapiro Exp $"; #endif /* ! lint */ #include <sendmail.h> @@ -497,7 +497,8 @@ log_sendmail_pid(e) pidf = safefopen(pidpath, O_WRONLY|O_TRUNC, 0644, sff); if (pidf == NULL) { - sm_syslog(LOG_ERR, NOQID, "unable to write %s", pidpath); + sm_syslog(LOG_ERR, NOQID, "unable to write %s: %s", + pidpath, errstring(errno)); } else { @@ -1785,10 +1786,10 @@ printit: ** host -- the host to shorten (stripped in place). ** ** Returns: -** none. +** place where string was trunacted, NULL if not truncated. */ -void +char * shorten_hostname(host) char host[]; { @@ -1808,7 +1809,7 @@ shorten_hostname(host) /* see if there is any domain at all -- if not, we are done */ p = strchr(host, '.'); if (p == NULL) - return; + return NULL; /* yes, we have a domain -- see if it looks like us */ mydom = macvalue('m', CurEnv); @@ -1817,7 +1818,11 @@ shorten_hostname(host) i = strlen(++p); if ((canon ? strcasecmp(p, mydom) : strncasecmp(p, mydom, i)) == 0 && (mydom[i] == '.' || mydom[i] == '\0')) + { *--p = '\0'; + return p; + } + return NULL; } /* ** PROG_OPEN -- open a program for reading diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c index 2499b10..60a42c6 100644 --- a/contrib/sendmail/src/version.c +++ b/contrib/sendmail/src/version.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -12,7 +12,7 @@ */ #ifndef lint -static char id[] = "@(#)$Id: version.c,v 8.43.4.25 2000/12/29 18:22:18 gshapiro Exp $"; +static char id[] = "@(#)$Id: version.c,v 8.43.4.30 2001/02/27 19:22:31 gshapiro Exp $"; #endif /* ! lint */ -char Version[] = "8.11.2"; +char Version[] = "8.11.3"; |