From: Volker Lendecke Date: Thu, 31 Aug 2023 14:35:47 +0000 (+0200) Subject: smbd: Use SMB_VFS_FSTATAT() instead of SMB_LSTAT() X-Git-Tag: tevent-0.16.0~172 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5130ade6882bb528de44b1b559bfbd85aea4a27c;p=thirdparty%2Fsamba.git smbd: Use SMB_VFS_FSTATAT() instead of SMB_LSTAT() Use the dirfsp when we have it available Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e70ad218ffe..358131058cc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4819,6 +4819,7 @@ static NTSTATUS open_directory(connection_struct *conn, if (NT_STATUS_IS_OK(status)) { info = FILE_WAS_CREATED; } else { + int ret; /* Cope with create race. */ if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { @@ -4834,9 +4835,13 @@ static NTSTATUS open_directory(connection_struct *conn, * NT_STATUS_OBJECT_NAME_COLLISION * we still must lstat the path. */ - - if (SMB_VFS_LSTAT(conn, smb_dname) - == -1) { + ret = SMB_VFS_FSTATAT( + conn, + parent_dir_fname->fsp, + smb_fname_atname, + &smb_dname->st, + AT_SYMLINK_NOFOLLOW); + if (ret == -1) { DEBUG(2, ("Could not stat " "directory '%s' just " "opened: %s\n",