aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2026-07-19 12:45:43 +0000
committerLexi Winter <ivy@FreeBSD.org>2026-07-19 12:45:43 +0000
commit02f174179a538f89185d275b4e64277baf3acc50 (patch)
tree5ab1c68500063d322ae108c66858d88047efed14
parentcb325dcedfa291c9bfe350a513694df3776a17a4 (diff)
-rw-r--r--usr.sbin/certctl/certctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.sbin/certctl/certctl.c b/usr.sbin/certctl/certctl.c
index 462f6c1730a9..5c2b83b89d57 100644
--- a/usr.sbin/certctl/certctl.c
+++ b/usr.sbin/certctl/certctl.c
@@ -523,6 +523,8 @@ write_certs(const char *dir, struct cert_tree *tree)
tmppath = xasprintf(".%s", path);
fd = openat(d, tmppath,
O_CREAT | O_WRONLY | O_EXCL, mode);
+ if (!unprivileged && fd >= 0)
+ (void)fchmod(fd, mode);
}
}
/* write the certificate */
@@ -594,6 +596,8 @@ write_bundle(const char *dir, const char *file, struct cert_tree *tree)
} else {
tmpfile = xasprintf(".%s", file);
fd = openat(d, tmpfile, O_WRONLY | O_CREAT | O_EXCL, mode);
+ if (!unprivileged && fd >= 0)
+ (void)fchmod(fd, mode);
}
if (fd < 0 || (f = fdopen(fd, "w")) == NULL) {
if (tmpfile != NULL && fd >= 0) {