Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/gnu/dist/sendmail/sendmail Pull up revisions 1.8-1.9 (r...
details: https://anonhg.NetBSD.org/src/rev/47b573825cc8
branches: netbsd-1-5
changeset: 492798:47b573825cc8
user: he <he%NetBSD.org@localhost>
date: Wed Feb 20 23:12:42 2002 +0000
description:
Pull up revisions 1.8-1.9 (requested by itojun):
Upgrade to sendmail version 8.11.6.
diffstat:
gnu/dist/sendmail/sendmail/conf.h | 27 ++-
gnu/dist/sendmail/sendmail/deliver.c | 146 ++++++++++---
gnu/dist/sendmail/sendmail/main.c | 379 +++++++++++++++++++++++++---------
3 files changed, 408 insertions(+), 144 deletions(-)
diffs (truncated from 1041 to 300 lines):
diff -r b5fe0c73b26d -r 47b573825cc8 gnu/dist/sendmail/sendmail/conf.h
--- a/gnu/dist/sendmail/sendmail/conf.h Wed Feb 20 23:12:39 2002 +0000
+++ b/gnu/dist/sendmail/sendmail/conf.h Wed Feb 20 23:12:42 2002 +0000
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * Id: conf.h,v 8.496.4.37 2001/02/12 21:40:16 gshapiro Exp
+ * Id: conf.h,v 8.496.4.54 2001/07/31 22:30:24 gshapiro Exp
*/
/*
@@ -84,7 +84,7 @@
#define MAXMIMEARGS 20 /* max args in Content-Type: */
#define MAXMIMENESTING 20 /* max MIME multipart nesting */
#define QUEUESEGSIZE 1000 /* increment for queue size */
-#define MAXQFNAME 20 /* max qf file name length */
+#define MAXQFNAME 21 /* max qf file name length */
#define MACBUFSIZE 4096 /* max expanded macro buffer size */
#define TOBUFSIZE SM_ARG_MAX /* max buffer to hold address list */
#define MAXSHORTSTR 203 /* max short string length */
@@ -488,6 +488,7 @@
# endif /* ! __svr4__ */
# define GIDSET_T gid_t
# define USE_SA_SIGACTION 1 /* use sa_sigaction field */
+# define HASSTRERROR 1 /* has strerror(3) */
# if _FFR_MILTER
# define BROKEN_PTHREAD_SLEEP 1 /* sleep after pthread_create() fails */
# endif /* _FFR_MILTER */
@@ -551,6 +552,9 @@
# undef _PATH_SENDMAILPID /* tmpfs /var/run added in 2.8 */
# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
# endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
+# if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
+# define HASURANDOMDEV 1 /* /dev/[u]random added in S9 */
+# endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
# ifndef HASGETUSERSHELL
# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps pre-2.7 */
# endif /* ! HASGETUSERSHELL */
@@ -864,9 +868,11 @@
#ifdef __bsdi__
# include <paths.h>
# define HASUNSETENV 1 /* has the unsetenv(3) call */
+# define HASSETREUID 0 /* BSD-OS has broken setreuid(2) emulation */
# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
# define USESETEUID 1 /* has usable seteuid(2) call */
# define HASFCHMOD 1 /* has fchmod(2) syscall */
+# define HASFCHOWN 1 /* has fchown(2) syscall */
# define HASSETLOGIN 1 /* has setlogin(2) */
# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
# define HASUNAME 1 /* has uname(2) syscall */
@@ -893,6 +899,9 @@
# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 /* on 3.x */
# define HASSETUSERCONTEXT 1 /* has setusercontext */
# endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
+# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 /* on 4.x */
+# define HASURANDOMDEV 1 /* has /dev/urandom(4) */
+# endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
#endif /* __bsdi__ */
@@ -1005,6 +1014,7 @@
# undef SPT_TYPE
# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
# define HASSETLOGIN 1 /* has setlogin(2) */
+# define HASSETREUID 0 /* OpenBSD has broken setreuid(2) emulation */
# define HASURANDOMDEV 1 /* has /dev/urandom(4) */
# if OpenBSD < 199912
# define HASSTRL 0 /* strlcat(3) is broken in 2.5 and earlier */
@@ -1471,10 +1481,10 @@
# else /* (GLIBC_VERSION >= 0x201) */
# include <linux/in6.h> /* IPv6 support */
# endif /* (GLIBC_VERSION >= 0x201) */
-# if (GLIBC_VERSION == 0x201 && !defined(NEEDSGETIPNODE))
+# if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
/* Have APIs in <netdb.h>, but no support in glibc */
# define NEEDSGETIPNODE 1
-# endif /* (GLIBC_VERSION == 0x201 && ! NEEDSGETIPNODE) */
+# endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
# undef GLIBC_VERSION
# endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
# endif /* NETINET6 */
@@ -1717,6 +1727,7 @@
# include <sys/mkdev.h>
# define __svr4__
# define SYS5SIGNALS 1
+# define HASFCHOWN 1 /* has fchown(2) call */
# define HASSETSID 1
# define HASSNPRINTF 1
# define HASSETREUID 1
@@ -2246,7 +2257,9 @@
/* general BSD defines */
#ifdef BSD
# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
-# define HASSETREUID 1 /* has setreuid(2) call */
+# ifndef HASSETREUID
+# define HASSETREUID 1 /* has setreuid(2) call */
+# endif /* ! HASSETREUID */
# define HASINITGROUPS 1 /* has initgroups(3) call */
# ifndef IP_SRCROUTE
# define IP_SRCROUTE 1 /* can check IP source routing */
@@ -2514,6 +2527,10 @@
# define S_IWOTH 0002
#endif /* ! S_IWOTH */
+#ifndef O_ACCMODE
+# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
+#endif /* ! O_ACCMODE */
+
/* close-on-exec flag */
#ifndef FD_CLOEXEC
# define FD_CLOEXEC 1
diff -r b5fe0c73b26d -r 47b573825cc8 gnu/dist/sendmail/sendmail/deliver.c
--- a/gnu/dist/sendmail/sendmail/deliver.c Wed Feb 20 23:12:39 2002 +0000
+++ b/gnu/dist/sendmail/sendmail/deliver.c Wed Feb 20 23:12:42 2002 +0000
@@ -12,7 +12,7 @@
*/
#ifndef lint
-static char id[] = "@(#)Id: deliver.c,v 8.600.2.1.2.66 2001/02/25 23:30:35 gshapiro Exp";
+static char id[] = "@(#)Id: deliver.c,v 8.600.2.1.2.86 2001/07/20 21:52:55 gshapiro Exp";
#endif /* ! lint */
#include <sendmail.h>
@@ -135,22 +135,31 @@
if (e->e_hopcount > MaxHopCount)
{
+ char *recip;
+
+ if (e->e_sendqueue != NULL &&
+ e->e_sendqueue->q_paddr != NULL)
+ recip = e->e_sendqueue->q_paddr;
+ else
+ recip = "(nobody)";
+
errno = 0;
#if QUEUE
queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
#endif /* QUEUE */
e->e_flags |= EF_FATALERRS|EF_PM_NOTIFY|EF_CLRQUEUE;
ExitStat = EX_UNAVAILABLE;
- syserr("554 5.0.0 Too many hops %d (%d max): from %s via %s, to %s",
- e->e_hopcount, MaxHopCount, e->e_from.q_paddr,
- RealHostName == NULL ? "localhost" : RealHostName,
- e->e_sendqueue->q_paddr);
+ syserr("554 5.4.6 Too many hops %d (%d max): from %s via %s, to %s",
+ e->e_hopcount, MaxHopCount, e->e_from.q_paddr,
+ RealHostName == NULL ? "localhost" : RealHostName,
+ recip);
for (q = e->e_sendqueue; q != NULL; q = q->q_next)
{
if (QS_IS_DEAD(q->q_state))
continue;
q->q_state = QS_BADADDR;
q->q_status = "5.4.6";
+ q->q_rstatus = "554 5.4.6 Too many hops";
}
return;
}
@@ -635,6 +644,11 @@
return;
}
+ /* Reset global flags */
+ RestartRequest = NULL;
+ ShutdownRequest = NULL;
+ PendingSignal = 0;
+
/*
** Since we have accepted responsbility for the message,
** change the SIGTERM handler. intsig() (the old handler)
@@ -931,7 +945,7 @@
** returns twice, once in parent and once in child.
*/
-int
+pid_t
dofork()
{
register pid_t pid = -1;
@@ -1451,7 +1465,7 @@
if (l > tobufsize)
{
if (tobuf != NULL)
- free(tobuf);
+ sm_free(tobuf);
tobufsize = l;
tobuf = xalloc(tobufsize);
}
@@ -1719,10 +1733,10 @@
m->m_name);
i = makeconnection(hostbuf, port, mci, e);
}
+ mci->mci_errno = errno;
mci->mci_lastuse = curtime();
mci->mci_deliveries = 0;
mci->mci_exitstat = i;
- mci->mci_errno = errno;
# if NAMED_BIND
mci->mci_herrno = h_errno;
# endif /* NAMED_BIND */
@@ -1913,13 +1927,26 @@
struct stat stb;
extern int DtableSize;
+ /* clear the events to turn off SIGALRMs */
+ clear_events();
+
+ /* Reset global flags */
+ RestartRequest = NULL;
+ ShutdownRequest = NULL;
+ PendingSignal = 0;
+
if (e->e_lockfp != NULL)
(void) close(fileno(e->e_lockfp));
/* child -- set up input & exec mailer */
- (void) setsignal(SIGINT, SIG_IGN);
+ (void) setsignal(SIGALRM, sm_signal_noop);
+ (void) setsignal(SIGCHLD, SIG_DFL);
(void) setsignal(SIGHUP, SIG_IGN);
+ (void) setsignal(SIGINT, SIG_IGN);
(void) setsignal(SIGTERM, SIG_DFL);
+# ifdef SIGUSR1
+ (void) setsignal(SIGUSR1, sm_signal_noop);
+# endif /* SIGUSR1 */
if (m != FileMailer || stat(tochain->q_user, &stb) < 0)
stb.st_mode = 0;
@@ -2052,7 +2079,19 @@
/* reset user id */
endpwent();
if (bitnset(M_SPECIFIC_UID, m->m_flags))
+ {
new_euid = m->m_uid;
+
+ /*
+ ** Undo the effects of the uid change in main
+ ** for signal handling. The real uid may
+ ** be used by mailer in adding a "From "
+ ** line.
+ */
+
+ if (RealUid != 0 && RealUid != getuid())
+ new_ruid = RealUid;
+ }
else if (bitset(S_ISUID, stb.st_mode))
new_ruid = stb.st_uid;
else if (ctladdr != NULL && ctladdr->q_uid != 0)
@@ -2072,6 +2111,22 @@
vendor_set_uid(new_euid);
# if MAILER_SETUID_METHOD == USE_SETEUID
+# if HASSETREUID
+ /*
+ ** Undo the effects of the uid change in main
+ ** for signal handling. The real uid may
+ ** be used by mailer in adding a "From "
+ ** line.
+ */
+
+ if (new_ruid != NO_UID &&
+ setreuid(RealUid, geteuid()) < 0)
+ {
+ syserr("openmailer: setreuid(%d, %d) failed",
+ (int) new_ruid, (int) geteuid());
+ exit(EX_OSERR);
+ }
+# endif /* HASSETREUID */
if (seteuid(new_euid) < 0 && suidwarn)
{
syserr("openmailer: seteuid(%ld) failed",
@@ -2511,7 +2566,9 @@
mci->mci_host,
macvalue(macid("{auth_type}",
NULL), e),
- *ssf);
+ result == SASL_OK ? *ssf
+ : 0);
+
/*
** only switch to encrypted connection
** if a security layer has been negotiated
@@ -3024,7 +3081,7 @@
** and if it represents an error, we print it.
**
** Parameters:
-** pid -- pid of mailer.
+** mci -- the mailer connection info.
** e -- the current envelope.
** pv -- the parameter vector that invoked the mailer
** (for error messages).
@@ -3041,6 +3098,12 @@
static void
endwaittimeout()
{
+ /*
+ ** NOTE: THIS CAN BE CALLED FROM A SIGNAL HANDLER. DO NOT ADD
+ ** ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
Home |
Main Index |
Thread Index |
Old Index