summaryrefslogtreecommitdiff
path: root/fs/smb/common
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2024-09-28 13:21:24 +0200
committerSteve French <stfrench@microsoft.com>2024-11-25 14:50:32 -0600
commit06a7adf318a30bdcfa1222ed6d2640e6bb266d7b (patch)
treed4a9b8e78573968694d74dc60544188cd8a7d639 /fs/smb/common
parentdd26bc067e44956e43a273e6e0a9c1fc4ed32cb7 (diff)
downloadlinux-next-06a7adf318a30bdcfa1222ed6d2640e6bb266d7b.tar.gz
linux-next-06a7adf318a30bdcfa1222ed6d2640e6bb266d7b.zip
cifs: Add support for parsing WSL-style symlinks
Linux CIFS client currently does not implement readlink() for WSL-style symlinks. It is only able to detect that file is of WSL-style symlink, but is not able to read target symlink location. Add this missing functionality and implement support for parsing content of WSL-style symlink. The important note is that symlink target location stored for WSL symlink reparse point (IO_REPARSE_TAG_LX_SYMLINK) is in UTF-8 encoding instead of UTF-16 (which is used in whole SMB protocol and also in all other symlink styles). So for proper locale/cp support it is needed to do conversion from UTF-8 to local_nls. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/common')
-rw-r--r--fs/smb/common/smb2pdu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index 9f272cc8f566..3c7c706c797d 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1552,6 +1552,15 @@ struct reparse_symlink_data_buffer {
/* See MS-FSCC 2.1.2.6 and cifspdu.h for struct reparse_posix_data */
+/* For IO_REPARSE_TAG_LX_SYMLINK */
+struct reparse_wsl_symlink_data_buffer {
+ __le32 ReparseTag;
+ __le16 ReparseDataLength;
+ __u16 Reserved;
+ __le32 Flags;
+ __u8 PathBuffer[]; /* Variable Length UTF-8 string without nul-term */
+} __packed;
+
struct validate_negotiate_info_req {
__le32 Capabilities;
__u8 Guid[SMB2_CLIENT_GUID_SIZE];