From 7ccaff48575b1a94a778f43409505f149b6bdcb8 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 23 Jun 2020 14:10:21 +0200 Subject: [PATCH] smbd: remove dirfsp arg from mkdir_internal() 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 Reviewed-by: Jeremy Allison --- source3/smbd/open.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 88354ef8bb2..1a75856a1ea 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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; -- 2.47.3