From owner-svn-src-all@freebsd.org Wed Sep 9 05:17:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 591AEA0087A; Wed, 9 Sep 2015 05:17:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FB4C1129; Wed, 9 Sep 2015 05:17:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t895H5wQ097337; Wed, 9 Sep 2015 05:17:05 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t895H4Qh097335; Wed, 9 Sep 2015 05:17:04 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509090517.t895H4Qh097335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Wed, 9 Sep 2015 05:17:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287590 - head/usr.bin/w X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 05:17:05 -0000 Author: delphij Date: Wed Sep 9 05:17:04 2015 New Revision: 287590 URL: https://svnweb.freebsd.org/changeset/base/287590 Log: w(1) is not setgid binary since r53279, so remove the setgid() call. Reviewed By: wollman MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D3541 Modified: head/usr.bin/w/Makefile head/usr.bin/w/w.c Modified: head/usr.bin/w/Makefile ============================================================================== --- head/usr.bin/w/Makefile Wed Sep 9 04:34:55 2015 (r287589) +++ head/usr.bin/w/Makefile Wed Sep 9 05:17:04 2015 (r287590) @@ -5,8 +5,6 @@ PROG= w SRCS= fmt.c pr_time.c proc_compare.c w.c MAN= w.1 uptime.1 LIBADD= kvm sbuf xo util -#BINGRP= kmem -#BINMODE=2555 LINKS= ${BINDIR}/w ${BINDIR}/uptime .PATH: ${.CURDIR}/../../bin/ps Modified: head/usr.bin/w/w.c ============================================================================== --- head/usr.bin/w/w.c Wed Sep 9 04:34:55 2015 (r287589) +++ head/usr.bin/w/w.c Wed Sep 9 05:17:04 2015 (r287590) @@ -135,7 +135,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, *save_p; char *x_suffix; char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX]; @@ -159,7 +159,6 @@ main(int argc, char *argv[]) p = "dhiflM:N:nsuw"; } - dropgid = 0; memf = _PATH_DEVNULL; nlistf = NULL; while ((ch = getopt(argc, argv, p)) != -1) @@ -176,11 +175,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; @@ -200,13 +197,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);