summaryrefslogtreecommitdiff
path: root/usr.sbin/pppd/main.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-27 12:38:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-27 12:38:07 +0000
commit7ee7008b9866fe5d1857d59130234662b4a2c42c (patch)
tree43c9bcea7833fa7bb16e36b36a6101e8edfb23ed /usr.sbin/pppd/main.c
parentba5ff4ce6f3af1d5219022a9a2323a257ca09461 (diff)
pass a minimal environment ($PATH)
Diffstat (limited to 'usr.sbin/pppd/main.c')
-rw-r--r--usr.sbin/pppd/main.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index 2b2e9e0daac..db5f4c89f9e 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.9 1996/07/20 12:02:11 joshd Exp $ */
+/* $OpenBSD: main.c,v 1.10 1996/07/27 12:38:06 deraadt Exp $ */
/*
* main.c - Point-to-Point Protocol main module
@@ -20,7 +20,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: main.c,v 1.9 1996/07/20 12:02:11 joshd Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.10 1996/07/27 12:38:06 deraadt Exp $";
#endif
#include <stdio.h>
@@ -100,6 +100,11 @@ static int locked; /* lock() has succeeded */
char *no_ppp_msg = "Sorry - this system lacks PPP kernel support\n";
+static char *restricted_environ[] = {
+ "PATH=" _PATH_STDPATH,
+ NULL
+};
+
/* Prototypes for procedures local to this file. */
static void cleanup __P((void));
@@ -1037,8 +1042,6 @@ run_program(prog, args, must_exist)
int must_exist;
{
int pid;
- char *nullenv[1];
-
pid = fork();
if (pid == -1) {
@@ -1083,8 +1086,7 @@ run_program(prog, args, must_exist)
/* SysV recommends a second fork at this point. */
/* run the program; give it a null environment */
- nullenv[0] = NULL;
- execve(prog, args, nullenv);
+ execve(prog, args, restricted_environ);
if (must_exist || errno != ENOENT)
syslog(LOG_WARNING, "Can't execute %s: %m", prog);
_exit(-1);