summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ncrcontrol/ncrcontrol.c
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1996-10-25 15:36:42 +0000
committerbde <bde@FreeBSD.org>1996-10-25 15:36:42 +0000
commit104718bd5b54b0538d55e0e075403d88e1f458e8 (patch)
treef837bb8c9e33f5d653515a0d42b5a9d109723d7d /usr.sbin/ncrcontrol/ncrcontrol.c
parentf0dc1eabd5b00fecfe0f98a48851c9866a2a42e0 (diff)
downloadFreeBSD-src-104718bd5b54b0538d55e0e075403d88e1f458e8.zip
FreeBSD-src-104718bd5b54b0538d55e0e075403d88e1f458e8.tar.gz
Made this work for non-root again. The security fixes in rev.1.11
were equivalent to disabling its setgid'ness, since the default kernel was not distinguished from a user-specified kernel.
Diffstat (limited to 'usr.sbin/ncrcontrol/ncrcontrol.c')
-rw-r--r--usr.sbin/ncrcontrol/ncrcontrol.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/usr.sbin/ncrcontrol/ncrcontrol.c b/usr.sbin/ncrcontrol/ncrcontrol.c
index da3f43c..6090b4a 100644
--- a/usr.sbin/ncrcontrol/ncrcontrol.c
+++ b/usr.sbin/ncrcontrol/ncrcontrol.c
@@ -1,6 +1,6 @@
/**************************************************************************
**
-** $Id: ncrcontrol.c,v 1.10 1995/12/28 14:40:59 se Exp $
+** $Id: ncrcontrol.c,v 1.11 1996/05/30 02:19:43 pst Exp $
**
** Utility for NCR 53C810 device driver.
**
@@ -181,15 +181,6 @@ void open_kvm(int flags)
if (kvm_isopen) return;
-#if (__FreeBSD__ >= 2)
- if (!vmunix) {
- vmunix = getbootfile();
- }
-#else
- if (!vmunix) {
- vmunix = _PATH_UNIX;
- }
-#endif
#if defined(__NetBSD__) || (__FreeBSD__ >= 2)
/*
* Discard setgid privileges if not the running kernel so that bad
@@ -197,6 +188,13 @@ void open_kvm(int flags)
*/
if (vmunix != NULL || kmemf != NULL)
setgid(getgid());
+ else {
+#if (__FreeBSD__ >= 2)
+ vmunix = getbootfile();
+#else
+ vmunix = _PATH_UNIX;
+#endif
+ }
kvm = kvm_openfiles(vmunix, kmemf, NULL, flags, errbuf);
if (kvm == NULL) {
@@ -204,6 +202,13 @@ void open_kvm(int flags)
exit(1);
}
#else
+ if (vmunix != NULL) {
+#if (__FreeBSD__ >= 2)
+ vmunix = getbootfile();
+#else
+ vmunix = _PATH_UNIX;
+#endif
+ }
if (kvm_openfiles(vmunix, kmemf, NULL) == -1) {
fprintf(stderr, "%s: kvm_openfiles: %s\n", prog, kvm_geterr());
exit(1);
OpenPOWER on IntegriCloud