Browse Source

Call cap_enter in client and server

June 2 weeks ago
parent
commit
807c8008b4
Signed by: Curtis McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
2 changed files with 13 additions and 0 deletions
  1. 9
    0
      client.c
  2. 4
    0
      server.c

+ 9
- 0
client.c View File

@@ -33,6 +33,10 @@
33 33
 #include <unistd.h>
34 34
 #include <wchar.h>
35 35
 
36
+#ifdef __FreeBSD__
37
+#include <sys/capsicum.h>
38
+#endif
39
+
36 40
 #include "torus.h"
37 41
 #include "help.h"
38 42
 
@@ -694,6 +698,11 @@ int main(int argc, char *argv[]) {
694 698
 	int error = connect(client, (struct sockaddr *)&addr, SUN_LEN(&addr));
695 699
 	if (error) err(EX_NOINPUT, "%s", sockPath);
696 700
 
701
+#ifdef __FreeBSD__
702
+	error = cap_enter();
703
+	if (error) err(EX_OSERR, "cap_enter");
704
+#endif
705
+
697 706
 	struct pollfd fds[2] = {
698 707
 		{ .fd = STDIN_FILENO, .events = POLLIN },
699 708
 		{ .fd = client, .events = POLLIN },

+ 4
- 0
server.c View File

@@ -35,6 +35,7 @@
35 35
 
36 36
 #ifdef __FreeBSD__
37 37
 #include <libutil.h>
38
+#include <sys/capsicum.h>
38 39
 #endif
39 40
 
40 41
 #include "torus.h"
@@ -396,6 +397,9 @@ int main(int argc, char *argv[]) {
396 397
 	if (error) err(EX_CANTCREAT, "%s", sockPath);
397 398
 
398 399
 #ifdef __FreeBSD__
400
+	error = cap_enter();
401
+	if (error) err(EX_OSERR, "cap_enter");
402
+
399 403
 	if (pid) {
400 404
 		error = daemon(0, 0);
401 405
 		if (error) err(EX_OSERR, "daemon");

Loading…
Cancel
Save