about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-01 12:36:02 -0500
committerJune McEnroe <june@causal.agency>2021-02-01 12:36:02 -0500
commit1f51dfbad6710b28f244a8df6e5489c14e3c295b (patch)
tree3463d1793c21479d37f05fbb49f2abb1ee647e8a
parentAdd Repology links to README (diff)
downloadpounce-1f51dfbad6710b28f244a8df6e5489c14e3c295b.tar.gz
pounce-1f51dfbad6710b28f244a8df6e5489c14e3c295b.zip
Drop pledge capabilities after binding and connecting
-rw-r--r--bounce.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bounce.c b/bounce.c
index 31ca4a6..d0bccfc 100644
--- a/bounce.c
+++ b/bounce.c
@@ -356,7 +356,7 @@ int main(int argc, char *argv[]) {
 	error = unveil(tls_default_ca_cert_file(), "r");
 	if (error) err(EX_OSFILE, "%s", tls_default_ca_cert_file());
 
-	error = pledge("stdio rpath wpath cpath inet flock unix dns recvfd", NULL);
+	error = pledge("stdio rpath wpath cpath flock inet dns unix recvfd", NULL);
 	if (error) err(EX_OSERR, "pledge");
 #endif
 
@@ -423,6 +423,16 @@ int main(int argc, char *argv[]) {
 	serverConfig(insecure, trust, clientCert, clientPriv);
 	int server = serverConnect(serverBindHost, host, port);
 
+#ifdef __OpenBSD__
+	char promises[64];
+	snprintf(
+		promises, sizeof(promises), "stdio rpath inet%s",
+		(bindPath[0] ? " cpath unix recvfd" : "")
+	);
+	error = pledge(promises, NULL);
+	if (error) err(EX_OSERR, "pledge");
+#endif
+
 #ifdef __FreeBSD__
 	error = cap_enter();
 	if (error) err(EX_OSERR, "cap_enter");
>cgit.c: Do not reset HOME after unsetting it.Jason A. Donenfeld 2013-05-25cgit.c: sync repo config printing with struct cgit_repoJason A. Donenfeld 2013-05-25git: update to 1.8.3John Keeping 2013-05-22cache.c: cache ls_cache output properlyJohn Keeping 2013-05-22tests: introduce strip_header() helper functionJohn Keeping 2013-05-22shared.c: use die_errno() where appropriateJohn Keeping 2013-05-22html.c: die when write failsJohn Keeping 2013-05-22ui-log: add <span/> around commit decorationsJohn Keeping 2013-05-22Makefile: fix parallel "make test"John Keeping 2013-05-18cache.c: fix cache_lsJohn Keeping 2013-05-13t0109: "function" is a bash-ismJohn Keeping 2013-05-13New mailing list.Jason A. Donenfeld 2013-04-30ui-snapshot: do not access $HOMEJason A. Donenfeld 2013-04-27t0001: validate Git -rcN version numbers correctlyJohn Keeping 2013-04-27git: update to 1.8.2.2John Keeping 2013-04-17scan-tree: fix regression in section-from-path=-1John Keeping 2013-04-15t0001: ignore ".dirty" suffix on Git versionJohn Keeping 2013-04-15tests: set TEST_OUTPUT_DIRECTORY to the CGit test directoryJohn Keeping 2013-04-15t0109: test more URLsJohn Keeping 2013-04-10cgitrc.5.txt: Specify when scan-path must be defined before.Jason A. Donenfeld 2013-04-10ui-snapshot.c: Prepend "V" when guessing ref namesLukas Fleischer 2013-04-10t0107: Skip ZIP tests if unzip(1) isn't availableLukas Fleischer 2013-04-10tests/: Do not use `sed -i`Lukas Fleischer 2013-04-10Add branch-sort and repo.branch-sort options.Jason A. Donenfeld 2013-04-10t0109: chain operations with &&John Keeping 2013-04-10cgit.c: Do not restore unset environment variablesLukas Fleischer 2013-04-09t0107: Use `tar -z` for gzip'ed archivesLukas Fleischer