From b63ac2ed97f92e1c435e72e8edaee00a8366a31d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 22 Jun 2021 23:38:44 -0700 Subject: [PATCH] s3: smbd: Move the call to fsp_set_fd(conn->cwd_fsp, AT_FDCWD) to just after SMB_VFS_CHDIR(). 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 Reviewed-by: Ralph Boehme --- source3/smbd/vfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 5cc86fb96f1..a241fbbb9d2 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -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)); -- 2.47.3