1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-23 06:50:21 +03:00

smbd: Return ISLNK from non_widelink_open() in smb_fname

Soon we want to not require stat() calls before entering
openat_pathref_fsp() anymore but rely on the fstat on the O_PATH file
handle (alternatively the call to fstatat(AT_SYMLINK_NOFOLLOW)) done
properly from within fd_openat(). The callers of non_widelink_open()
expect the stat information to be correct in "smb_fname". Copy it in
case of not opening a symlink in the posix case.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2022-01-08 10:08:16 +01:00 committed by Ralph Boehme
parent e7b933100e
commit de439cd030

View File

@ -858,7 +858,11 @@ static NTSTATUS non_widelink_open(const struct files_struct *dirfsp,
saved_status = status;
if (fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH) {
/* Never follow symlinks on posix open. */
/* Never follow symlinks on posix open, .. but
* pass the fact it's a symlink in
* smb_fname->st
*/
smb_fname->st = fsp->fsp_name->st;
goto out;
}
if (!lp_follow_symlinks(SNUM(conn))) {