smbd: pass dirfsp to create_file_unixpath()
authorRalph Boehme <slow@samba.org>
Thu, 7 May 2020 14:32:10 +0000 (16:32 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 21 May 2020 05:23:31 +0000 (05:23 +0000)
As the calls to

* lease_match()
* open_streams_for_delete()
* check_base_file_access
* SMB_VFS_STAT

and others needs to be updated to work with atnames in the
future, we assert (dirfsp == conn->cwd_fsp).

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

index bd54b1b24ad9b5fa1bba61bbc05ad89df10c1a5c..3ff21526b3bb39739c2d98584fda774145a9df36 100644 (file)
@@ -5377,6 +5377,7 @@ 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,
@@ -5399,6 +5400,8 @@ 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 "
@@ -5574,6 +5577,7 @@ 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
@@ -5985,6 +5989,7 @@ NTSTATUS create_file_default(connection_struct *conn,
 
        status = create_file_unixpath(conn,
                                      req,
+                                     _dirfsp,
                                      smb_fname,
                                      access_mask,
                                      share_access,