]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: pass dirfsp to open_directory()
authorRalph Boehme <slow@samba.org>
Thu, 7 May 2020 14:51:35 +0000 (16:51 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 21 May 2020 05:23:31 +0000 (05:23 +0000)
As the calls to

* SMB_VFS_LSTAT()
* get_share_mode_lock()

and maybe others still have to be updated to work with atnames, 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 d3a18cea3a0925dce341e6813a17018d1a377744..7c0854ac124fcf49755d5e7ace238de743f26115 100644 (file)
@@ -4253,6 +4253,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 
 static NTSTATUS open_directory(connection_struct *conn,
                               struct smb_request *req,
+                              struct files_struct **dirfsp,
                               struct smb_filename *smb_dname,
                               uint32_t access_mask,
                               uint32_t share_access,
@@ -4271,6 +4272,8 @@ static NTSTATUS open_directory(connection_struct *conn,
        int flags;
        bool ok;
 
+       SMB_ASSERT(*dirfsp == conn->cwd_fsp);
+
        if (is_ntfs_stream_smb_fname(smb_dname)) {
                DEBUG(2, ("open_directory: %s is a stream name!\n",
                          smb_fname_str_dbg(smb_dname)));
@@ -5633,6 +5636,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                oplock_request = 0;
                status = open_directory(conn,
                                        req,
+                                       dirfsp,
                                        smb_fname,
                                        access_mask,
                                        share_access,
@@ -5711,6 +5715,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                        oplock_request = 0;
                        status = open_directory(conn,
                                                req,
+                                               dirfsp,
                                                smb_fname,
                                                access_mask,
                                                share_access,