[PATCHv2] smb3: allow files to be created with backslash in name

Steve French smfrench at gmail.com
Fri Dec 15 20:29:56 UTC 2023


Updated patch (rebased to current for-next-next)

Backslash is reserved in Windows (and SMB2/SMB3 by default) but
allowed in POSIX so must be remapped when POSIX extensions are
not enabled.

The default mapping for SMB3 mounts ("SFM") allows mapping backslash
(ie 0x5C in UTF8) to 0xF026 in UCS-2 (using the Unicode remapping
range reserved for these characters), but this was not mapped by
cifs.ko (unlike asterisk, greater than, question mark etc).  This patch
fixes that to allow creating files and directories with backslash
in the file or directory name.

Before this patch:
   touch "/mnt2/filewith\slash"
would return
   touch: setting times of '/mnt2/filewith\slash': Invalid argument

With the patch touch and mkdir with the backslash in the name works.

This problem was found while debugging xfstest generic/453
    https://bugzilla.kernel.org/show_bug.cgi?id=210961

Reported-by: Xiaoli Feng <xifeng at redhat.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=210961
Signed-off-by: Steve French <stfrench at microsoft.com>


@Paulo Alcantara  any thoughts if additional changes needed for DFS or
prefixpaths?

-- 
Thanks,

Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-smb3-allow-files-to-be-created-with-backslash-in-nam.patch
Type: text/x-patch
Size: 5859 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20231215/76a27ac0/0001-smb3-allow-files-to-be-created-with-backslash-in-nam.bin>


More information about the samba-technical mailing list