summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/eeprom/main.c9
-rw-r--r--usr.sbin/iostat/iostat.c6
-rw-r--r--usr.sbin/pstat/pstat.c8
-rw-r--r--usr.sbin/slstats/slstats.c7
-rw-r--r--usr.sbin/trpt/trpt.c5
-rw-r--r--usr.sbin/trsp/trsp.c5
6 files changed, 31 insertions, 9 deletions
diff --git a/usr.sbin/eeprom/main.c b/usr.sbin/eeprom/main.c
index b5d06d5baff..48fccb98b8c 100644
--- a/usr.sbin/eeprom/main.c
+++ b/usr.sbin/eeprom/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.4 1996/07/22 02:01:50 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.5 1998/07/08 22:13:26 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1996/05/16 16:00:55 thorpej Exp $ */
/*-
@@ -161,8 +161,10 @@ main(argc, argv)
argv += optind;
#ifdef __sparc__
- if (system != NULL)
+ if (system != NULL) {
+ setegid(getgid());
setgid(getgid());
+ }
if (getcputype() != CPU_SUN4)
use_openprom = 1;
#endif /* __sparc__ */
@@ -223,6 +225,9 @@ getcputype()
if ((kd = kvm_openfiles(system, NULL, NULL, O_RDONLY, errbuf)) == NULL)
errx(1, "can't open kvm: %s", errbuf);
+ setegid(getgid());
+ setgid(getgid());
+
if (kvm_nlist(kd, nl))
KVM_ABORT(kd, "can't read symbol table");
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index 8b3ff50cb46..eb277cdd09e 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iostat.c,v 1.7 1997/01/15 23:44:01 millert Exp $ */
+/* $OpenBSD: iostat.c,v 1.8 1998/07/08 22:13:27 deraadt Exp $ */
/* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */
/*
@@ -182,6 +182,10 @@ main(argc, argv)
}
dkinit(0);
+
+ setegid(getgid());
+ setgid(getgid());
+
dkreadstats();
selectdrives(argc, argv);
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index 5388c6de08e..f53299c9601 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pstat.c,v 1.17 1998/06/25 17:04:29 deraadt Exp $ */
+/* $OpenBSD: pstat.c,v 1.18 1998/07/08 22:13:29 deraadt Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94";
#else
-static char *rcsid = "$OpenBSD: pstat.c,v 1.17 1998/06/25 17:04:29 deraadt Exp $";
+static char *rcsid = "$OpenBSD: pstat.c,v 1.18 1998/07/08 22:13:29 deraadt Exp $";
#endif
#endif /* not lint */
@@ -218,6 +218,10 @@ main(argc, argv)
if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == 0)
errx(1, "kvm_openfiles: %s", buf);
+
+ (void)setegid(getgid());
+ (void)setgid(getgid());
+
if ((ret = kvm_nlist(kd, nl)) != 0) {
if (ret == -1)
errx(1, "kvm_nlist: %s", kvm_geterr(kd));
diff --git a/usr.sbin/slstats/slstats.c b/usr.sbin/slstats/slstats.c
index 0f084193db1..e71609b31fb 100644
--- a/usr.sbin/slstats/slstats.c
+++ b/usr.sbin/slstats/slstats.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slstats.c,v 1.8 1998/03/19 07:32:08 deraadt Exp $ */
+/* $OpenBSD: slstats.c,v 1.9 1998/07/08 22:13:30 deraadt Exp $ */
/* $NetBSD: slstats.c,v 1.6.6.1 1996/06/07 01:42:30 thorpej Exp $ */
/*
@@ -25,7 +25,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: slstats.c,v 1.8 1998/03/19 07:32:08 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: slstats.c,v 1.9 1998/07/08 22:13:30 deraadt Exp $";
#endif
#define INET
@@ -143,6 +143,9 @@ main(argc, argv)
if ((kd = kvm_openfiles(kernel, kmemf, NULL, O_RDONLY, errbuf)) == NULL)
errx(1, "can't open kvm: %s", errbuf);
+ setegid(getgid());
+ setgid(getgid());
+
if (kvm_nlist(kd, nl) < 0 || nl[0].n_type == 0)
errx(1, "%s: SLIP symbols not in namelist",
kernel == NULL ? _PATH_UNIX : kernel);
diff --git a/usr.sbin/trpt/trpt.c b/usr.sbin/trpt/trpt.c
index f3f1fd78922..0ab9bff705f 100644
--- a/usr.sbin/trpt/trpt.c
+++ b/usr.sbin/trpt/trpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trpt.c,v 1.6 1997/09/08 09:23:15 deraadt Exp $ */
+/* $OpenBSD: trpt.c,v 1.7 1998/07/08 22:13:32 deraadt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -210,6 +210,9 @@ main(argc, argv)
if (kd == NULL)
errx(1, "can't open kmem: %s", errbuf);
+ setegid(getgid());
+ setgid(getgid());
+
if (kvm_nlist(kd, nl))
errx(2, "%s: no namelist", system ? system : _PATH_UNIX);
diff --git a/usr.sbin/trsp/trsp.c b/usr.sbin/trsp/trsp.c
index 74d7a12357e..cc6a7fd9ad8 100644
--- a/usr.sbin/trsp/trsp.c
+++ b/usr.sbin/trsp/trsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trsp.c,v 1.6 1997/09/12 04:07:23 millert Exp $ */
+/* $OpenBSD: trsp.c,v 1.7 1998/07/08 22:13:33 deraadt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -212,6 +212,9 @@ main(argc, argv)
if (kd == NULL)
errx(1, "can't open kmem: %s", errbuf);
+ setegid(getgid());
+ setgid(getgid());
+
if (kvm_nlist(kd, nl))
errx(2, "%s: no namelist", system ? system : _PATH_UNIX);