Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jan 2017 04:57:22 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311581 - head/usr.bin/users
Message-ID:  <201701070457.v074vMHB082049@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude
Date: Sat Jan  7 04:57:21 2017
New Revision: 311581
URL: https://svnweb.freebsd.org/changeset/base/311581

Log:
  Capsicum: add capability mode to users binary
  
  Submitted by:	Tyler Littlefield <tyler@tysdomain.com>
  Reviewed by:	cem, oshogbo
  Differential Revision:	https://reviews.freebsd.org/D9046

Modified:
  head/usr.bin/users/users.cc

Modified: head/usr.bin/users/users.cc
==============================================================================
--- head/usr.bin/users/users.cc	Sat Jan  7 02:16:48 2017	(r311580)
+++ head/usr.bin/users/users.cc	Sat Jan  7 04:57:21 2017	(r311581)
@@ -27,9 +27,12 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/capsicum.h>
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include <err.h>
+#include <errno.h>
 #include <utmpx.h>
 
 #include <algorithm>
@@ -51,6 +54,10 @@ main(int argc, char **)
 	}
 
 	setutxent();
+
+	if (cap_enter() < 0 && errno != ENOSYS)
+		err(1, "Failed to enter capability mode.");
+
 	while ((ut = getutxent()) != NULL)
 		if (ut->ut_type == USER_PROCESS)
 			names.insert(ut->ut_user);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701070457.v074vMHB082049>