summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2017-05-07 20:11:58 +0000
committerrmacklem <rmacklem@FreeBSD.org>2017-05-07 20:11:58 +0000
commitd1f3556f95fb19df48e271e4266e8aaa95fd7a48 (patch)
treecb9974f3e1769df312348e7310018647bd66c929
parent31071e591bb2bcd0bb7e59fc4b223d717f945ab9 (diff)
downloadFreeBSD-src-d1f3556f95fb19df48e271e4266e8aaa95fd7a48.zip
FreeBSD-src-d1f3556f95fb19df48e271e4266e8aaa95fd7a48.tar.gz
MFC: r317269
Set default uid/gid to nobody/nogroup for NFSv4 mapping. The default uid/gid for NFSv4 are set by the nfsuserd(8) daemon. However, they were 0 until the nfsuserd(8) was run. Since it is possible to use NFSv4 without running the nfsuserd(8) daemon, set them to nobody/nogroup initially. Without this patch, the values would be set by the nfsuserd(8) daemon and left changed even if the nfsuserd(8) daemon was killed. The default values of 0 meant that setting a group to "wheel" would fail even when done by root. It also adds a definition of GID_NOGROUP to sys/conf.h.
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c4
-rw-r--r--sys/sys/conf.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 31cb151..8ed21a5 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -63,8 +63,8 @@ int nfsrv_useacl = 1;
struct nfssockreq nfsrv_nfsuserdsock;
int nfsrv_nfsuserd = 0;
struct nfsreqhead nfsd_reqq;
-uid_t nfsrv_defaultuid;
-gid_t nfsrv_defaultgid;
+uid_t nfsrv_defaultuid = UID_NOBODY;
+gid_t nfsrv_defaultgid = GID_NOGROUP;
int nfsrv_lease = NFSRV_LEASE;
int ncl_mbuf_mlen = MLEN;
int nfsd_enable_stringtouid = 0;
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 264a6d8..92b2301 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -315,6 +315,7 @@ void devfs_free_cdp_inode(ino_t ino);
#define GID_GAMES 13
#define GID_VIDEO 44
#define GID_DIALER 68
+#define GID_NOGROUP 65533
#define GID_NOBODY 65534
typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name,
OpenPOWER on IntegriCloud