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".

Tested by:	dan at sunsaturn.com
Reviewed by:	zack
MFC after:	2 weeks
This commit is contained in:
rmacklem 2011-12-04 16:33:04 +00:00
parent ff8355fd0a
commit e7537e2944

View File

@ -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;