Skip to content

Commit 9331005

Browse files
pkerlingSteve French
authored andcommitted
smb: client: disable path remapping with POSIX extensions
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/[email protected] Signed-off-by: Philipp Kerling <[email protected]> Reviewed-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 19272b3 commit 9331005

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Documentation/admin-guide/cifs/usage.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ configured for Unix Extensions (and the client has not disabled
270270
illegal Windows/NTFS/SMB characters to a remap range (this mount parameter
271271
is the default for SMB3). This remap (``mapposix``) range is also
272272
compatible with Mac (and "Services for Mac" on some older Windows).
273+
When POSIX Extensions for SMB 3.1.1 are negotiated, remapping is automatically
274+
disabled.
273275

274276
CIFS VFS Mount Options
275277
======================

fs/smb/client/connect.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3718,9 +3718,15 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)
37183718
goto out;
37193719
}
37203720

3721-
/* if new SMB3.11 POSIX extensions are supported do not remap / and \ */
3722-
if (tcon->posix_extensions)
3721+
/*
3722+
* if new SMB3.11 POSIX extensions are supported, do not change anything in the
3723+
* path (i.e., do not remap / and \ and do not map any special characters)
3724+
*/
3725+
if (tcon->posix_extensions) {
37233726
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_POSIX_PATHS;
3727+
cifs_sb->mnt_cifs_flags &= ~(CIFS_MOUNT_MAP_SFM_CHR |
3728+
CIFS_MOUNT_MAP_SPECIAL_CHR);
3729+
}
37243730

37253731
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
37263732
/* tell server which Unix caps we support */

0 commit comments

Comments
 (0)