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
This commit is contained in:
Allan Jude 2017-01-07 04:57:21 +00:00
parent 4222790f35
commit 47312af69a

View File

@ -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);