diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-06-26 13:11:21 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-06-26 13:11:21 +0000 |
commit | 6a3450e17844175e68319d0033e99226ca26c337 (patch) | |
tree | 23d8393a6a941ae0df11978cc54d9e825e4ef052 /sys/fs/nfs | |
parent | 16454bee3a2ccd6a7e13406d08d040adf97bfb36 (diff) | |
download | src-6a3450e17844175e68319d0033e99226ca26c337.tar.gz src-6a3450e17844175e68319d0033e99226ca26c337.zip |
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.
Reviewed by: rmacklem (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11326
Notes
Notes:
svn path=/head/; revision=320359
Diffstat (limited to 'sys/fs/nfs')
-rw-r--r-- | sys/fs/nfs/nfs_commonsubs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 3b62ef18af11..5367440bbd83 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -68,6 +68,7 @@ gid_t nfsrv_defaultgid = GID_NOGROUP; int nfsrv_lease = NFSRV_LEASE; int ncl_mbuf_mlen = MLEN; int nfsd_enable_stringtouid = 0; +int nfsd_enable_uidtostring = 0; NFSNAMEIDMUTEX; NFSSOCKMUTEX; extern int nfsrv_lughashsize; @@ -2561,7 +2562,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 && !nfsd_enable_uidtostring) { /* * Always map nfsrv_defaultuid to "nobody". */ @@ -2671,7 +2672,7 @@ nfsrv_getgrpscred(struct ucred *oldcred) cnt = 0; uid = oldcred->cr_uid; tryagain: - if (nfsrv_dnsnamelen > 0) { + if (nfsrv_dnsnamelen > 0 && !nfsd_enable_uidtostring) { hp = NFSUSERHASH(uid); mtx_lock(&hp->mtx); TAILQ_FOREACH(usrp, &hp->lughead, lug_numhash) { @@ -2823,7 +2824,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 && !nfsd_enable_uidtostring) { /* * Always map nfsrv_defaultgid to "nogroup". */ |