summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--chat.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/chat.c b/chat.c
index f455b35..87daccd 100644
--- a/chat.c
+++ b/chat.c
@@ -142,13 +142,7 @@ static void unveilData(const char *name) {
 	}
 }
 
-static void sandbox(const char *trust, const char *cert, const char *priv) {
-	int error = pledge(
-		"stdio rpath wpath cpath inet dns tty proc exec unveil", NULL
-	);
-	if (error) err(EX_OSERR, "pledge");
-	if (!self.restricted) return;
-
+static void unveilAll(const char *trust, const char *cert, const char *priv) {
 	dataMkdir("");
 	unveilData("");
 	if (trust) unveilConfig(trust);
@@ -161,7 +155,6 @@ static void sandbox(const char *trust, const char *cert, const char *priv) {
 	} paths[] = {
 		{ "/usr/share/terminfo", "r" },
 		{ tls_default_ca_cert_file(), "r" },
-		{ NULL, NULL },
 	};
 	for (size_t i = 0; i < ARRAY_LEN(paths); ++i) {
 		int error = unveil(paths[i].path, paths[i].perm);
@@ -285,7 +278,9 @@ int main(int argc, char *argv[]) {
 	commandCompleteAdd();
 
 #ifdef __OpenBSD__
-	sandbox(trust, cert, priv);
+	if (self.restricted) unveilAll(trust, cert, priv);
+	int error = pledge("stdio rpath wpath cpath inet dns tty proc exec", NULL);
+	if (error) err(EX_OSERR, "pledge");
 #endif
 
 	ircConfig(insecure, trust, cert, priv);
/a>June McEnroe 2021-02-07Enable mouse acceleration in XJune McEnroe 2021-02-07Set colours for Xt and cwmJune McEnroe 2021-02-07Set urgency on bell in xtermJune McEnroe 2021-02-07Add bindings for brightness controlJune McEnroe 2021-02-07Set X key repeat rateJune McEnroe 2021-02-07Bump font size to 12June McEnroe 2021-02-07Fully configure and rebind cwmJune McEnroe 2021-02-07Add BintiJune McEnroe 2021-02-07Finish configuring xtermJune McEnroe 2021-02-06Enable tapping, reverse scroll, set scaling in wsconsctlJune McEnroe 2021-02-06Set root window to black on purple snowJune McEnroe 2021-02-06Add xmodmap configurationJune McEnroe 2021-02-06Add initial OpenBSD X configurationJune McEnroe 2021-02-06Add xterm output to schemeJune McEnroe