mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
vfs: remove root_dir_fid arg from SMB_VFS_CREATE_FILE()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu May 14 19:43:27 UTC 2020 on sn-devel-184
This commit is contained in:
parent
54883d4b3a
commit
7215669d29
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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))
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user