From 1e69ed10cfe61c82b58b98d82ecba3c31163b44f Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Thu, 29 Nov 2018 12:20:49 -0500 Subject: Call cap_enter in client and server --- client.c | 9 +++++++++ server.c | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/client.c b/client.c index 7e41b5f..904ded7 100644 --- a/client.c +++ b/client.c @@ -33,6 +33,10 @@ #include #include +#ifdef __FreeBSD__ +#include +#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 cff6d21..a662efd 100644 --- a/server.c +++ b/server.c @@ -35,6 +35,7 @@ #ifdef __FreeBSD__ #include +#include #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"); -- cgit 1.4.1