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.6-1.12 (...



details:   https://anonhg.NetBSD.org/src/rev/401d55a560ac
branches:  netbsd-1-5
changeset: 490792:401d55a560ac
user:      he <he%NetBSD.org@localhost>
date:      Fri Mar 09 17:50:12 2001 +0000

description:
Pull up revisions 1.6-1.12 (requested by itojun):
  Upgrade to sendmail 8.11.3.

diffstat:

 gnu/dist/sendmail/sendmail/conf.c |  209 ++++++++++++++++++++++++++-----------
 1 files changed, 145 insertions(+), 64 deletions(-)

diffs (truncated from 502 to 300 lines):

diff -r b462eec0cda0 -r 401d55a560ac gnu/dist/sendmail/sendmail/conf.c
--- a/gnu/dist/sendmail/sendmail/conf.c Fri Mar 09 17:50:09 2001 +0000
+++ b/gnu/dist/sendmail/sendmail/conf.c Fri Mar 09 17:50:12 2001 +0000
@@ -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: conf.c,v 8.646.2.2.2.23 2000/07/15 17:35:18 gshapiro Exp";
+static char id[] = "@(#)Id: conf.c,v 8.646.2.2.2.69 2001/02/27 19:50:11 gshapiro Exp";
 #endif /* ! lint */
 
 #include <sendmail.h>
@@ -197,6 +197,12 @@
 #if _FFR_UNSAFE_SASL
        { "groupreadablesaslfile",      DBS_GROUPREADABLESASLFILE       },
 #endif /* _FFR_UNSAFE_SASL */
+#if _FFR_UNSAFE_WRITABLE_INCLUDE
+       { "groupwritableforwardfile",   DBS_GROUPWRITABLEFORWARDFILE    },
+       { "groupwritableincludefile",   DBS_GROUPWRITABLEINCLUDEFILE    },
+       { "worldwritableforwardfile",   DBS_WORLDWRITABLEFORWARDFILE    },
+       { "worldwritableincludefile",   DBS_WORLDWRITABLEINCLUDEFILE    },
+#endif /* _FFR_UNSAFE_WRITABLE_INCLUDE */
        { NULL,                         0                               }
 };
 
