Change QueueLA and RefuseLA to 8 and 12 respectively
[unix-history] / usr / src / usr.sbin / sendmail / src / conf.c
index c63b40d..b775fbd 100644 (file)
 **                     the two systems.  If you are running a funny
 **                     system, e.g., V6 with long tty names, this
 **                     should be checked carefully.
 **                     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:
 **             HdrInfo -- a table describing well-known header fields.
 **                     Each entry has the field name and some flags,
 **                     which are described in sendmail.h.
 **
 **     Configuration Variables:
 **             HdrInfo -- a table describing well-known header fields.
 **                     Each entry has the field name and some flags,
 **                     which are described in sendmail.h.
-**             StdTimezone -- name of local timezone in standard time
-**                     (V6 only).
-**             DstTimezone -- name of local timezone in daylight savings
-**                     time (V6 only).
 **
 **     Notes:
 **             I have tried to put almost all the reasonable
 **
 **     Notes:
 **             I have tried to put almost all the reasonable
@@ -36,7 +33,7 @@
 
 
 
 
 
 
-SCCSID(@(#)conf.c      3.55            %G%);
+SCCSID(@(#)conf.c      4.3             %G%);
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
 \f/*
 **  Header info table
 **     Final (null) entry contains the flags used for any other field.
@@ -49,25 +46,35 @@ SCCSID(@(#)conf.c   3.55            %G%);
 
 struct hdrinfo HdrInfo[] =
 {
 
 struct hdrinfo HdrInfo[] =
 {
-       "date",                 H_CHECK,                M_NEEDDATE,
-       "from",                 H_ADDR|H_FROM|H_CHECK,  M_NEEDFROM,
-       "original-from",        0,                      0,
-       "sender",               H_ADDR,                 0,
-       "full-name",            H_ACHECK,               M_FULLNAME,
-       "to",                   H_ADDR|H_RCPT,          0,
-       "cc",                   H_ADDR|H_RCPT,          0,
-       "bcc",                  H_ADDR|H_RCPT,          0,
-       "message-id",           0,                      0,
-       "message",              H_EOH,                  0,
-       "text",                 H_EOH,                  0,
-       "posted-date",          0,                      0,
-       "return-receipt-to",    0,                      0,
-       "received-date",        H_CHECK,                M_LOCAL,
-       "received-from",        H_CHECK,                M_LOCAL,
-       "precedence",           0,                      0,
-       "received",             H_FORCE,                0,
-       "via",                  H_FORCE,                0,
-       NULL,                   0,                      0,
+               /* originator fields, most to least significant  */
+       "resent-sender",        H_FROM|H_RESENT,
+       "resent-from",          H_FROM|H_RESENT,
+       "sender",               H_FROM,
+       "from",                 H_FROM,
+       "full-name",            H_ACHECK,
+       "return-receipt-to",    H_FROM,
+       "errors-to",            H_FROM,
+               /* destination fields */
+       "to",                   H_RCPT,
+       "resent-to",            H_RCPT|H_RESENT,
+       "cc",                   H_RCPT,
+       "resent-cc",            H_RCPT|H_RESENT,
+       "bcc",                  H_RCPT|H_ACHECK,
+       "resent-bcc",           H_RCPT|H_ACHECK|H_RESENT,
+               /* message identification and control */
+       "message-id",           0,
+       "resent-message-id",    H_RESENT,
+       "message",              H_EOH,
+       "text",                 H_EOH,
+               /* date fields */
+       "date",                 0,
+       "resent-date",          H_RESENT,
+               /* trace fields */
+       "received",             H_TRACE|H_FORCE,
+       "via",                  H_TRACE|H_FORCE,
+       "mail-from",            H_TRACE|H_FORCE,
+
+       NULL,                   0,
 };
 
 
 };
 
 
@@ -82,44 +89,22 @@ char        Arpa_Usrerr[] =         "554";  /* some (fatal) user error */
 
 
 
 
 
 
-
-
 /*
 **  Location of system files/databases/etc.
 */
 
 /*
 **  Location of system files/databases/etc.
 */
 
-char   *AliasFile =    "/usr/lib/aliases";     /* alias file */
 char   *ConfFile =     "/usr/lib/sendmail.cf"; /* runtime configuration */
 char   *ConfFile =     "/usr/lib/sendmail.cf"; /* runtime configuration */
-char   *StatFile =     "/usr/lib/sendmail.st"; /* statistics summary */
-char   *HelpFile =     "/usr/lib/sendmail.hf"; /* help file */
-# ifdef QUEUE
-char   *QueueDir =     "/usr/spool/mqueue";    /* queue of saved mail */
-# else QUEUE
-char   *QueueDir =     "/tmp";                 /* location of temp files */
-# endif QUEUE
-char   *XcriptFile =   "/tmp/mailxXXXXXX";     /* template for transcript */
-
-
-/*
-**  Other configuration.
-*/
-
-int    DefUid =        1;              /* the uid to execute mailers as */
-int    DefGid =        1;              /* ditto for gid */
-time_t TimeOut =       3*24*60*60L;    /* default timeout for queue files */
-int    ReadTimeout =   10*60;          /* timeout on external reads */
-int    LogLevel =      9;              /* default logging level */
+char   *FreezeFile =   "/usr/lib/sendmail.fc"; /* frozen version of above */
 
 
 
 /*
 
 
 
 /*
-**  V6 system configuration.
+**  Some other configuration....
 */
 
 */
 
-# ifdef V6
-char   *StdTimezone =  "PST";          /* std time timezone */
-char   *DstTimezone =  "PDT";          /* daylight time timezone */
-# endif V6
+char   SpaceSub =      '.';    /* character to replace <lwsp> in addrs */
+int    QueueLA =       8;      /* load avg > QueueLA -> just queue */
+int    RefuseLA =      12;     /* load avg > RefuseLA -> refuse connections */
 \f
 # ifdef V6
 /*
 \f
 # ifdef V6
 /*
@@ -285,7 +270,7 @@ getegid()
 
 getruid()
 {
 
 getruid()
 {
-       if (Mode == MD_DAEMON)
+       if (OpMode == MD_DAEMON)
                return (RealUid);
        else
                return (getuid());
                return (RealUid);
        else
                return (getuid());
@@ -298,7 +283,7 @@ getruid()
 
 getrgid()
 {
 
 getrgid()
 {
-       if (Mode == MD_DAEMON)
+       if (OpMode == MD_DAEMON)
                return (RealGid);
        else
                return (getgid());
                return (RealGid);
        else
                return (getgid());
@@ -306,6 +291,29 @@ getrgid()
 
 # endif V6
 \f/*
 
 # endif V6
 \f/*
+**  USERNAME -- return the user id of the logged in user.
+**
+**     Parameters:
+**             none.
+**
+**     Returns:
+**             The login name of the logged in user.
+**
+**     Side Effects:
+**             none.
+**
+**     Notes:
+**             The return value is statically allocated.
+*/
+
+char *
+username()
+{
+       extern char *getlogin();
+
+       return (getlogin());
+}
+\f/*
 **  TTYPATH -- Get the path of the user's tty
 **
 **     Returns the pathname of the user's tty.  Returns NULL if
 **  TTYPATH -- Get the path of the user's tty
 **
 **     Returns the pathname of the user's tty.  Returns NULL if
@@ -340,7 +348,8 @@ ttypath()
        extern char *getlogin();
 
        /* compute the pathname of the controlling tty */
        extern char *getlogin();
 
        /* compute the pathname of the controlling tty */
-       if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL && (pathn = ttyname(0)) == NULL)
+       if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL &&
+           (pathn = ttyname(0)) == NULL)
        {
                errno = 0;
                return (NULL);
        {
                errno = 0;
                return (NULL);
@@ -390,23 +399,107 @@ bool
 checkcompat(to)
        register ADDRESS *to;
 {
 checkcompat(to)
        register ADDRESS *to;
 {
-# ifdef ING70
+# ifdef lint
+       if (to == NULL)
+               to++;
+# endif lint
+# ifdef EXAMPLE_CODE
+       /* this code is intended as an example only */
        register STAB *s;
        register STAB *s;
-# endif ING70
 
 
-       if (to->q_mailer != LocalMailer && CurEnv->e_msgsize > 100000)
-       {
-               usrerr("Message exceeds 100000 bytes");
-               NoReturn++;
-               return (FALSE);
-       }
-# ifdef ING70
        s = stab("arpa", ST_MAILER, ST_FIND);
        s = stab("arpa", ST_MAILER, ST_FIND);
-       if (s != NULL && CurEnv->e_from.q_mailer != LocalMailer && to->q_mailer == s->s_mailer)
+       if (s != NULL && CurEnv->e_from.q_mailer != LocalMailer &&
+           to->q_mailer == s->s_mailer)
        {
                usrerr("No ARPA mail through this machine: see your system administration");
        {
                usrerr("No ARPA mail through this machine: see your system administration");
+               /* NoReturn = TRUE; to supress return copy */
                return (FALSE);
        }
                return (FALSE);
        }
-# endif ING70
+# endif EXAMPLE_CODE
        return (TRUE);
 }
        return (TRUE);
 }
+\f/*
+**  HOLDSIGS -- arrange to hold all signals
+**
+**     Parameters:
+**             none.
+**
+**     Returns:
+**             none.
+**
+**     Side Effects:
+**             Arranges that signals are held.
+*/
+
+holdsigs()
+{
+}
+\f/*
+**  RLSESIGS -- arrange to release all signals
+**
+**     This undoes the effect of holdsigs.
+**
+**     Parameters:
+**             none.
+**
+**     Returns:
+**             none.
+**
+**     Side Effects:
+**             Arranges that signals are released.
+*/
+
+rlsesigs()
+{
+}
+\f/*
+**  GETLA -- get the current load average
+**
+**     Parameters:
+**             none.
+**
+**     Returns:
+**             The current load average as an integer.
+**
+**     Side Effects:
+**             none.
+*/
+
+#ifdef VMUNIX
+
+#include <nlist.h>
+
+struct nlist Nl[] =
+{
+       { "_avenrun" },
+#define        X_AVENRUN       0
+       { 0 },
+};
+
+getla()
+{
+       static int kmem = -1;
+       double avenrun[3];
+
+       if (kmem < 0)
+       {
+               kmem = open("/dev/kmem", 0);
+               if (kmem < 0)
+                       return (-1);
+               nlist("/vmunix", Nl);
+               if (Nl[0].n_type == 0)
+                       return (-1);
+       }
+       (void) lseek(kmem, (long) Nl[X_AVENRUN].n_value, 0);
+       (void) read(kmem, avenrun, sizeof(avenrun));
+       return ((int) (avenrun[0] + 0.5));
+}
+
+#else VMUNIX
+
+getla()
+{
+       return (0);
+}
+
+#endif VMUNIX