summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2017-08-01 14:25:27 +0000
committertrasz <trasz@FreeBSD.org>2017-08-01 14:25:27 +0000
commit411850045d7a95eea21ad3f6213f1f5d338eb6fc (patch)
tree6ba99c66fee897795e5834ba1b96bb7ff2ac2199
parentc297328b55d9992625f27a8c8c7ed41d0b5691bc (diff)
downloadFreeBSD-src-411850045d7a95eea21ad3f6213f1f5d338eb6fc.zip
FreeBSD-src-411850045d7a95eea21ad3f6213f1f5d338eb6fc.tar.gz
MFC r320359:
Add vfs.nfsd.nfsd_enable_uidtostring, which works just like vfs.nfsd.nfsd_enable_stringtouid, but in reverse - when set to 1, it forces the NFSv4 server to return numeric UIDs and GIDs instead of "user@domain" strings. This helps with clients that can't translate returned identifiers, eg when rerooting. The same can be achieved by just never running nfsuserd(8), but the sysctl is useful to toggle the behaviour back and forth without rebooting. MFC r320409: Revert part of r320359, as suggested by rmacklem@. That case is only used for nfsuserd -manage-gids and shouldn't depend on sysctl. MFC r321196: Rename vfs.nfsd.enable_uidtostring to vfs.nfs.enable_uidtostring. It applies to both NFS client and NFS server, and is useful for both. This is different from vfs.nfsd.enable_stringtouid, which is specific to server side. Sponsored by: DARPA, AFRL
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 8328c91..373dc33 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -68,10 +68,15 @@ gid_t nfsrv_defaultgid = GID_NOGROUP;
int nfsrv_lease = NFSRV_LEASE;
int ncl_mbuf_mlen = MLEN;
int nfsd_enable_stringtouid = 0;
+static int nfs_enable_uidtostring = 0;
NFSNAMEIDMUTEX;
NFSSOCKMUTEX;
extern int nfsrv_lughashsize;
+SYSCTL_DECL(_vfs_nfs);
+SYSCTL_INT(_vfs_nfs, OID_AUTO, enable_uidtostring, CTLFLAG_RW,
+ &nfs_enable_uidtostring, 0, "Make nfs always send numeric owner_names");
+
/*
* This array of structures indicates, for V4:
* retfh - which of 3 types of calling args are used
@@ -2588,7 +2593,7 @@ nfsv4_uidtostr(uid_t uid, u_char **cpp, int *retlenp, NFSPROC_T *p)
cnt = 0;
tryagain:
- if (nfsrv_dnsnamelen > 0) {
+ if (nfsrv_dnsnamelen > 0 && !nfs_enable_uidtostring) {
/*
* Always map nfsrv_defaultuid to "nobody".
*/
@@ -2850,7 +2855,7 @@ nfsv4_gidtostr(gid_t gid, u_char **cpp, int *retlenp, NFSPROC_T *p)
cnt = 0;
tryagain:
- if (nfsrv_dnsnamelen > 0) {
+ if (nfsrv_dnsnamelen > 0 && !nfs_enable_uidtostring) {
/*
* Always map nfsrv_defaultgid to "nogroup".
*/
OpenPOWER on IntegriCloud