From: Ralph Boehme Date: Thu, 14 May 2020 13:59:33 +0000 (+0200) Subject: vfs: remove root_dir_fid arg from SMB_VFS_CREATE_FILE() X-Git-Tag: ldb-2.2.0~509 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7215669d2978019c80f7eaea2a712fb8dd98894b;p=thirdparty%2Fsamba.git vfs: remove root_dir_fid arg from SMB_VFS_CREATE_FILE() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu May 14 19:43:27 UTC 2020 on sn-devel-184 --- diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 6eb68df3e1e..cd04de0dab0 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -200,7 +200,6 @@ static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2eb7a7dbcd9..b95ba1b858d 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -208,7 +208,6 @@ static int skel_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -227,7 +226,6 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle, { return SMB_VFS_NEXT_CREATE_FILE(handle, req, - root_dir_fid, smb_fname, access_mask, share_access, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 5861b9065f0..4780d87c3c2 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -319,6 +319,7 @@ * Version 43 - convert link_contents arg of SMB_VFS_SYMLINKAT() * to struct smb_filename * Version 43 - Move SMB_VFS_GET_NT_ACL() -> SMB_VFS_GET_NT_ACL_AT(). + * Version 43 - Remove root_dir_fid from SMB_VFS_CREATE_FILE(). */ #define SMB_VFS_INTERFACE_VERSION 43 @@ -761,7 +762,6 @@ struct vfs_fn_pointers { int flags, mode_t mode); NTSTATUS (*create_file_fn)(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1273,7 +1273,6 @@ int smb_vfs_call_open(struct vfs_handle_struct *handle, int flags, mode_t mode); NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1728,7 +1727,6 @@ int vfs_not_implemented_open(vfs_handle_struct *handle, files_struct *fsp, int flags, mode_t mode); NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 20fe6f9a0cf..65de31af08d 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -147,14 +147,14 @@ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) \ smb_vfs_call_open((handle)->next, (fname), (fsp), (flags), (mode)) -#define SMB_VFS_CREATE_FILE(conn, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \ +#define SMB_VFS_CREATE_FILE(conn, req, smb_fname, access_mask, share_access, create_disposition, \ create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \ - smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \ + smb_vfs_call_create_file((conn)->vfs_handles, (req), (smb_fname), (access_mask), (share_access), (create_disposition), \ (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \ (in_context_blobs), (out_context_blobs)) -#define SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid, smb_fname, access_mask, share_access, create_disposition, \ +#define SMB_VFS_NEXT_CREATE_FILE(handle, req, smb_fname, access_mask, share_access, create_disposition, \ create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, in_context_blobs, out_context_blobs) \ - smb_vfs_call_create_file((handle)->next, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \ + smb_vfs_call_create_file((handle)->next, (req), (smb_fname), (access_mask), (share_access), (create_disposition), \ (create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo), \ (in_context_blobs), (out_context_blobs)) diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c index b5b88e2404b..8e8b6a77503 100644 --- a/source3/lib/adouble.c +++ b/source3/lib/adouble.c @@ -1109,7 +1109,6 @@ static bool ad_convert_xattr(vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ stream_name, /* fname */ FILE_GENERIC_WRITE, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -1239,7 +1238,6 @@ static bool ad_convert_finderinfo(vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ stream_name, /* fname */ FILE_GENERIC_WRITE, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -1470,7 +1468,6 @@ static bool ad_unconvert_open_ad(TALLOC_CTX *mem_ctx, status = SMB_VFS_CREATE_FILE( handle->conn, NULL, /* req */ - 0, /* root_dir_fid */ adpath, FILE_READ_DATA|FILE_WRITE_DATA, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, @@ -1522,7 +1519,6 @@ static bool ad_unconvert_get_streams(struct vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_READ_ATTRIBUTES, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -1622,7 +1618,6 @@ static bool ad_collect_one_stream(struct vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, NULL, /* req */ - 0, /* root_dir_fid */ sname, FILE_READ_DATA|DELETE_ACCESS, FILE_SHARE_READ, @@ -2084,7 +2079,6 @@ static int ad_open_rsrc(vfs_handle_struct *handle, status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ adp_smb_fname, access_mask, share_access, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 386a34f81d1..5512938d6a6 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -690,7 +690,6 @@ static int vfswrap_open(vfs_handle_struct *handle, static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -708,7 +707,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, const struct smb2_create_blobs *in_context_blobs, struct smb2_create_blobs *out_context_blobs) { - return create_file_default(handle->conn, req, root_dir_fid, smb_fname, + return create_file_default(handle->conn, req, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, lease, diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index a9785e5b4a2..7d77393e99a 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -898,7 +898,6 @@ static bool readdir_attr_meta_finderi_stream( status = SMB_VFS_CREATE_FILE( handle->conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ stream_name, /* fname */ FILE_READ_DATA, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -3884,7 +3883,6 @@ static int fruit_ftruncate(struct vfs_handle_struct *handle, static NTSTATUS fruit_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -3939,7 +3937,7 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle, } status = SMB_VFS_NEXT_CREATE_FILE( - handle, req, root_dir_fid, smb_fname, + handle, req, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, @@ -4704,7 +4702,6 @@ static bool fruit_get_bandsize(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_GENERIC_READ, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index c9b294975f2..07bbfcce9a7 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1093,7 +1093,6 @@ static int smb_full_audit_open(vfs_handle_struct *handle, static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1140,7 +1139,6 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle, result = SMB_VFS_NEXT_CREATE_FILE( handle, /* handle */ req, /* req */ - root_dir_fid, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index 325a5446295..cb1b1398214 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1105,7 +1105,6 @@ out: */ static NTSTATUS mh_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1135,7 +1134,6 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, req, - root_dir_fid, smb_fname, access_mask, share_access, @@ -1174,7 +1172,6 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, req, - root_dir_fid, clientFname, access_mask, share_access, diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 6b4abf8de67..0cb59abcb31 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -198,7 +198,6 @@ int vfs_not_implemented_open(vfs_handle_struct *handle, NTSTATUS vfs_not_implemented_create_file(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index c173359c086..a442e5af315 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -607,7 +607,6 @@ static int smb_time_audit_open(vfs_handle_struct *handle, static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *fname, uint32_t access_mask, uint32_t share_access, @@ -633,7 +632,6 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle, result = SMB_VFS_NEXT_CREATE_FILE( handle, /* handle */ req, /* req */ - root_dir_fid, /* root_dir_fid */ fname, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index 4bbabfdbb1d..70db8f182d1 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -826,7 +826,6 @@ err: static NTSTATUS um_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -854,7 +853,6 @@ static NTSTATUS um_create_file(vfs_handle_struct *handle, return SMB_VFS_NEXT_CREATE_FILE( handle, req, - root_dir_fid, smb_fname, access_mask, share_access, @@ -889,7 +887,6 @@ static NTSTATUS um_create_file(vfs_handle_struct *handle, status = SMB_VFS_NEXT_CREATE_FILE( handle, req, - root_dir_fid, client_fname, access_mask, share_access, diff --git a/source3/modules/vfs_worm.c b/source3/modules/vfs_worm.c index 9b1a5facae7..3ae1f9f39e6 100644 --- a/source3/modules/vfs_worm.c +++ b/source3/modules/vfs_worm.c @@ -24,7 +24,6 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -63,7 +62,7 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle, } status = SMB_VFS_NEXT_CREATE_FILE( - handle, req, root_dir_fid, smb_fname, access_mask, + handle, req, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo, diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 4c7bc481b5a..b36b9a28329 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -843,7 +843,6 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_GENERIC_READ, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -898,7 +897,6 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_GENERIC_READ, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -1102,7 +1100,6 @@ static uint32_t get_correct_cversion(const struct auth_session_info *session_inf nt_status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_GENERIC_READ, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index f178ada9b8c..17391424fc0 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -2414,7 +2414,6 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p, nt_status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_READ_ATTRIBUTES, /* access_mask */ FILE_SHARE_READ|FILE_SHARE_WRITE, /* share_access */ @@ -2550,7 +2549,6 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p, nt_status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_WRITE_ATTRIBUTES, /* access_mask */ FILE_SHARE_READ|FILE_SHARE_WRITE, /* share_access */ diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 9bb8d1c1941..f336416b07c 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1410,7 +1410,6 @@ static NTSTATUS get_file_handle_for_metadata(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname_cp, /* fname */ FILE_WRITE_ATTRIBUTES, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index de218103f6b..307f1254978 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -656,7 +656,6 @@ void reply_ntcreate_and_X(struct smb_request *req) status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ @@ -1339,7 +1338,6 @@ static void call_nt_transact_create(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ @@ -1598,7 +1596,6 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname_src, /* fname */ FILE_READ_DATA|FILE_READ_ATTRIBUTES| FILE_READ_EA, /* access_mask */ @@ -1624,7 +1621,6 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname_dst, /* fname */ FILE_WRITE_DATA|FILE_WRITE_ATTRIBUTES| FILE_WRITE_EA, /* access_mask */ diff --git a/source3/smbd/open.c b/source3/smbd/open.c index cc71cce4df4..9abfe1b6d97 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4634,7 +4634,6 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_dname, /* fname */ FILE_READ_ATTRIBUTES, /* access_mask */ FILE_SHARE_NONE, /* share_access */ @@ -4827,7 +4826,6 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname_cp, /* fname */ DELETE_ACCESS, /* access_mask */ (FILE_SHARE_READ | /* share_access */ @@ -5832,130 +5830,8 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, return status; } -/* - * Calculate the full path name given a relative fid. - */ -static NTSTATUS get_relative_fid_filename( - connection_struct *conn, - struct smb_request *req, - uint16_t root_dir_fid, - const struct smb_filename *smb_fname, - struct smb_filename **smb_fname_out) -{ - files_struct *dir_fsp; - char *parent_fname = NULL; - char *new_base_name = NULL; - uint32_t ucf_flags = ucf_flags_from_smb_request(req); - NTSTATUS status; - - if (root_dir_fid == 0 || !smb_fname) { - status = NT_STATUS_INTERNAL_ERROR; - goto out; - } - - dir_fsp = file_fsp(req, root_dir_fid); - - if (dir_fsp == NULL) { - status = NT_STATUS_INVALID_HANDLE; - goto out; - } - - if (is_ntfs_stream_smb_fname(dir_fsp->fsp_name)) { - status = NT_STATUS_INVALID_HANDLE; - goto out; - } - - if (!dir_fsp->fsp_flags.is_directory) { - - /* - * Check to see if this is a mac fork of some kind. - */ - - if ((conn->fs_capabilities & FILE_NAMED_STREAMS) && - is_ntfs_stream_smb_fname(smb_fname)) { - status = NT_STATUS_OBJECT_PATH_NOT_FOUND; - goto out; - } - - /* - we need to handle the case when we get a - relative open relative to a file and the - pathname is blank - this is a reopen! - (hint from demyn plantenberg) - */ - - status = NT_STATUS_INVALID_HANDLE; - goto out; - } - - if (ISDOT(dir_fsp->fsp_name->base_name)) { - /* - * We're at the toplevel dir, the final file name - * must not contain ./, as this is filtered out - * normally by srvstr_get_path and unix_convert - * explicitly rejects paths containing ./. - */ - parent_fname = talloc_strdup(talloc_tos(), ""); - if (parent_fname == NULL) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - } else { - size_t dir_name_len = strlen(dir_fsp->fsp_name->base_name); - - /* - * Copy in the base directory name. - */ - - parent_fname = talloc_array(talloc_tos(), char, - dir_name_len+2); - if (parent_fname == NULL) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - memcpy(parent_fname, dir_fsp->fsp_name->base_name, - dir_name_len+1); - - /* - * Ensure it ends in a '/'. - * We used TALLOC_SIZE +2 to add space for the '/'. - */ - - if(dir_name_len - && (parent_fname[dir_name_len-1] != '\\') - && (parent_fname[dir_name_len-1] != '/')) { - parent_fname[dir_name_len] = '/'; - parent_fname[dir_name_len+1] = '\0'; - } - } - - new_base_name = talloc_asprintf(talloc_tos(), "%s%s", parent_fname, - smb_fname->base_name); - if (new_base_name == NULL) { - status = NT_STATUS_NO_MEMORY; - goto out; - } - - status = filename_convert(req, - conn, - new_base_name, - ucf_flags, - 0, - NULL, - smb_fname_out); - if (!NT_STATUS_IS_OK(status)) { - goto out; - } - - out: - TALLOC_FREE(parent_fname); - TALLOC_FREE(new_base_name); - return status; -} - NTSTATUS create_file_default(connection_struct *conn, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -5984,7 +5860,7 @@ NTSTATUS create_file_default(connection_struct *conn, "create_disposition = 0x%x create_options = 0x%x " "oplock_request = 0x%x " "private_flags = 0x%x " - "root_dir_fid = 0x%x, ea_list = %p, sd = %p, " + "ea_list = %p, sd = %p, " "fname = %s\n", (unsigned int)access_mask, (unsigned int)file_attributes, @@ -5993,7 +5869,6 @@ NTSTATUS create_file_default(connection_struct *conn, (unsigned int)create_options, (unsigned int)oplock_request, (unsigned int)private_flags, - (unsigned int)root_dir_fid, ea_list, sd, smb_fname_str_dbg(smb_fname)); if (req != NULL) { @@ -6005,20 +5880,6 @@ NTSTATUS create_file_default(connection_struct *conn, get_deferred_open_message_state(req, &req->request_time, NULL); } - /* - * Calculate the filename from the root_dir_if if necessary. - */ - - if (root_dir_fid != 0) { - struct smb_filename *smb_fname_out = NULL; - status = get_relative_fid_filename(conn, req, root_dir_fid, - smb_fname, &smb_fname_out); - if (!NT_STATUS_IS_OK(status)) { - goto fail; - } - smb_fname = smb_fname_out; - } - /* * Check to see if this is a mac fork of some kind. */ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index ba72fb94e0f..2476d08c8a2 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -752,7 +752,6 @@ struct fsp_lease *find_fsp_lease(struct files_struct *new_fsp, uint16_t lease_epoch); NTSTATUS create_file_default(connection_struct *conn, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename * smb_fname, uint32_t access_mask, uint32_t share_access, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index c9e4d7e9c90..e58329e01be 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1899,7 +1899,6 @@ void reply_search(struct smb_request *req) nt_status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_dname, /* dname */ FILE_LIST_DIRECTORY, /* access_mask */ FILE_SHARE_READ| @@ -2285,7 +2284,6 @@ void reply_open(struct smb_request *req) status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_mode, /* share_access */ @@ -2476,7 +2474,6 @@ void reply_open_and_X(struct smb_request *req) status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_mode, /* share_access */ @@ -2908,7 +2905,6 @@ void reply_mknew(struct smb_request *req) status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_mode, /* share_access */ @@ -3045,7 +3041,6 @@ void reply_ctemp(struct smb_request *req) status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_GENERIC_READ | FILE_GENERIC_WRITE, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -3290,7 +3285,6 @@ static NTSTATUS do_unlink(connection_struct *conn, status = SMB_VFS_CREATE_FILE (conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ DELETE_ACCESS, /* access_mask */ FILE_SHARE_NONE, /* share_access */ @@ -7214,7 +7208,6 @@ void reply_rmdir(struct smb_request *req) status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_dname, /* fname */ DELETE_ACCESS, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -8054,7 +8047,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname_src, /* fname */ access_mask, /* access_mask */ (FILE_SHARE_READ | /* share_access */ @@ -8221,7 +8213,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname_src, /* fname */ access_mask, /* access_mask */ (FILE_SHARE_READ | /* share_access */ @@ -8530,7 +8521,6 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname_src, /* fname */ FILE_GENERIC_READ, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ @@ -8561,7 +8551,6 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, status = SMB_VFS_CREATE_FILE( conn, /* conn */ NULL, /* req */ - 0, /* root_dir_fid */ smb_fname_dst, /* fname */ FILE_GENERIC_WRITE, /* access_mask */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share_access */ diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 0d49184d1b5..f3fa6fba646 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -989,7 +989,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, status = SMB_VFS_CREATE_FILE(smb1req->conn, smb1req, - 0, /* root_dir_fid */ smb_fname, in_desired_access, in_share_access, diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index e442d2ad4a4..0a809234d02 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -166,7 +166,6 @@ static NTSTATUS get_posix_fsp(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname_tmp, /* fname */ access_mask, /* access_mask */ share_access, /* share_access */ @@ -1437,7 +1436,6 @@ static void call_trans2open(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ share_mode, /* share_access */ @@ -2973,7 +2971,6 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd ntstatus = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_dname, /* dname */ FILE_LIST_DIRECTORY, /* access_mask */ FILE_SHARE_READ| @@ -6740,7 +6737,6 @@ static NTSTATUS smb_set_file_size(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname_tmp, /* fname */ FILE_WRITE_DATA, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -8017,7 +8013,6 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_WRITE_DATA, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -8531,7 +8526,6 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ FILE_READ_ATTRIBUTES, /* access_mask */ FILE_SHARE_NONE, /* share_access */ @@ -8773,7 +8767,6 @@ static NTSTATUS smb_posix_open(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ access_mask, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ @@ -8916,7 +8909,6 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn, status = SMB_VFS_CREATE_FILE( conn, /* conn */ req, /* req */ - 0, /* root_dir_fid */ smb_fname, /* fname */ DELETE_ACCESS, /* access_mask */ (FILE_SHARE_READ | FILE_SHARE_WRITE | /* share_access */ diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index f49b53f4b7c..d1585321ed3 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1726,7 +1726,6 @@ int smb_vfs_call_open(struct vfs_handle_struct *handle, NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, struct smb_request *req, - uint16_t root_dir_fid, struct smb_filename *smb_fname, uint32_t access_mask, uint32_t share_access, @@ -1746,7 +1745,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle, { VFS_FIND(create_file); return handle->fns->create_file_fn( - handle, req, root_dir_fid, smb_fname, access_mask, + handle, req, smb_fname, access_mask, share_access, create_disposition, create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, diff --git a/source3/utils/net_vfs.c b/source3/utils/net_vfs.c index 0585a8d989b..59e9c60b3a6 100644 --- a/source3/utils/net_vfs.c +++ b/source3/utils/net_vfs.c @@ -244,7 +244,6 @@ static int net_vfs_get_ntacl(struct net_context *net, status = SMB_VFS_CREATE_FILE( state.conn_tos->conn, NULL, /* req */ - 0, /* root_dir_fid */ smb_fname, FILE_READ_ATTRIBUTES|READ_CONTROL_ACCESS, FILE_SHARE_READ|FILE_SHARE_WRITE,