smbd: pass dirfsp to mkdir_internal()
authorRalph Boehme <slow@samba.org>
Fri, 10 Apr 2020 13:36:34 +0000 (15:36 +0200)
committerRalph Boehme <slow@samba.org>
Thu, 21 May 2020 05:23:31 +0000 (05:23 +0000)
Not really used for now and marked with

SMB_ASSERT(dirfsp == conn->cwd_fsp)

because it needs to be updated later to work with real dirfsp.

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

index b6787b1767b88773b940f1157d9c3f85325a663b..5ebe6aa18c18d48801648e29c11153eb3bff9122 100644 (file)
@@ -4111,6 +4111,7 @@ 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)
 {
@@ -4125,6 +4126,8 @@ 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))));
@@ -4343,7 +4346,7 @@ static NTSTATUS open_directory(connection_struct *conn,
                                return status;
                        }
 
-                       status = mkdir_internal(conn, smb_dname,
+                       status = mkdir_internal(conn, dirfsp, smb_dname,
                                                file_attributes);
 
                        if (!NT_STATUS_IS_OK(status)) {
@@ -4367,7 +4370,7 @@ static NTSTATUS open_directory(connection_struct *conn,
                                status = NT_STATUS_OK;
                                info = FILE_WAS_OPENED;
                        } else {
-                               status = mkdir_internal(conn, smb_dname,
+                               status = mkdir_internal(conn, dirfsp, smb_dname,
                                                file_attributes);
 
                                if (NT_STATUS_IS_OK(status)) {