1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-22 02:50:28 +03:00

s3: smbd: In filename_convert_dirfsp(), allow SMB1+POSIX to traverse non-terminal symlinks.

This is the behavior of filename_convert() and
we need to allow it for the legacy SMB1+POSIX libsmbclient
libraries already deployed out there.

When we add SMB2 POSIX we must disallow symlink
traversal over any symlinks, the client must
resolve symlinks locally.

Add a note to show this is where we need to add
an error for SMB2+POSIX names with UCF_POSIX_PATHNAMES
set.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Jeremy Allison 2022-08-01 14:40:54 -07:00
parent 766151bf5b
commit 6fd8f7fd18

View File

@ -3081,12 +3081,17 @@ next:
return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
if (ucf_flags & UCF_POSIX_PATHNAMES) {
/*
* SMB1 posix never traverses symlinks
*/
return NT_STATUS_OBJECT_PATH_NOT_FOUND;
}
/*
* Right now, SMB2 and SMB1 always traverse symlinks
* within the share. SMB1+POSIX traverses non-terminal
* symlinks within the share.
*
* When we add SMB2+POSIX we need to return
* a NT_STATUS_STOPPED_ON_SYMLINK error here, using the
* symlink target data read below if SMB2+POSIX has
* UCF_POSIX_PATHNAMES set to cause the client to
* resolve all symlinks locally.
*/
target = symlink_target_path(mem_ctx, name_in, substitute, unparsed);
if (target == NULL) {