[dev] [ii] [PATCH] Add OpenBSD unveil support

From: messw1thdbest <messw1thdbest_AT_protonmail.ch>
Date: Tue, 30 Jun 2020 10:16:16 +0000

Adds unveil(2) support to ii.

---
 ii.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/ii.c b/ii.c
index 7ca3ee8..d7f66ff 100644
--- a/ii.c
+++ b/ii.c
_AT_@ -829,7 +829,7 @@ main(int argc, char *argv[])
 #ifdef __OpenBSD__
 	/* OpenBSD pledge(2) support */
-	if (pledge("stdio rpath wpath cpath dpath", NULL) == -1) {
+	if (pledge("stdio rpath wpath cpath dpath unveil", NULL) == -1) {
 		fprintf(stderr, "%s: pledge: %s\n", argv0, strerror(errno));
 		exit(1);
 	}
_AT_@ -842,6 +842,15 @@ main(int argc, char *argv[])
 	}
 	create_dirtree(ircpath);
+#ifdef __OpenBSD__
+	/* OpenBSD unveil(2) support */
+	if (unveil(ircpath, "rwc") == -1 ||
+	    unveil(NULL, NULL) == -1 ) {
+		fprintf(stderr, "%s: unveil: %s\n", argv0, strerror(errno));
+		exit(1);
+	}
+#endif
+
 	channelmaster = channel_add(""); /* master channel */
 	if (key)
 		loginkey(ircfd, key);
--
2.26.2
Received on Tue Jun 30 2020 - 12:16:16 CEST

This archive was generated by hypermail 2.3.0 : Tue Jun 30 2020 - 12:24:08 CEST