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.13-1.14 ...



details:   https://anonhg.NetBSD.org/src/rev/b5fe0c73b26d
branches:  netbsd-1-5
changeset: 492797:b5fe0c73b26d
user:      he <he%NetBSD.org@localhost>
date:      Wed Feb 20 23:12:39 2002 +0000

description:
Pull up revisions 1.13-1.14 (requested by itojun):
  Upgrade to sendmail version 8.11.6.

diffstat:

 gnu/dist/sendmail/sendmail/conf.c |  166 ++++++++++++++++++++++++++-----------
 1 files changed, 116 insertions(+), 50 deletions(-)

diffs (truncated from 361 to 300 lines):

diff -r 90d1ebad1b26 -r b5fe0c73b26d gnu/dist/sendmail/sendmail/conf.c
--- a/gnu/dist/sendmail/sendmail/conf.c Wed Feb 20 23:12:36 2002 +0000
+++ b/gnu/dist/sendmail/sendmail/conf.c Wed Feb 20 23:12:39 2002 +0000
@@ -12,7 +12,7 @@
  */
 
 #ifndef lint
-static char id[] = "@(#)Id: conf.c,v 8.646.2.2.2.69 2001/02/27 19:50:11 gshapiro Exp";
+static char id[] = "@(#)Id: conf.c,v 8.646.2.2.2.87 2001/07/20 23:56:52 gshapiro Exp";
 #endif /* ! lint */
 
 #include <sendmail.h>
@@ -976,7 +976,7 @@
 
                                st = stab(buf, ST_SERVICE, ST_ENTER);
                                if (st->s_service[0] != NULL)
-                                       free((void *) st->s_service[0]);
+                                       sm_free((void *) st->s_service[0]);
                                p = newstr(p);
                                for (svcno = 0; svcno < MAXMAPSTACK; )
                                {
@@ -1226,6 +1226,10 @@
 **  SETSIGNAL -- set a signal handler
 **
 **     This is essentially old BSD "signal(3)".
+**
+**     NOTE:   THIS CAN BE CALLED FROM A SIGNAL HANDLER.  DO NOT ADD
+**             ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
+**             DOING.
 */
 
 sigfunc_t
@@ -1233,14 +1237,16 @@
        int sig;
        sigfunc_t handler;
 {
+# if defined(SA_RESTART) || (!defined(SYS5SIGNALS) && !defined(BSD4_3))
+       struct sigaction n, o;
+# endif /* defined(SA_RESTART) || (!defined(SYS5SIGNALS) && !defined(BSD4_3)) */
+
        /*
        **  First, try for modern signal calls
        **  and restartable syscalls
        */
 
 # ifdef SA_RESTART
-       struct sigaction n, o;
-
        memset(&n, '\0', sizeof n);
 #  if USE_SA_SIGACTION
        n.sa_sigaction = (void(*)(int, siginfo_t *, void *)) handler;
@@ -1272,8 +1278,6 @@
        **  go for a default
        */
 
-       struct sigaction n, o;
-
        memset(&n, '\0', sizeof n);
        n.sa_handler = handler;
        if (sigaction(sig, &n, &o) < 0)
@@ -1283,6 +1287,73 @@
 # endif /* SA_RESTART */
 }
 /*
+**  ALLSIGNALS -- act on all signals
+**
+**     Parameters:
+**             block -- whether to block or release all signals.
+**
+**     Returns:
+**             none.
+*/
+
+void
+allsignals(block)
+       bool block;
+{
+# ifdef BSD4_3
+#  ifndef sigmask
+#   define sigmask(s)  (1 << ((s) - 1))
+#  endif /* ! sigmask */
+       if (block)
+       {
+               int mask = 0;
+
+               mask |= sigmask(SIGALRM);
+               mask |= sigmask(SIGCHLD);
+               mask |= sigmask(SIGHUP);
+               mask |= sigmask(SIGINT);
+               mask |= sigmask(SIGTERM);
+               mask |= sigmask(SIGUSR1);
+
+               (void) sigblock(mask);
+       }
+       else
+               sigsetmask(0);
+# else /* BSD4_3 */
+#  ifdef ALTOS_SYSTEM_V
+       if (block)
+       {
+               (void) sigset(SIGALRM, SIG_HOLD);
+               (void) sigset(SIGCHLD, SIG_HOLD);
+               (void) sigset(SIGHUP, SIG_HOLD);
+               (void) sigset(SIGINT, SIG_HOLD);
+               (void) sigset(SIGTERM, SIG_HOLD);
+               (void) sigset(SIGUSR1, SIG_HOLD);
+       }
+       else
+       {
+               (void) sigset(SIGALRM, SIG_DFL);
+               (void) sigset(SIGCHLD, SIG_DFL);
+               (void) sigset(SIGHUP, SIG_DFL);
+               (void) sigset(SIGINT, SIG_DFL);
+               (void) sigset(SIGTERM, SIG_DFL);
+               (void) sigset(SIGUSR1, SIG_DFL);
+       }
+#  else /* ALTOS_SYSTEM_V */
+       sigset_t sset;
+
+       (void) sigemptyset(&sset);
+       (void) sigaddset(&sset, SIGALRM);
+       (void) sigaddset(&sset, SIGCHLD);
+       (void) sigaddset(&sset, SIGHUP);
+       (void) sigaddset(&sset, SIGINT);
+       (void) sigaddset(&sset, SIGTERM);
+       (void) sigaddset(&sset, SIGUSR1);
+       (void) sigprocmask(block ? SIG_BLOCK : SIG_UNBLOCK, &sset, NULL);
+#  endif /* ALTOS_SYSTEM_V */
+# endif /* BSD4_3 */
+}
+/*
 **  BLOCKSIGNAL -- hold a signal to prevent delivery
 **
 **     Parameters:
@@ -2441,7 +2512,7 @@
 #  if SPT_TYPE == SPT_SCO
        off_t seek_off;
        static int kmem = -1;
-       static int kmempid = -1;
+       static pid_t kmempid = -1;
        struct user u;
 #  endif /* SPT_TYPE == SPT_SCO */
 
@@ -2619,6 +2690,10 @@
 **     Side Effects:
 **             Picks up extant zombies.
 **             Control socket exits may restart/shutdown daemon.
+**
+**     NOTE:   THIS CAN BE CALLED FROM A SIGNAL HANDLER.  DO NOT ADD
+**             ANYTHING TO THIS ROUTINE UNLESS YOU KNOW WHAT YOU ARE
+**             DOING.
 */
 
 /* ARGSUSED0 */
@@ -2629,32 +2704,30 @@
        int save_errno = errno;
        int st;
        pid_t pid;
-#if HASWAITPID
+# if HASWAITPID
        auto int status;
        int count;
-
+# else /* HASWAITPID */
+#  ifdef WNOHANG
+       union wait status;
+#  else /* WNOHANG */
+       auto int status;
+#  endif /* WNOHANG */
+# endif /* HASWAITPID */
+
+# if HASWAITPID
        count = 0;
        while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
        {
                st = status;
                if (count++ > 1000)
-               {
-                       if (LogLevel > 0)
-                               sm_syslog(LOG_ALERT, NOQID,
-                                       "reapchild: waitpid loop: pid=%d, status=%x",
-                                       pid, status);
                        break;
-               }
-#else /* HASWAITPID */
-# ifdef WNOHANG
-       union wait status;
-
+# else /* HASWAITPID */
+#  ifdef WNOHANG
        while ((pid = wait3(&status, WNOHANG, (struct rusage *) NULL)) > 0)
        {
                st = status.w_status;
-# else /* WNOHANG */
-       auto int status;
-
+#  else /* WNOHANG */
        /*
        **  Catch one zombie -- we will be re-invoked (we hope) if there
        **  are more.  Unreliable signals probably break this, but this
@@ -2665,8 +2738,8 @@
        if ((pid = wait(&status)) > 0)
        {
                st = status;
-# endif /* WNOHANG */
-#endif /* HASWAITPID */
+#  endif /* WNOHANG */
+# endif /* HASWAITPID */
                /* Drop PID and check if it was a control socket child */
                if (proc_list_drop(pid) == PROC_CONTROL &&
                    WIFEXITED(st))
@@ -2674,21 +2747,17 @@
                        /* if so, see if we need to restart or shutdown */
                        if (WEXITSTATUS(st) == EX_RESTART)
                        {
-                               /* emulate a SIGHUP restart */
-                               sighup(0);
-                               /* NOTREACHED */
+                               RestartRequest = "control socket";
                        }
                        else if (WEXITSTATUS(st) == EX_SHUTDOWN)
                        {
                                /* emulate a SIGTERM shutdown */
-                               intsig(0);
+                               ShutdownRequest = "control socket";
                                /* NOTREACHED */
                        }
                }
        }
-#ifdef SYS5SIGNALS
-       (void) setsignal(SIGCHLD, reapchild);
-#endif /* SYS5SIGNALS */
+       FIX_SYSV_SIGNAL(sig, reapchild);
        errno = save_errno;
        return SIGFUNC_RETURN;
 }
