summaryrefslogtreecommitdiffstats
path: root/libexec/rpc.rstatd
diff options
context:
space:
mode:
authorthib <thib@openbsd.org>2009-05-20 20:37:43 +0000
committerthib <thib@openbsd.org>2009-05-20 20:37:43 +0000
commitac4529fad608a7cc1aec62eb10e8d6610fafb35b (patch)
tree92abdce57a752929430efa6c2f25b496442b2709 /libexec/rpc.rstatd
parentsync (diff)
downloadwireguard-openbsd-ac4529fad608a7cc1aec62eb10e8d6610fafb35b.tar.xz
wireguard-openbsd-ac4529fad608a7cc1aec62eb10e8d6610fafb35b.zip
Do not fall back to using nobody if _user is missing, but
error out. Add a new user _rwalld for rpc.rwalld, and use that instead of nobody, also unconditionally drop to _rwalld not only if rpc.rwalld was started with euid 0 (as root). ok deraadt@
Diffstat (limited to 'libexec/rpc.rstatd')
-rw-r--r--libexec/rpc.rstatd/rstatd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libexec/rpc.rstatd/rstatd.c b/libexec/rpc.rstatd/rstatd.c
index d1b8921b3c7..7c2d8f4e56a 100644
--- a/libexec/rpc.rstatd/rstatd.c
+++ b/libexec/rpc.rstatd/rstatd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rstatd.c,v 1.21 2005/09/16 23:50:33 deraadt Exp $ */
+/* $OpenBSD: rstatd.c,v 1.22 2009/05/20 20:37:43 thib Exp $ */
/*-
* Copyright (c) 1993, John Brezak
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: rstatd.c,v 1.21 2005/09/16 23:50:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rstatd.c,v 1.22 2009/05/20 20:37:43 thib Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -77,9 +77,10 @@ main(int argc, char *argv[])
openlog("rpc.rstatd", LOG_NDELAY|LOG_CONS|LOG_PID, LOG_DAEMON);
- pw = getpwnam("_rstatd");
- if (!pw)
- pw = getpwnam("nobody");
+ if ((pw = getpwnam("_rstatd")) == NULL) {
+ syslog(LOG_ERR, "no such user _rstatd");
+ exit(1);
+ }
if (chroot("/var/empty") == -1) {
syslog(LOG_ERR, "cannot chdir to /var/empty.");
exit(1);