From 0e2b30291c0e34b9f5e5d79913a83bdf7e98ea4c Mon Sep 17 00:00:00 2001 From: delphij Date: Wed, 23 Sep 2015 01:07:45 +0000 Subject: MFC r287590: w(1) is not setgid binary since r53279, so remove the setgid() call. Reviewed By: wollman --- usr.bin/w/Makefile | 2 -- usr.bin/w/w.c | 12 +----------- 2 files changed, 1 insertion(+), 13 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/w/Makefile b/usr.bin/w/Makefile index 1515a87..09ab7dc 100644 --- a/usr.bin/w/Makefile +++ b/usr.bin/w/Makefile @@ -6,8 +6,6 @@ SRCS= fmt.c pr_time.c proc_compare.c w.c MAN= w.1 uptime.1 DPADD= ${LIBKVM} ${LIBUTIL} LDADD= -lkvm -lutil -#BINGRP= kmem -#BINMODE=2555 LINKS= ${BINDIR}/w ${BINDIR}/uptime .PATH: ${.CURDIR}/../../bin/ps diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 1b9af5f..19fd190 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -132,7 +132,7 @@ main(int argc, char *argv[]) struct kinfo_proc *dkp; struct stat *stp; time_t touched; - int ch, i, nentries, nusers, wcmd, longidle, longattime, dropgid; + int ch, i, nentries, nusers, wcmd, longidle, longattime; const char *memf, *nlistf, *p; char *x_suffix; char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX]; @@ -152,7 +152,6 @@ main(int argc, char *argv[]) p = "dhiflM:N:nsuw"; } - dropgid = 0; memf = _PATH_DEVNULL; nlistf = NULL; while ((ch = getopt(argc, argv, p)) != -1) @@ -169,11 +168,9 @@ main(int argc, char *argv[]) case 'M': header = 0; memf = optarg; - dropgid = 1; break; case 'N': nlistf = optarg; - dropgid = 1; break; case 'n': nflag = 1; @@ -193,13 +190,6 @@ main(int argc, char *argv[]) _res.retrans = 2; /* resolver timeout to 2 seconds per try */ _res.retry = 1; /* only try once.. */ - /* - * Discard setgid privileges if not the running kernel so that bad - * guys can't print interesting stuff from kernel memory. - */ - if (dropgid) - setgid(getgid()); - if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf)) == NULL) errx(1, "%s", errbuf); -- cgit v1.1