Project

General

Profile

Bug #11525

smbsrv long filename

Added by John Huang 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:

Description

I use Windows Chinese version, use zfs set sharesmb=zfsshare testpool/winshare, set a share to windows.
In windows, I create a 100 Chinese characters name file on zfs share, it is success, but can not open. the filename is become to 85 Chinese character.
In windows, filename is a Unicode string, max length is 256 character, but in utf-8, one Chinese character is 3 bytes.
In zfs, use utf-8 as filename, zfs filename max length is 256, only 85 Chinese characters filename.
In smbsrv should be return ENAMETOOLONG for long Chinese file/directory name.
--- /allsrc/openindiana/illumos-gate/usr/src/uts/common/fs/smbsrv/smb_pathname.c Sat Nov 7 15:26:08 2015
++ smb_pathname.c Tue Aug 6 17:50:55 2019
@ -272,6 +272,15 @
(void) strlcpy(last_component, ".", MAXNAMELEN);
} else {
(void) pn_setlast(&ppn);
if (strlen(ppn.pn_path) >= MAXNAMELEN) {
+ (void) pn_free(&ppn);
+ kmem_free(usepath, SMB_MAXPATHLEN);
+ if (vss_cur_node != NULL)
+ (void) smb_node_release(vss_cur_node);
+ if (vss_root_node != NULL)
+ (void) smb_node_release(vss_root_node);
+ return (ENAMETOOLONG);
+ }
(void) strlcpy(last_component, ppn.pn_path, MAXNAMELEN);
ppn.pn_path0 = '\0';
}

Also available in: Atom PDF