Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Mar 2018 08:27:29 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r330464 - stable/11/usr.bin/users
Message-ID:  <201803050827.w258RTPj017587@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Mar  5 08:27:29 2018
New Revision: 330464
URL: https://svnweb.freebsd.org/changeset/base/330464

Log:
  MFC r311581:
  
  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:
  stable/11/usr.bin/users/users.cc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/users/users.cc
==============================================================================
--- stable/11/usr.bin/users/users.cc	Mon Mar  5 08:25:23 2018	(r330463)
+++ stable/11/usr.bin/users/users.cc	Mon Mar  5 08:27:29 2018	(r330464)
@@ -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?201803050827.w258RTPj017587>