smbd: remove dirsp arg from open_directory()
authorRalph Boehme <slow@samba.org>
Fri, 2 Oct 2020 14:30:03 +0000 (16:30 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Oct 2020 19:39:43 +0000 (19:39 +0000)
Prepares for removing the dirfsp arg from SMB_VFS_CREATE_FILE() again. In the
future open_directory() will open the dirfsp itself.

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

index 1a75856a1eaaebf9943f33a1a1b4dab868420e85..b22ed954f06fbe2739bdc840c5906ec7184634e5 100644 (file)
@@ -4307,7 +4307,6 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 
 static NTSTATUS open_directory(connection_struct *conn,
                               struct smb_request *req,
-                              struct files_struct **dirfsp,
                               uint32_t access_mask,
                               uint32_t share_access,
                               uint32_t create_disposition,
@@ -4325,8 +4324,6 @@ 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)));
@@ -4350,7 +4347,7 @@ static NTSTATUS open_directory(connection_struct *conn,
                 file_attributes);
 
        status = smbd_calculate_access_mask(conn,
-                                       *dirfsp,
+                                       conn->cwd_fsp,
                                        smb_dname,
                                        false,
                                        access_mask,
@@ -4481,7 +4478,7 @@ static NTSTATUS open_directory(connection_struct *conn,
 
        if (info == FILE_WAS_OPENED) {
                status = smbd_check_access_rights(conn,
-                                               *dirfsp,
+                                               conn->cwd_fsp,
                                                smb_dname,
                                                false,
                                                access_mask);
@@ -5696,7 +5693,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                oplock_request = 0;
                status = open_directory(conn,
                                        req,
-                                       dirfsp,
                                        access_mask,
                                        share_access,
                                        create_disposition,
@@ -5749,7 +5745,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
                        oplock_request = 0;
                        status = open_directory(conn,
                                                req,
-                                               dirfsp,
                                                access_mask,
                                                share_access,
                                                create_disposition,