file reorg, pathnames.h, paths.h
[unix-history] / usr / src / usr.sbin / sendmail / src / conf.c
index 9645782..f9fca2f 100644 (file)
@@ -1,22 +1,28 @@
 /*
 /*
-**  Sendmail
-**  Copyright (c) 1983  Eric P. Allman
-**  Berkeley, California
-**
-**  Copyright (c) 1983 Regents of the University of California.
-**  All rights reserved.  The Berkeley software License Agreement
-**  specifies the terms and conditions for redistribution.
-*/
+ * Copyright (c) 1983 Eric P. Allman
+ * Copyright (c) 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
 
 #ifndef lint
 
 #ifndef lint
-static char    SccsId[] = "@(#)conf.c  5.6 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)conf.c     5.19 (Berkeley) %G%";
+#endif /* not lint */
 
 
-# include <pwd.h>
 # include <sys/ioctl.h>
 # include <sys/ioctl.h>
-# ifdef sun
 # include <sys/param.h>
 # include <sys/param.h>
-# endif sun
+# include <pwd.h>
 # include "sendmail.h"
 
 /*
 # include "sendmail.h"
 
 /*
@@ -25,11 +31,6 @@ static char  SccsId[] = "@(#)conf.c  5.6 (Berkeley) %G%";
 **     Defines the configuration of this installation.
 **
 **     Compilation Flags:
 **     Defines the configuration of this installation.
 **
 **     Compilation Flags:
-**             V6 -- running on a version 6 system.  This determines
-**                     whether to define certain routines between
-**                     the two systems.  If you are running a funny
-**                     system, e.g., V6 with long tty names, this
-**                     should be checked carefully.
 **             VMUNIX -- running on a Berkeley UNIX system.
 **
 **     Configuration Variables:
 **             VMUNIX -- running on a Berkeley UNIX system.
 **
 **     Configuration Variables:
@@ -66,8 +67,10 @@ struct hdrinfo       HdrInfo[] =
                /* originator fields, most to least significant  */
        "resent-sender",        H_FROM|H_RESENT,
        "resent-from",          H_FROM|H_RESENT,
                /* originator fields, most to least significant  */
        "resent-sender",        H_FROM|H_RESENT,
        "resent-from",          H_FROM|H_RESENT,
+       "resent-reply-to",      H_FROM|H_RESENT,
        "sender",               H_FROM,
        "from",                 H_FROM,
        "sender",               H_FROM,
        "from",                 H_FROM,
+       "reply-to",             H_FROM,
        "full-name",            H_ACHECK,
        "return-receipt-to",    H_FROM,
        "errors-to",            H_FROM,
        "full-name",            H_ACHECK,
        "return-receipt-to",    H_FROM,
        "errors-to",            H_FROM,
@@ -110,8 +113,8 @@ char        Arpa_Usrerr[] =         "554";  /* some (fatal) user error */
 **  Location of system files/databases/etc.
 */
 
 **  Location of system files/databases/etc.
 */
 
-char   *ConfFile =     "/usr/lib/sendmail.cf"; /* runtime configuration */
-char   *FreezeFile =   "/usr/lib/sendmail.fc"; /* frozen version of above */
+char   *ConfFile =     "/etc/sendmail.cf";     /* runtime configuration */
+char   *FreezeFile =   "/etc/sendmail.fc";     /* frozen version of above */
 
 
 
 
 
 
@@ -143,165 +146,13 @@ setdefaults()
        QueueFactor = 10000;
        RefuseLA = 12;
        SpaceSub = ' ';
        QueueFactor = 10000;
        RefuseLA = 12;
        SpaceSub = ' ';
+       WkRecipFact = 1000;
+       WkClassFact = 1800;
+       WkTimeFact = 9000;
+       FileMode = 0644;
+       DefUid = 1;
+       DefGid = 1;
 }
 }