@@ -374,7 +380,7 @@
 {
        char buf[100];
 
-       (void) strlcpy(buf, "prog, P=/bin/sh, F=lsoDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
+       (void) strlcpy(buf, "prog, P=/bin/sh, F=lsouDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u",
                sizeof buf);
        makemailer(buf);
 
@@ -819,7 +825,7 @@
        char *maptype[MAXMAPSTACK];
        short mapreturn[MAXMAPACTIONS];
 {
-       int svcno;
+       int svcno = 0;
        int save_errno = errno;
 
 #ifdef _USE_SUN_NSSWITCH_
@@ -839,7 +845,7 @@
        else
                lk = nsw_conf->lookups;
        svcno = 0;
-       while (lk != NULL)
+       while (lk != NULL && svcno < MAXMAPSTACK)
        {
                maptype[svcno] = lk->service_name;
                if (lk->actions[__NSW_NOTFOUND] == __NSW_RETURN)
@@ -876,7 +882,7 @@
                errno = save_errno;
                return -1;
        }
-       for (svcno = 0; svcno < SVC_PATHSIZE; svcno++)
+       for (svcno = 0; svcno < SVC_PATHSIZE && svcno < MAXMAPSTACK; svcno++)
        {
                switch (svcinfo->svcpath[svc][svcno])
                {
@@ -1506,6 +1512,7 @@
 #define LA_KSTAT       12      /* special Solaris kstat(3k) implementation */
 #define LA_DEVSHORT    13      /* read short from a device */
 #define LA_ALPHAOSF    14      /* Digital UNIX (OSF/1 on Alpha) table() call */
+#define LA_PSET                15      /* Solaris per-processor-set load average */
 
 /* do guesses based on general OS type */
 #ifndef LA_TYPE
@@ -2063,6 +2070,28 @@
 
 #endif /* LA_TYPE == LA_ALPHAOSF */
 
+#if LA_TYPE == LA_PSET
+
+static int
+getla()
+{
+       double avenrun[3];
+
+       if (pset_getloadavg(PS_MYID, avenrun,
+                           sizeof(avenrun) / sizeof(avenrun[0])) < 0)
+       {
+               if (tTd(3, 1))
+                       dprintf("getla: pset_getloadavg failed: %s",
+                               errstring(errno));
+               return -1;
+       }
+       if (tTd(3, 1))
+               dprintf("getla: %d\n", (int) (avenrun[0] +0.5));
+       return ((int) (avenrun[0] + 0.5));
+}
+
+#endif /* LA_TYPE == LA_PSET */
+
 #if LA_TYPE == LA_ZERO
 
 static int
@@ -2145,7 +2174,7 @@
        {
                char labuf[8];
 
-               snprintf(labuf, sizeof labuf, "%d", CurrentLA);
+               snprintf(labuf, sizeof labuf, "%d", la);
                define(macid("{load_avg}", NULL), newstr(labuf), e);
        }
        return la;
@@ -2222,35 +2251,12 @@
        ENVELOPE *e;
        int d;
 {
-       time_t now;
-       static time_t lastconn[MAXDAEMONS];
-       static int conncnt[MAXDAEMONS];
-
-
 #ifdef XLA
        if (!xla_smtp_ok())
                return TRUE;
 #endif /* XLA */
 
-       now = curtime();
-       if (now != lastconn[d])
-       {
-               lastconn[d] = now;
-               conncnt[d] = 0;
-       }
-       else if (conncnt[d]++ > ConnRateThrottle && ConnRateThrottle > 0)
-       {
-               /* sleep to flatten out connection load */
-               sm_setproctitle(TRUE, e, "deferring connections on daemon %s: %d per second",
-                               name, ConnRateThrottle);
-               if (LogLevel >= 9)
-                       sm_syslog(LOG_INFO, NOQID,
-                               "deferring connections on daemon %s: %d per second",
-                               name, ConnRateThrottle);
-               (void) sleep(1);
-       }
-
-       CurrentLA = getla();
+       CurrentLA = sm_getla(NULL);
        if (RefuseLA > 0 && CurrentLA >= RefuseLA)
        {
                sm_setproctitle(TRUE, e, "rejecting connections on daemon %s: load average: %d",
@@ -2467,7 +2473,7 @@
        if (kmem < 0 || kmempid != getpid())
        {
                if (kmem >= 0)
-                       close(kmem);
+                       (void) close(kmem);
                kmem = open(_PATH_KMEM, O_RDWR, 0);
                if (kmem < 0)
                        return;
@@ -2984,7 +2990,7 @@
        fd = open("/dev/tty", O_RDWR, 0);
        if (fd >= 0)
        {
-               (void) ioctl(fd, (int) TIOCNOTTY, (char *) 0);
+               (void) ioctl(fd, TIOCNOTTY, (char *) 0);
                (void) close(fd);
        }
 #  endif /* TIOCNOTTY */
@@ -3623,6 +3629,7 @@
 **             type -- type of the lock.  Bits can be:
 **                     LOCK_EX -- exclusive lock.
 **                     LOCK_NB -- non-blocking.
+**                     LOCK_UN -- unlock.
 **
 **     Returns:
 **             TRUE if the lock was acquired.
@@ -4131,7 +4138,7 @@
                        hostname, anynet_ntoa(sap));
 
        if (rscheck("check_relay", hostname, anynet_ntoa(sap),
-                   e, TRUE, TRUE, 4) != EX_OK)
+                   e, TRUE, TRUE, 4, NULL) != EX_OK)
        {
                static char reject[BUFSIZ*2];
                extern char MsgBuf[];
@@ -4351,7 +4358,7 @@
                resv6 = bitset(RES_USE_INET6, _res.options);
                _res.options |= RES_USE_INET6;
        }
-       h_errno = 0;
+       SM_SET_H_ERRNO(0);
        h = gethostbyname(name);
        *err = h_errno;
        if (family == AF_INET6 && !resv6)
@@ -4368,11 +4375,25 @@
 {
        struct hostent *h;
 
-       h_errno = 0;
+       SM_SET_H_ERRNO(0);
        h = gethostbyaddr(addr, len, family);
        *err = h_errno;
        return h;
 }
+
+# if _FFR_FREEHOSTENT
+void
+freehostent(h)
+       struct hostent *h;
+{
+       /*
+       **  Stub routine -- if they don't have getipnodeby*(),
+       **  they probably don't have the free routine either.
+       */
+
+       return;
+}
+# endif /* _FFR_FREEHOSTENT */
 #endif /* NEEDSGETIPNODE && NETINET6 && __RES < 19990909 */
 
 struct hostent *
@@ -4380,6 +4401,7 @@
        char *name;
        int family;
 {
+       int save_errno;
        struct hostent *h = NULL;
 #if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4))
 # if SOLARIS == 20300 || SOLARIS == 203
@@ -4390,12 +4412,14 @@
        if (tTd(61, 10))
                dprintf("_switch_gethostbyname_r(%s)... ", name);
        h = _switch_gethostbyname_r(name, &hp, buf, sizeof(buf), &h_errno);
+       save_errno = errno;
 # else /* SOLARIS == 20300 || SOLARIS == 203 */
        extern struct hostent *__switch_gethostbyname();
 
        if (tTd(61, 10))
                dprintf("__switch_gethostbyname(%s)... ", name);
        h = __switch_gethostbyname(name);
+       save_errno = errno;
 # endif /* SOLARIS == 20300 || SOLARIS == 203 */
 #else /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4)) */
        int nmaps;
@@ -4403,7 +4427,6 @@
        int flags = AI_DEFAULT|AI_ALL;
        int err;
 # endif /* NETINET6 */
-       int save_errno;
        char *maptype[MAXMAPSTACK];
        short mapreturn[MAXMAPACTIONS];
        char hbuf[MAXNAME];
@@ -4416,7 +4439,7 @@
        flags &= ~AI_ADDRCONFIG;
 #  endif /* ADDRCONFIG_IS_BROKEN */
        h = getipnodebyname(name, family, flags, &err);
-       h_errno = err;
+       SM_SET_H_ERRNO(err);
 # else /* NETINET6 */
        h = gethostbyname(name);
 # endif /* NETINET6 */
@@ -4429,9 +4452,12 @@
 
                nmaps = switch_map_find("hosts", maptype, mapreturn);
                while (--nmaps >= 0)
+               {
                        if (strcmp(maptype[nmaps], "nis") == 0 ||
                            strcmp(maptype[nmaps], "files") == 0)
                                break;
+               }
+
                if (nmaps >= 0)
                {
                        /* try short name */
@@ -4441,7 +4467,7 @@
                                return NULL;
                        }
                        (void) strlcpy(hbuf, name, sizeof hbuf);
-                       shorten_hostname(hbuf);
+                       (void) shorten_hostname(hbuf);
 
                        /* if it hasn't been shortened, there's no point */
                        if (strcmp(hbuf, name) != 0)
@@ -4454,7 +4480,7 @@
                                h = getipnodebyname(hbuf, family,
                                                    AI_V4MAPPED|AI_ALL,
                                                    &err);
-                               h_errno = err;
+                               SM_SET_H_ERRNO(err);
                                save_errno = errno;
 # else /* NETINET6 */
                                h = gethostbyname(hbuf);
@@ -4517,26 +4543,43 @@
        int type;
 {
        struct hostent *hp;
+
+#if NETINET6
+       if (type == AF_INET6 &&



Home | Main Index | Thread Index | Old Index