smbd: remove dirfsp arg from create_file_unixpath()
authorRalph Boehme <slow@samba.org>
Fri, 2 Oct 2020 14:41:27 +0000 (16:41 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Oct 2020 19:39:44 +0000 (19:39 +0000)
Prepares for removing the dirfsp arg from SMB_VFS_CREATE_FILE() again. In the
future dirfsp has to opened as needed within create_file_unixpath() and below.

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

index b22ed954f06fbe2739bdc840c5906ec7184634e5..29d7025e3c7023d3dbcdb28e8d1333b6a7de65ac 100644 (file)
@@ -5412,7 +5412,6 @@ static NTSTATUS lease_match(connection_struct *conn,
 
 static NTSTATUS create_file_unixpath(connection_struct *conn,
                                     struct smb_request *req,
-                                    struct files_struct **dirfsp,
                                     struct smb_filename *smb_fname,
                                     uint32_t access_mask,
                                     uint32_t share_access,
@@ -5435,8 +5434,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
        files_struct *fsp = NULL;
        NTSTATUS status;
 
-       SMB_ASSERT(*dirfsp == conn->cwd_fsp);
-
        DBG_DEBUG("create_file_unixpath: access_mask = 0x%x "
                  "file_attributes = 0x%x, share_access = 0x%x, "
                  "create_disposition = 0x%x create_options = 0x%x "
@@ -5612,7 +5609,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                /* Open the base file. */
                status = create_file_unixpath(conn,
                                              NULL,
-                                             dirfsp,
                                              smb_fname_base,
                                              0,
                                              FILE_SHARE_READ
@@ -5651,11 +5647,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                goto fail;
        }
 
-       if (*dirfsp == fsp->conn->cwd_fsp) {
-               fsp->dirfsp = fsp->conn->cwd_fsp;
-       } else {
-               fsp->dirfsp = talloc_move(fsp, dirfsp);
-       }
+       fsp->dirfsp = fsp->conn->cwd_fsp;
 
        if (base_fsp) {
                /*
@@ -6035,7 +6027,6 @@ NTSTATUS create_file_default(connection_struct *conn,
 
        status = create_file_unixpath(conn,
                                      req,
-                                     _dirfsp,
                                      smb_fname,
                                      access_mask,
                                      share_access,