]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
smb: client: disable path remapping with POSIX extensions
authorPhilipp Kerling <pkerling@casix.org>
Sun, 8 Jun 2025 18:59:00 +0000 (20:59 +0200)
committerSteve French <stfrench@microsoft.com>
Mon, 9 Jun 2025 20:59:03 +0000 (15:59 -0500)
If SMB 3.1.1 POSIX Extensions are available and negotiated, the client
should be able to use all characters and not remap anything. Currently, the
user has to explicitly request this behavior by specifying the "nomapposix"
mount option.

Link: https://lore.kernel.org/4195bb677b33d680e77549890a4f4dd3b474ceaf.camel@rx2.rx-server.de
Signed-off-by: Philipp Kerling <pkerling@casix.org>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Documentation/admin-guide/cifs/usage.rst
fs/smb/client/connect.c

index c09674a75a9e3c712339b3dd3b830397dadf4c84..d989ae5778ba317afefe95bfce6044ec38653463 100644 (file)
@@ -270,6 +270,8 @@ configured for Unix Extensions (and the client has not disabled
 illegal Windows/NTFS/SMB characters to a remap range (this mount parameter
 is the default for SMB3). This remap (``mapposix``) range is also
 compatible with Mac (and "Services for Mac" on some older Windows).
+When POSIX Extensions for SMB 3.1.1 are negotiated, remapping is automatically
+disabled.
 
 CIFS VFS Mount Options
 ======================
index 28bc334966237ae8e1948fd96837dedc14e8a40c..c4fb80b37738d388379976765580dcfd439e6aa4 100644 (file)
@@ -3718,9 +3718,15 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)
                goto out;
        }
 
-       /* if new SMB3.11 POSIX extensions are supported do not remap / and \ */
-       if (tcon->posix_extensions)
+       /*
+        * if new SMB3.11 POSIX extensions are supported, do not change anything in the
+        * path (i.e., do not remap / and \ and do not map any special characters)
+        */
+       if (tcon->posix_extensions) {
                cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS;
+               cifs_sb->mnt_cifs_flags &= ~(CIFS_MOUNT_MAP_SFM_CHR |
+                                            CIFS_MOUNT_MAP_SPECIAL_CHR);
+       }
 
 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
        /* tell server which Unix caps we support */