Project

General

Profile

Bug #11525

smbsrv long filename

Added by John Huang 12 months ago. Updated about 1 month ago.

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

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

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_path[0] = '\0';
        }

History

#1

Updated by Joshua M. Clulow about 1 month ago

  • Description updated (diff)
  • Project changed from site to illumos gate

Also available in: Atom PDF