cifs: Add support for reading SFU symlink location
authorPali Rohár <pali@kernel.org>
Thu, 12 Sep 2024 12:05:43 +0000 (14:05 +0200)
committerSteve French <stfrench@microsoft.com>
Sun, 15 Sep 2024 15:42:45 +0000 (10:42 -0500)
commitcf2ce67345d6a1af0853d8a7aef9ab8e6ea597d5
treec0f74f31f94349b8cf627583335d345acb823c43
parent89c601ab7cb3f520d59a653ddde2dfddd50986fb
cifs: Add support for reading SFU symlink location

Currently when sfu mount option is specified then CIFS can recognize SFU
symlink, but is not able to read symlink target location. readlink()
syscall just returns that operation is not supported.

Implement this missing functionality in cifs_sfu_type() function. Read
target location of SFU-style symlink, parse it and fill into fattr's
cf_symlink_target member.

SFU-style symlink is file which has system attribute set and file content
is buffer "IntxLNK\1" (8th byte is 0x01) followed by the target location
encoded in little endian UCS-2/UTF-16. This format was introduced in
Interix 3.0 subsystem, as part of the Microsoft SFU 3.0 and is used also by
all later versions. Previous versions had no symlink support.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/inode.c