@@ -2753,18 +2822,14 @@
         */
        if (first)
        {
-               newenv = (char **) malloc(sizeof(char *) * (envlen + 2));
-               if (newenv == NULL)
-                       return -1;
-
+               newenv = (char **) xalloc(sizeof(char *) * (envlen + 2));
                first = FALSE;
                (void) memcpy(newenv, environ, sizeof(char *) * envlen);
        }
        else
        {
-               newenv = (char **) realloc((char *)environ, sizeof(char *) * (envlen + 2));
-               if (newenv == NULL)
-                       return -1;
+               newenv = (char **) xrealloc((char *)environ,
+                                           sizeof(char *) * (envlen + 2));
        }
 
        /* actually add in the new entry */
@@ -4327,7 +4392,7 @@
 **     Support IPv6 as well as IPv4.
 */
 
-#if NETINET6 && NEEDSGETIPNODE && __RES < 19990909
+#if NETINET6 && NEEDSGETIPNODE
 
 # ifndef AI_DEFAULT
 #  define AI_DEFAULT   0       /* dummy */
@@ -4394,7 +4459,7 @@
        return;
 }
 # endif /* _FFR_FREEHOSTENT */
-#endif /* NEEDSGETIPNODE && NETINET6 && __RES < 19990909 */
+#endif /* NEEDSGETIPNODE && NETINET6 */
 
 struct hostent *
 sm_gethostbyname(name, family)
@@ -4477,9 +4542,7 @@
                                               hbuf, family);
 
 # if NETINET6
-                               h = getipnodebyname(hbuf, family,
-                                                   AI_V4MAPPED|AI_ALL,
-                                                   &err);
+                               h = getipnodebyname(hbuf, family, flags, &err);
                                SM_SET_H_ERRNO(err);
                                save_errno = errno;
 # else /* NETINET6 */
@@ -4583,8 +4646,8 @@
 # else /* NETINET6 */
        hp = gethostbyaddr(addr, len, type);
 # endif /* NETINET6 */
+#endif /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) */
        return hp;
-#endif /* (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) */
 }
 /*
 **  SM_GETPW{NAM,UID} -- wrapper for getpwnam and getpwuid
@@ -4870,7 +4933,7 @@
                if (tTd(0, 4))
                        dprintf("SIOCGLIFCONF failed: %s\n", errstring(errno));



Home | Main Index | Thread Index | Old Index