don't step on user environment
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 25 Sep 1985 06:09:56 +0000 (22:09 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 25 Sep 1985 06:09:56 +0000 (22:09 -0800)
SCCS-vsn: usr.sbin/sendmail/src/conf.h 5.4
SCCS-vsn: usr.sbin/sendmail/src/conf.c 5.9
SCCS-vsn: usr.sbin/sendmail/src/main.c 5.8
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 5.6
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 5.5
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.24

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/conf.h
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/version.c

index 2e8252c..642aa29 100644 (file)
@@ -9,7 +9,7 @@
 */
 
 #ifndef lint
 */
 
 #ifndef lint
-static char    SccsId[] = "@(#)conf.c  5.8 (Berkeley) %G%";
+static char    SccsId[] = "@(#)conf.c  5.9 (Berkeley) %G%";
 #endif not lint
 
 # include <pwd.h>
 #endif not lint
 
 # include <pwd.h>
index 5ddaad1..45bd9ae 100644 (file)
@@ -7,7 +7,7 @@
 **  All rights reserved.  The Berkeley software License Agreement
 **  specifies the terms and conditions for redistribution.
 **
 **  All rights reserved.  The Berkeley software License Agreement
 **  specifies the terms and conditions for redistribution.
 **
-**     @(#)conf.h      5.3 (Berkeley) %G%
+**     @(#)conf.h      5.4 (Berkeley) %G%
 */
 
 /*
 */
 
 /*
@@ -31,6 +31,7 @@
 # define MAXRWSETS     30              /* max # of sets of rewriting rules */
 # define MAXPRIORITIES 25              /* max values for Precedence: field */
 # define MAXTRUST      30              /* maximum number of trusted users */
 # define MAXRWSETS     30              /* max # of sets of rewriting rules */
 # define MAXPRIORITIES 25              /* max values for Precedence: field */
 # define MAXTRUST      30              /* maximum number of trusted users */
+# define MAXUSERENVIRON        40              /* max # of items in user environ */
 
 /*
 **  Compilation options.
 
 /*
 **  Compilation options.
index 6f3d9e5..fcc2f28 100644 (file)
@@ -9,7 +9,7 @@
 */
 
 #ifndef lint
 */
 
 #ifndef lint
-static char    SccsId[] = "@(#)deliver.c       5.5 (Berkeley) %G%";
+static char    SccsId[] = "@(#)deliver.c       5.6 (Berkeley) %G%";
 #endif not lint
 
 # include <signal.h>
 #endif not lint
 
 # include <signal.h>
@@ -849,7 +849,7 @@ openmailer(m, pvp, ctladdr, clever, pmfile, prfile)
 #endif FIOCLEX
 
                /* try to execute the mailer */
 #endif FIOCLEX
 
                /* try to execute the mailer */
-               execv(m->m_mailer, pvp);
+               execve(m->m_mailer, pvp, UserEnviron);
 
 #ifdef FIOCLEX
                syserr("Cannot exec %s", m->m_mailer);
 
 #ifdef FIOCLEX
                syserr("Cannot exec %s", m->m_mailer);
index 0594ae2..ccd2afd 100644 (file)
@@ -15,7 +15,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char    SccsId[] = "@(#)main.c  5.7 (Berkeley) %G%";
+static char    SccsId[] = "@(#)main.c  5.8 (Berkeley) %G%";
 #endif not lint
 
 # define  _DEFINE
 #endif not lint
 
 # define  _DEFINE
@@ -134,15 +134,6 @@ main(argc, argv, envp)
        extern ADDRESS *recipient();
        bool canrename;
 
        extern ADDRESS *recipient();
        bool canrename;
 
-# ifdef SETPROCTITLE
-       /*
-       **  Save start and extent of argv for setproctitle.
-       */
-
-       Argv = argv;
-       LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);
-# endif SETPROCTITLE
-
        /*
        **  Be sure we have enough file descriptors.
        */
        /*
        **  Be sure we have enough file descriptors.
        */
@@ -194,7 +185,19 @@ main(argc, argv, envp)
                readconfig = !thaw(FreezeFile);
 
        /* reset the environment after the thaw */
                readconfig = !thaw(FreezeFile);
 
        /* reset the environment after the thaw */
-       environ = envp;
+       for (i = 0; i < MAXUSERENVIRON && envp[i] != NULL; i++)
+               UserEnviron[i] = newstr(envp[i]);
+       UserEnviron[i] = NULL;
+       environ = UserEnviron;
+
+# ifdef SETPROCTITLE
+       /*
+       **  Save start and extent of argv for setproctitle.
+       */
+
+       Argv = argv;
+       LastArgv = envp[i - 1] + strlen(envp[i - 1]);
+# endif SETPROCTITLE
 
        /*
        **  Now do basic initialization
 
        /*
        **  Now do basic initialization
index a0d6e17..ca627d6 100644 (file)
@@ -7,7 +7,7 @@
 **  All rights reserved.  The Berkeley software License Agreement
 **  specifies the terms and conditions for redistribution.
 **
 **  All rights reserved.  The Berkeley software License Agreement
 **  specifies the terms and conditions for redistribution.
 **
-**     @(#)sendmail.h  5.4 (Berkeley) %G%
+**     @(#)sendmail.h  5.5 (Berkeley) %G%
 */
 
 /*
 */
 
 /*
@@ -19,7 +19,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 5.4             %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 5.5             %G%";
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
 # endif lint
 # else  _DEFINE
 # define EXTERN extern
@@ -540,6 +540,7 @@ EXTERN int  WkTimeFact;     /* priority offset each time this job is run */
 EXTERN int     CheckPointLimit;        /* deliveries before checkpointing */
 EXTERN char    *PostMasterCopy;        /* address to get errs cc's */
 EXTERN char    *TrustedUsers[MAXTRUST+1];      /* list of trusted users */
 EXTERN int     CheckPointLimit;        /* deliveries before checkpointing */
 EXTERN char    *PostMasterCopy;        /* address to get errs cc's */
 EXTERN char    *TrustedUsers[MAXTRUST+1];      /* list of trusted users */
+EXTERN char    *UserEnviron[MAXUSERENVIRON+1]; /* saved user environment */
 \f/*
 **  Trace information
 */
 \f/*
 **  Trace information
 */
index 55358af..7fb46a7 100644 (file)
@@ -9,7 +9,7 @@
 */
 
 #ifndef lint
 */
 
 #ifndef lint
-static char    SccsId[] = "@(#)version.c       5.23 (Berkeley) %G%";
+static char    SccsId[] = "@(#)version.c       5.24 (Berkeley) %G%";
 #endif not lint
 
 #endif not lint
 
-char   Version[] = "5.23";
+char   Version[] = "5.24";