BSD 4_4_Lite2 release
[unix-history] / usr / src / usr.sbin / sendmail / src / conf.c
index 3eee917..8467caa 100644 (file)
@@ -3,11 +3,37 @@
  * Copyright (c) 1988, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
  * Copyright (c) 1988, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.200 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.203 (Berkeley) 6/20/95";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -39,7 +65,7 @@ static char sccsid[] = "@(#)conf.c    8.200 (Berkeley) %G%";
 
 
 
 
 
 
-\f/*
+/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 **
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 **
@@ -965,6 +991,31 @@ setsignal(sig, handler)
 #endif
 }
 \f/*
 #endif
 }
 \f/*
+**  RELEASESIGNAL -- release a held signal
+**
+**     Parameters:
+**             sig -- the signal to release.
+**
+**     Returns:
+**             0 on success.
+**             -1 on failure.
+*/
+
+int
+releasesignal(sig)
+       int sig;
+{
+#ifdef BSD4_3
+       return sigsetmask(sigblock(0) & ~(1 << sig));
+#else
+       sigset_t sset;
+
+       sigemptyset(&sset);
+       sigaddset(&sset, sig);
+       return sigprocmask(SIG_UNBLOCK, &sset, NULL);
+#endif
+}
+\f/*
 **  HOLDSIGS -- arrange to hold all signals
 **
 **     Parameters:
 **  HOLDSIGS -- arrange to hold all signals
 **
 **     Parameters:
@@ -1577,10 +1628,8 @@ refuseconnections()
 **  SETPROCTITLE -- set process title for ps
 **
 **     Parameters:
 **  SETPROCTITLE -- set process title for ps
 **
 **     Parameters:
-**             fmt -- a printf style format string.  If NULL, the first
-**                     parameter is a literal proctitle previously
-**                     returned by getproctitle.
-**             va_alist -- possible parameters to fmt.
+**             fmt -- a printf style format string.
+**             a, b, c -- possible parameters to fmt.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -1639,8 +1688,6 @@ typedef unsigned int      *pt_entry_t;
 
 #if SPT_TYPE != SPT_BUILTIN
 
 
 #if SPT_TYPE != SPT_BUILTIN
 
-char   ProcTitleBuf[MAXLINE];
-
 /*VARARGS1*/
 void
 # ifdef __STDC__
 /*VARARGS1*/
 void
 # ifdef __STDC__
@@ -1654,6 +1701,7 @@ setproctitle(fmt, va_alist)
 # if SPT_TYPE != SPT_NONE
        register char *p;
        register int i;
 # if SPT_TYPE != SPT_NONE
        register char *p;
        register int i;
+       SETPROC_STATIC char buf[MAXLINE];
        VA_LOCAL_DECL
 #  if SPT_TYPE == SPT_PSTAT
        union pstun pst;
        VA_LOCAL_DECL
 #  if SPT_TYPE == SPT_PSTAT
        union pstun pst;
@@ -1663,32 +1711,37 @@ setproctitle(fmt, va_alist)
        extern char *LastArgv;
 #  endif
 
        extern char *LastArgv;
 #  endif
 
-       VA_START(fmt);
-       if (fmt == NULL)
-       {
-               /* restore old proctitle */
-               (void) strcpy(ProcTitleBuf, va_arg(ap, char *));
-       }
-       else
-       {
-               p = ProcTitleBuf;
+       p = buf;
 
 
-               /* print sendmail: heading for grep */
-               (void) strcpy(p, "sendmail: ");
-               p += strlen(p);
+       /* print sendmail: heading for grep */
+       (void) strcpy(p, "sendmail: ");
+       p += strlen(p);
 
 
-               /* print the argument string */
-               (void) vsprintf(p, fmt, ap);
-       }
+       /* print the argument string */
+       VA_START(fmt);
+       (void) vsprintf(p, fmt, ap);
        VA_END;
 
        VA_END;
 
-       i = strlen(ProcTitleBuf);
+       i = strlen(buf);
+
+#  if SPT_TYPE == SPT_PSTAT
+       pst.pst_command = buf;
+       pstat(PSTAT_SETCMD, pst, i, 0, 0);
+#  endif
+#  if SPT_TYPE == SPT_PSSTRINGS
+       PS_STRINGS->ps_nargvstr = 1;
+       PS_STRINGS->ps_argvstr = buf;
+#  endif
+#  if SPT_TYPE == SPT_SYSMIPS
+       sysmips(SONY_SYSNEWS, NEWS_SETPSARGS, buf);
+#  endif
+#  if SPT_TYPE == SPT_REUSEARGV
        if (i > LastArgv - Argv[0] - 2)
        {
                i = LastArgv - Argv[0] - 2;
        if (i > LastArgv - Argv[0] - 2)
        {
                i = LastArgv - Argv[0] - 2;
-               ProcTitleBuf[i] = '\0';
+               buf[i] = '\0';
        }
        }
-       (void) strcpy(Argv[0], ProcTitleBuf);
+       (void) strcpy(Argv[0], buf);
        p = &Argv[0][i];
        while (p < LastArgv)
                *p++ = SPT_PADCHAR;
        p = &Argv[0][i];
        while (p < LastArgv)
                *p++ = SPT_PADCHAR;
@@ -2852,7 +2905,6 @@ resetlimits()
 char *
 getcfname()
 {
 char *
 getcfname()
 {
-       struct stat st;
 
        if (ConfFile != NULL)
                return ConfFile;
 
        if (ConfFile != NULL)
                return ConfFile;
@@ -2868,8 +2920,6 @@ getcfname()
        }
 #endif
 
        }
 #endif
 
-       if (stat("/etc/sendmail.cf", &st) >= 0)
-               return "/etc/sendmail.cf";
        return _PATH_SENDMAILCF;
 }
 \f/*
        return _PATH_SENDMAILCF;
 }
 \f/*
@@ -3087,16 +3137,12 @@ strstr(big, little)
 **     work around these problems.
 */
 
 **     work around these problems.
 */
 
-extern int     h_errno;
-
 struct hostent *
 sm_gethostbyname(name)
        char *name;
 {
        struct hostent *h;
 #if defined(SOLARIS) && SOLARIS < 204 || defined(sony_news) && defined(__svr4)
 struct hostent *
 sm_gethostbyname(name)
        char *name;
 {
        struct hostent *h;
 #if defined(SOLARIS) && SOLARIS < 204 || defined(sony_news) && defined(__svr4)
-       extern int h_errno;
-
 # if SOLARIS == 203
        static struct hostent hp;
        static char buf[1000];
 # if SOLARIS == 203
        static struct hostent hp;
        static char buf[1000];
@@ -3166,8 +3212,6 @@ sm_gethostbyaddr(addr, len, type)
        int type;
 {
 #if defined(SOLARIS) && SOLARIS < 204
        int type;
 {
 #if defined(SOLARIS) && SOLARIS < 204
-       extern int h_errno;
-
 # if SOLARIS == 203
        static struct hostent hp;
        static char buf[1000];
 # if SOLARIS == 203
        static struct hostent hp;
        static char buf[1000];