From: Jeremy Allison Date: Wed, 23 Jun 2021 06:38:44 +0000 (-0700) Subject: s3: smbd: Move the call to fsp_set_fd(conn->cwd_fsp, AT_FDCWD) to just after SMB_VFS_... X-Git-Tag: tevent-0.11.0~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b63ac2ed97f92e1c435e72e8edaee00a8366a31d;p=thirdparty%2Fsamba.git 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 --- 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));