smbd: remove dirfsp arg from mkdir_internal()
authorRalph Boehme <slow@samba.org>
Tue, 23 Jun 2020 12:10:21 +0000 (14:10 +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 mkdir_internal() will open the dirfsp itself as needed.

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

index 88354ef8bb2e98f8ec6639ceba226ecb5d4e3b39..1a75856a1eaaebf9943f33a1a1b4dab868420e85 100644 (file)
@@ -4165,7 +4165,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 }
 
 static NTSTATUS mkdir_internal(connection_struct *conn,
-                              struct files_struct **dirfsp,
                               struct smb_filename *smb_dname,
                               uint32_t file_attributes)
 {
@@ -4180,8 +4179,6 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
        int ret;
        bool ok;
 
-       SMB_ASSERT(*dirfsp == conn->cwd_fsp);
-
        if (!CAN_WRITE(conn) || (access_mask & ~(conn->share_access))) {
                DEBUG(5,("mkdir_internal: failing share access "
                         "%s\n", lp_servicename(talloc_tos(), lp_sub, SNUM(conn))));
@@ -4207,7 +4204,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
        }
 
        status = check_parent_access(conn,
-                                    *dirfsp,
+                                    conn->cwd_fsp,
                                     smb_dname,
                                     access_mask);
        if(!NT_STATUS_IS_OK(status)) {
@@ -4220,7 +4217,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
        }
 
        ret = SMB_VFS_MKDIRAT(conn,
-                             *dirfsp,
+                             conn->cwd_fsp,
                              smb_dname,
                              mode);
        if (ret != 0) {
@@ -4399,7 +4396,8 @@ static NTSTATUS open_directory(connection_struct *conn,
                                return status;
                        }
 
-                       status = mkdir_internal(conn, dirfsp, smb_dname,
+                       status = mkdir_internal(conn,
+                                               smb_dname,
                                                file_attributes);
 
                        if (!NT_STATUS_IS_OK(status)) {
@@ -4423,8 +4421,9 @@ static NTSTATUS open_directory(connection_struct *conn,
                                status = NT_STATUS_OK;
                                info = FILE_WAS_OPENED;
                        } else {
-                               status = mkdir_internal(conn, dirfsp, smb_dname,
-                                               file_attributes);
+                               status = mkdir_internal(conn,
+                                                       smb_dname,
+                                                       file_attributes);
 
                                if (NT_STATUS_IS_OK(status)) {
                                        info = FILE_WAS_CREATED;