about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-11-29 12:20:49 -0500
committerJune McEnroe <june@causal.agency>2018-11-29 12:20:49 -0500
commit807c8008b405464cd35d975f741759c600b3cc6d (patch)
tree034ba80a1d9e278dc593cfb87c97b49d5e8a3346
parentFix make clean (diff)
downloadtorus-807c8008b405464cd35d975f741759c600b3cc6d.tar.gz
torus-807c8008b405464cd35d975f741759c600b3cc6d.zip
Call cap_enter in client and server
Diffstat (limited to '')
-rw-r--r--client.c9
-rw-r--r--server.c4
2 files changed, 13 insertions, 0 deletions
diff --git a/client.c b/client.c
index de10060..6edcd6e 100644
--- a/client.c
+++ b/client.c
@@ -33,6 +33,10 @@
 #include <unistd.h>
 #include <wchar.h>
 
+#ifdef __FreeBSD__
+#include <sys/capsicum.h>
+#endif
+
 #include "torus.h"
 #include "help.h"
 
@@ -694,6 +698,11 @@ int main(int argc, char *argv[]) {
 	int error = connect(client, (struct sockaddr *)&addr, SUN_LEN(&addr));
 	if (error) err(EX_NOINPUT, "%s", sockPath);
 
+#ifdef __FreeBSD__
+	error = cap_enter();
+	if (error) err(EX_OSERR, "cap_enter");
+#endif
+
 	struct pollfd fds[2] = {
 		{ .fd = STDIN_FILENO, .events = POLLIN },
 		{ .fd = client, .events = POLLIN },
diff --git a/server.c b/server.c
index ade834d..47441cc 100644
--- a/server.c
+++ b/server.c
@@ -35,6 +35,7 @@
 
 #ifdef __FreeBSD__
 #include <libutil.h>
+#include <sys/capsicum.h>
 #endif
 
 #include "torus.h"
@@ -396,6 +397,9 @@ int main(int argc, char *argv[]) {
 	if (error) err(EX_CANTCREAT, "%s", sockPath);
 
 #ifdef __FreeBSD__
+	error = cap_enter();
+	if (error) err(EX_OSERR, "cap_enter");
+
 	if (pid) {
 		error = daemon(0, 0);
 		if (error) err(EX_OSERR, "daemon");