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,
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,
{
return SMB_VFS_NEXT_CREATE_FILE(handle,
req,
- root_dir_fid,
smb_fname,
access_mask,
share_access,
* 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
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,
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,
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,
#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))
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 */
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 */
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,
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 */
status = SMB_VFS_CREATE_FILE(
handle->conn,
NULL, /* req */
- 0, /* root_dir_fid */
sname,
FILE_READ_DATA|DELETE_ACCESS,
FILE_SHARE_READ,
status = SMB_VFS_CREATE_FILE(
handle->conn, /* conn */
NULL, /* req */
- 0, /* root_dir_fid */
adp_smb_fname,
access_mask,
share_access,
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,
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,
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 */
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,
}
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,
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 */
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,
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 */
*/
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,
status = SMB_VFS_NEXT_CREATE_FILE(
handle,
req,
- root_dir_fid,
smb_fname,
access_mask,
share_access,
status = SMB_VFS_NEXT_CREATE_FILE(
handle,
req,
- root_dir_fid,
clientFname,
access_mask,
share_access,
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,
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,
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 */
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,
return SMB_VFS_NEXT_CREATE_FILE(
handle,
req,
- root_dir_fid,
smb_fname,
access_mask,
share_access,
status = SMB_VFS_NEXT_CREATE_FILE(
handle,
req,
- root_dir_fid,
client_fname,
access_mask,
share_access,
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,
}
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,
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 */
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 */
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 */
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 */
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 */
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 */
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_fname, /* fname */
access_mask, /* access_mask */
share_access, /* share_access */
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_fname, /* fname */
access_mask, /* access_mask */
share_access, /* share_access */
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 */
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 */
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 */
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 */
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,
"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,
(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) {
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.
*/
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,
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|
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_fname, /* fname */
access_mask, /* access_mask */
share_mode, /* share_access */
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_fname, /* fname */
access_mask, /* access_mask */
share_mode, /* share_access */
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_fname, /* fname */
access_mask, /* access_mask */
share_mode, /* share_access */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
status = SMB_VFS_CREATE_FILE(smb1req->conn,
smb1req,
- 0, /* root_dir_fid */
smb_fname,
in_desired_access,
in_share_access,
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 */
status = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_fname, /* fname */
access_mask, /* access_mask */
share_mode, /* share_access */
ntstatus = SMB_VFS_CREATE_FILE(
conn, /* conn */
req, /* req */
- 0, /* root_dir_fid */
smb_dname, /* dname */
FILE_LIST_DIRECTORY, /* access_mask */
FILE_SHARE_READ|
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 */
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 */
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 */
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 */
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 */
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,
{
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,
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,