From 891b0d9a8ec9f6326d8e122c6692e0197d57ded0 Mon Sep 17 00:00:00 2001 From: rmacklem Date: Sun, 8 Jan 2012 00:42:07 +0000 Subject: [PATCH 62/65] MFC: r228260 This patch adds a sysctl to the NFSv4 server which optionally disables the check for a UTF-8 compliant file name. Enabling this sysctl results in an NFSv4 server that is non-RFC3530 compliant, therefore it is not enabled by default. However, enabling this sysctl results in NFSv3 compatible behaviour and fixes the problem reported by "dan at sunsaturn.com" to freebsd-current@ on Nov. 14, 2011 under the subject "NFSV4 readlink_stat". git-svn-id: http://svn.freebsd.org/base/stable/9@229799 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit 8dc8551c509301d130468823185a7478a7134679) Signed-off-by: Xin Li --- sys/fs/nfsserver/nfs_nfsdsubs.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c index bd92c3f..5c8ecec 100644 --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -56,6 +56,13 @@ static nfstype newnfsv2_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, extern nfstype nfsv34_type[9]; #endif /* !APPLEKEXT */ +SYSCTL_DECL(_vfs_nfsd); + +static int disable_checkutf8 = 0; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, disable_checkutf8, CTLFLAG_RW, + &disable_checkutf8, 0, + "Disable the NFSv4 check for a UTF8 compliant name"); + static char nfsrv_hexdigit(char, int *); /* @@ -1963,7 +1970,8 @@ nfsrv_parsename(struct nfsrv_descript *nd, char *bufp, u_long *hashp, error = 0; goto nfsmout; } - if (nfsrv_checkutf8((u_int8_t *)bufp, outlen)) { + if (disable_checkutf8 == 0 && + nfsrv_checkutf8((u_int8_t *)bufp, outlen)) { nd->nd_repstat = NFSERR_INVAL; error = 0; goto nfsmout; -- 1.7.8.3