]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Move the call to fsp_set_fd(conn->cwd_fsp, AT_FDCWD) to just after SMB_VFS_...
authorJeremy Allison <jra@samba.org>
Wed, 23 Jun 2021 06:38:44 +0000 (23:38 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 25 Jun 2021 15:53:31 +0000 (15:53 +0000)
Once SMB_VFS_CHDIR() has been called and returned success, cwd_fsp *must* be AT_FDCWD.

We needs this so that SMB_VFS_STAT() can work correctly with
at startup time with modules that need to create pathref fsp's.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/vfs.c

index 5cc86fb96f1dc38637a2846272adb91daee65221..a241fbbb9d2dd2a55cdccf497f8b96cc0d1d7782 100644 (file)
@@ -947,6 +947,7 @@ int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
         * don't know if it's been modified by
         * VFS modules in the stack.
         */
+       fsp_set_fd(conn->cwd_fsp, AT_FDCWD);
 
        /* conn cache. */
        cwd = vfs_GetWd(conn, conn);
@@ -995,7 +996,6 @@ int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
        talloc_move(talloc_tos(), &conn->cwd_fsp->fsp_name);
 
        conn->cwd_fsp->fsp_name = talloc_move(conn->cwd_fsp, &cwd);
-       fsp_set_fd(conn->cwd_fsp, AT_FDCWD);
 
        DBG_INFO("vfs_ChDir got %s\n", fsp_str_dbg(conn->cwd_fsp));