Skip to content

Commit c2ccf53

Browse files
jtlaytonsmfrench
authored andcommitted
cifs: add new case-insensitive conversion routines that are based on wchar_t's
The existing NLS case conversion routines do not appropriately handle the (now common) case where the local host is using UTF8. This is because nls_utf8 has no support at all for converting a utf8 string between cases and the NLS infrastructure in general cannot handle a multibyte input character. In any case, what we really need for cifs is to emulate how we expect the server to convert the character to upper or lowercase. Thus, even if we had routines that could handle utf8 case conversion, we likely would end up with the wrong result if the name ends up being in the upper planes. This patch adds a new scheme for doing unicode case conversion. The case conversion tables that Microsoft has published for Windows 8 have been converted to a set of lookup tables, and a routine is added to convert a wchar_t from lower to uppercase using those tables. Reported-and-Tested-by: Jan-Marek Glogowski <glogow@fbihome.de> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
1 parent 4adf53a commit c2ccf53

3 files changed

Lines changed: 664 additions & 1 deletion

File tree

‎fs/cifs/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ obj-$(CONFIG_CIFS) += cifs.o
66
cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \
77
link.o misc.o netmisc.o smbencrypt.o transport.o asn1.o \
88
cifs_unicode.o nterr.o xattr.o cifsencrypt.o \
9-
readdir.o ioctl.o sess.o export.o smb1ops.o
9+
readdir.o ioctl.o sess.o export.o smb1ops.o winucase.o
1010

1111
cifs-$(CONFIG_CIFS_ACL) += cifsacl.o
1212

‎fs/cifs/cifs_unicode.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ extern __le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
9191
#endif /* CONFIG_CIFS_SMB2 */
9292
#endif
9393

94+
wchar_t cifs_toupper(wchar_t in);
95+
9496
/*
9597
* UniStrcat: Concatenate the second string to the first
9698
*

0 commit comments

Comments
 (0)