]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Use SMB_VFS_FSTATAT() instead of SMB_LSTAT()
authorVolker Lendecke <vl@samba.org>
Thu, 31 Aug 2023 14:35:47 +0000 (16:35 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Oct 2023 23:23:40 +0000 (23:23 +0000)
Use the dirfsp when we have it available

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index e70ad218ffe2e61fe1b6bb58eb42e8b9b9a06e47..358131058ccbf9a117d650e716ce8b0ff7d5f747 100644 (file)
@@ -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",