mirror of
https://github.com/openbsd/src.git
synced 2026-04-16 10:14:35 +00:00
Fix unveil in NFS daemon.
With process accouting, nfsd(8) complains about unveil(2) violations. It happens during daemon(3) in the child process. Instead of unveiling / and /dev/null, move unveil(2) after daemon(3). OK deraadt@
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: nfsd.c,v 1.47 2025/11/30 23:07:17 jsg Exp $ */
|
||||
/* $OpenBSD: nfsd.c,v 1.48 2026/03/27 19:19:41 bluhm Exp $ */
|
||||
/* $NetBSD: nfsd.c,v 1.19 1996/02/18 23:18:56 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
@@ -113,15 +113,6 @@ main(int argc, char *argv[])
|
||||
/* Start by writing to both console and log. */
|
||||
openlog("nfsd", LOG_PID | LOG_PERROR, LOG_DAEMON);
|
||||
|
||||
if (unveil("/", "") == -1) {
|
||||
syslog(LOG_ERR, "unveil /: %s", strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
if (unveil(NULL, NULL) == -1) {
|
||||
syslog(LOG_ERR, "unveil: %s", strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
while ((ch = getopt(argc, argv, "n:rtu")) != -1)
|
||||
switch (ch) {
|
||||
case 'n':
|
||||
@@ -172,6 +163,15 @@ main(int argc, char *argv[])
|
||||
}
|
||||
(void)signal(SIGCHLD, reapchild);
|
||||
|
||||
if (unveil("/", "") == -1) {
|
||||
syslog(LOG_ERR, "unveil /: %s", strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
if (unveil(NULL, NULL) == -1) {
|
||||
syslog(LOG_ERR, "unveil: %s", strerror(errno));
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (reregister) {
|
||||
if (udpflag &&
|
||||
(!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) ||
|
||||
|
||||
Reference in New Issue
Block a user