FreeBSD: Enter capabilities mode if restricted

master
C. McEnroe 2021-06-24 17:05:12 -04:00
parent fece6e6eb6
commit 16b34e5cd2
1 changed files with 11 additions and 0 deletions

11
chat.c
View File

@ -46,6 +46,10 @@
#include <tls.h> #include <tls.h>
#include <unistd.h> #include <unistd.h>
#ifdef __FreeBSD__
#include <sys/capsicum.h>
#endif
#include "chat.h" #include "chat.h"
#ifndef OPENSSL_BIN #ifndef OPENSSL_BIN
@ -314,6 +318,13 @@ int main(int argc, char *argv[]) {
if (error) err(EX_OSERR, "pledge"); if (error) err(EX_OSERR, "pledge");
#endif #endif
#ifdef __FreeBSD__
if (self.restricted) {
int error = cap_enter();
if (error) err(EX_OSERR, "cap_enter");
}
#endif
if (pass) ircFormat("PASS :%s\r\n", pass); if (pass) ircFormat("PASS :%s\r\n", pass);
if (sasl) ircFormat("CAP REQ :sasl\r\n"); if (sasl) ircFormat("CAP REQ :sasl\r\n");
ircFormat("CAP LS\r\n"); ircFormat("CAP LS\r\n");