aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2017-05-14 00:38:41 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2017-05-14 00:38:41 +0000
commit947572b4ee039db054d8bbdf26d6477da7a11c90 (patch)
tree711b5caab54245e36f287019dbe351a3a9985777
parent3a462c983d1a80553873a438729f063c6d645025 (diff)
downloadsrc-947572b4ee039db054d8bbdf26d6477da7a11c90.tar.gz
src-947572b4ee039db054d8bbdf26d6477da7a11c90.zip
Change the default uid/gid values for nobody/nogroup to 65534/65533.
The default values found in /etc/passwd and /etc/group are 65534, 65533. In mountd.c, the defaults were -2, which was 65534 back when uid_t was 16bits. Without this patch, a file created by root on an NFS exported volume without the "-root=" export option will end up owned by uid 4**32 - 2. When discussed on freebsd-current@, it seemed that users preferred the values being changed to 65534/65533. I have not added code to acquire these values from the databases, since the mountd daemon might get "stuck" during startup waiting for a non-responsive password database server. Discussed on: freebsd-current
Notes
Notes: svn path=/head/; revision=318262
-rw-r--r--usr.sbin/mountd/mountd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 206ef578c502..66c47255a518 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -230,9 +230,9 @@ static char **exnames;
static char **hosts = NULL;
static struct xucred def_anon = {
XUCRED_VERSION,
- (uid_t)-2,
+ (uid_t)65534,
1,
- { (gid_t)-2 },
+ { (gid_t)65533 },
NULL
};
static int force_v2 = 0;
@@ -2893,8 +2893,8 @@ parsecred(char *namelist, struct xucred *cr)
/*
* Set up the unprivileged user.
*/
- cr->cr_uid = -2;
- cr->cr_groups[0] = -2;
+ cr->cr_uid = 65534;
+ cr->cr_groups[0] = 65533;
cr->cr_ngroups = 1;
/*
* Get the user's password table entry.