summaryrefslogtreecommitdiff
path: root/sys/fs/nfs/nfs_commonsubs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/nfs/nfs_commonsubs.c')
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 76ee9e2c82bdc..5c50dfd430a27 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -65,6 +65,7 @@ uid_t nfsrv_defaultuid;
gid_t nfsrv_defaultgid;
int nfsrv_lease = NFSRV_LEASE;
int ncl_mbuf_mlen = MLEN;
+int nfsd_enable_stringtouid = 0;
NFSNAMEIDMUTEX;
NFSSOCKMUTEX;
@@ -2640,9 +2641,14 @@ nfsv4_strtouid(struct nfsrv_descript *nd, u_char *str, int len, uid_t *uidp,
/* If a string of digits and an AUTH_SYS mount, just convert it. */
str0 = str;
tuid = (uid_t)strtoul(str0, &endstr, 10);
- if ((endstr - str0) == len &&
- (nd->nd_flag & (ND_KERBV | ND_NFSCL)) == ND_NFSCL) {
- *uidp = tuid;
+ if ((endstr - str0) == len) {
+ /* A numeric string. */
+ if ((nd->nd_flag & ND_KERBV) == 0 &&
+ ((nd->nd_flag & ND_NFSCL) != 0 ||
+ nfsd_enable_stringtouid != 0))
+ *uidp = tuid;
+ else
+ error = NFSERR_BADOWNER;
goto out;
}
/*
@@ -2845,9 +2851,14 @@ nfsv4_strtogid(struct nfsrv_descript *nd, u_char *str, int len, gid_t *gidp,
/* If a string of digits and an AUTH_SYS mount, just convert it. */
str0 = str;
tgid = (gid_t)strtoul(str0, &endstr, 10);
- if ((endstr - str0) == len &&
- (nd->nd_flag & (ND_KERBV | ND_NFSCL)) == ND_NFSCL) {
- *gidp = tgid;
+ if ((endstr - str0) == len) {
+ /* A numeric string. */
+ if ((nd->nd_flag & ND_KERBV) == 0 &&
+ ((nd->nd_flag & ND_NFSCL) != 0 ||
+ nfsd_enable_stringtouid != 0))
+ *gidp = tgid;
+ else
+ error = NFSERR_BADOWNER;
goto out;
}
/*