-\f
-# ifdef V6
-/*
-**  TTYNAME -- return name of terminal.
-**
-**     Parameters:
-**             fd -- file descriptor to check.
-**
-**     Returns:
-**             pointer to full path of tty.
-**             NULL if no tty.
-**
-**     Side Effects:
-**             none.
-*/
-
-char *
-ttyname(fd)
-       int fd;
-{
-       register char tn;
-       static char pathn[] = "/dev/ttyx";
-
-       /* compute the pathname of the controlling tty */
-       if ((tn = ttyn(fd)) == NULL)
-       {
-               errno = 0;
-               return (NULL);
-       }
-       pathn[8] = tn;
-       return (pathn);
-}
-\f/*
-**  FDOPEN -- Open a stdio file given an open file descriptor.
-**
-**     This is included here because it is standard in v7, but we
-**     need it in v6.
-**
-**     Algorithm:
-**             Open /dev/null to create a descriptor.
-**             Close that descriptor.
-**             Copy the existing fd into the descriptor.
-**
-**     Parameters:
-**             fd -- the open file descriptor.
-**             type -- "r", "w", or whatever.
-**
-**     Returns:
-**             The file descriptor it creates.
-**
-**     Side Effects:
-**             none
-**
-**     Called By:
-**             deliver
-**
-**     Notes:
-**             The mode of fd must match "type".
-*/
-
-FILE *
-fdopen(fd, type)
-       int fd;
-       char *type;
-{
-       register FILE *f;
-
-       f = fopen("/dev/null", type);
-       (void) close(fileno(f));
-       fileno(f) = fd;
-       return (f);
-}
-\f/*
-**  INDEX -- Return pointer to character in string
-**
-**     For V7 compatibility.
-**
-**     Parameters:
-**             s -- a string to scan.
-**             c -- a character to look for.
-**
-**     Returns:
-**             If c is in s, returns the address of the first
-**                     instance of c in s.
-**             NULL if c is not in s.
-**
-**     Side Effects:
-**             none.
-*/
-
-char *
-index(s, c)
-       register char *s;
-       register char c;
-{
-       while (*s != '\0')
-       {
-               if (*s++ == c)
-                       return (--s);
-       }
-       return (NULL);
-}
-\f/*
-**  UMASK -- fake the umask system call.
-**
-**     Since V6 always acts like the umask is zero, we will just
-**     assume the same thing.
-*/
-
-/*ARGSUSED*/
-umask(nmask)
-{
-       return (0);
-}
-
-
-/*
-**  GETRUID -- get real user id.
-*/
-
-getruid()
-{
-       return (getuid() & 0377);
-}
-
-
-/*
-**  GETRGID -- get real group id.
-*/
-
-getrgid()
-{
-       return (getgid() & 0377);
-}
-
-
-/*
-**  GETEUID -- get effective user id.
-*/
-
-geteuid()
-{
-       return ((getuid() >> 8) & 0377);
-}
-
-
-/*
-**  GETEGID -- get effective group id.
-*/
-
-getegid()
-{
-       return ((getgid() >> 8) & 0377);
-}
-
-# endif V6
-\f
-# ifndef V6
 
 /*
 **  GETRUID -- get real user id (V7)
 
 /*
 **  GETRUID -- get real user id (V7)
@@ -328,8 +179,7 @@ getrgid()
                return (getgid());
 }
 
                return (getgid());
 }
 
-# endif V6
-\f/*
+/*
 **  USERNAME -- return the user id of the logged in user.
 **
 **     Parameters:
 **  USERNAME -- return the user id of the logged in user.
 **
 **     Parameters:
@@ -557,6 +407,7 @@ getla()
 # else
        double avenrun[3];
 # endif
 # else
        double avenrun[3];
 # endif
+       extern off_t lseek();
 
        if (kmem < 0)
        {
 
        if (kmem < 0)
        {
@@ -638,19 +489,57 @@ setproctitle(fmt, a, b, c)
 {
 # ifdef SETPROCTITLE
        register char *p;
 {
 # ifdef SETPROCTITLE
        register char *p;
+       register int i;
        extern char **Argv;
        extern char *LastArgv;
        extern char **Argv;
        extern char *LastArgv;
+       char buf[MAXLINE];
 
 
-       p = Argv[0];
+       (void) sprintf(buf, fmt, a, b, c);
 
        /* make ps print "(sendmail)" */
 
        /* make ps print "(sendmail)" */
+       p = Argv[0];
        *p++ = '-';
 
        *p++ = '-';
 
-       (void) sprintf(p, fmt, a, b, c);
-       p += strlen(p);
-
-       /* avoid confusing ps */
+       i = strlen(buf);
+       if (i > LastArgv - p - 2)
+       {
+               i = LastArgv - p - 2;
+               buf[i] = '\0';
+       }
+       (void) strcpy(p, buf);
+       p += i;
        while (p < LastArgv)
                *p++ = ' ';
 # endif SETPROCTITLE
 }
        while (p < LastArgv)
                *p++ = ' ';
 # endif SETPROCTITLE
 }
+\f/*
+**  REAPCHILD -- pick up the body of my child, lest it become a zombie
+**
+**     Parameters:
+**             none.
+**
+**     Returns:
+**             none.
+**
+**     Side Effects:
+**             Picks up extant zombies.
+*/
+
+# ifdef VMUNIX
+# include <sys/wait.h>
+# endif VMUNIX
+
+reapchild()
+{
+# ifdef WNOHANG
+       union wait status;
+
+       while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
+               continue;
+# else WNOHANG
+       auto int status;
+
+       while (wait(&status) > 0)
+               continue;
+# endif WNOHANG
+}