1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3:vfs: add create tags to SMB_VFS_CREATEFILE

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2014-11-26 14:12:51 +01:00 committed by Jeremy Allison
parent af846264d8
commit 142db4048f
20 changed files with 125 additions and 57 deletions

View File

@ -174,7 +174,9 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
uint32_t private_flags,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result, int *pinfo)
files_struct **result, int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
return NT_STATUS_NOT_IMPLEMENTED;
}

View File

@ -169,7 +169,9 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
uint32_t private_flags,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct ** result, int *pinfo)
files_struct ** result, int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
return SMB_VFS_NEXT_CREATE_FILE(handle,
req,
@ -184,7 +186,8 @@ static NTSTATUS skel_create_file(struct vfs_handle_struct *handle,
lease,
allocation_size,
private_flags,
sd, ea_list, result, pinfo);
sd, ea_list, result, pinfo,
in_context_blobs, out_context_blobs);
}
static int skel_close_fn(vfs_handle_struct *handle, files_struct *fsp)

View File

@ -160,6 +160,7 @@
/* Version 32 - Add "lease" to CREATE_FILE operation */
/* Version 32 - Add "lease" to struct files_struct */
/* Version 32 - Add SMB_VFS_READDIR_ATTR() */
/* Version 32 - Add in and our create context blobs to create_file */
#define SMB_VFS_INTERFACE_VERSION 32
@ -553,7 +554,9 @@ struct vfs_fn_pointers {
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo);
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs);
int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
ssize_t (*read_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n);
ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, off_t offset);
@ -964,7 +967,9 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo);
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs);
int smb_vfs_call_close(struct vfs_handle_struct *handle,
struct files_struct *fsp);
ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle,

View File

@ -136,13 +136,15 @@
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, \
create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo) \
smb_vfs_call_create_file((conn)->vfs_handles, (req), (root_dir_fid), (smb_fname), (access_mask), (share_access), (create_disposition), \
(create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo))
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), \
(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, \
create_options, file_attributes, oplock_request, lease, allocation_size, private_flags, sd, ea_list, result, pinfo) \
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), \
(create_options), (file_attributes), (oplock_request), (lease), (allocation_size), (private_flags), (sd), (ea_list), (result), (pinfo))
(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_CLOSE(fsp) \
smb_vfs_call_close((fsp)->conn->vfs_handles, (fsp))

View File

@ -531,7 +531,9 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo)
int *pinfo,
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,
access_mask, share_access,
@ -539,7 +541,7 @@ static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle,
file_attributes, oplock_request, lease,
allocation_size, private_flags,
sd, ea_list, result,
pinfo);
pinfo, in_context_blobs, out_context_blobs);
}
static int vfswrap_close(vfs_handle_struct *handle, files_struct *fsp)

View File

@ -2874,7 +2874,9 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
NTSTATUS status;
struct fruit_config_data *config = NULL;
@ -2887,7 +2889,8 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle,
lease,
allocation_size, private_flags,
sd, ea_list, result,
pinfo);
pinfo,
in_context_blobs, out_context_blobs);
if (!NT_STATUS_IS_OK(status)) {
return status;

View File

@ -871,7 +871,9 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result_fsp,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
NTSTATUS result;
const char* str_create_disposition;
@ -916,7 +918,8 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
sd, /* sd */
ea_list, /* ea_list */
result_fsp, /* result */
pinfo); /* pinfo */
pinfo, /* pinfo */
in_context_blobs, out_context_blobs); /* create context */
do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
"0x%x|%s|%s|%s", access_mask,

View File

@ -1210,7 +1210,9 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result_fsp,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
NTSTATUS status;
struct smb_filename *clientFname;
@ -1238,7 +1240,9 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
sd,
ea_list,
result_fsp,
pinfo);
pinfo,
in_context_blobs,
out_context_blobs);
goto out;
}
@ -1275,7 +1279,9 @@ static NTSTATUS mh_create_file(vfs_handle_struct *handle,
sd,
ea_list,
result_fsp,
pinfo);
pinfo,
in_context_blobs,
out_context_blobs);
err:
TALLOC_FREE(clientFname);
out:

View File

@ -502,7 +502,9 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result_fsp,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
NTSTATUS result;
struct timespec ts1,ts2;
@ -526,7 +528,8 @@ static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
sd, /* sd */
ea_list, /* ea_list */
result_fsp, /* result */
pinfo);
pinfo,
in_context_blobs, out_context_blobs); /* create context */
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;

View File

@ -38,7 +38,9 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
bool readonly = false;
const uint32_t write_access_flags =
@ -64,7 +66,8 @@ static NTSTATUS vfs_worm_create_file(vfs_handle_struct *handle,
handle, req, root_dir_fid, smb_fname, access_mask,
share_access, create_disposition, create_options,
file_attributes, oplock_request, lease, allocation_size,
private_flags, sd, ea_list, result, pinfo);
private_flags, sd, ea_list, result, pinfo,
in_context_blobs, out_context_blobs);
if (!NT_STATUS_IS_OK(status)) {
return status;
}

View File

@ -537,7 +537,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
/* Old file not found, so by definition new file is in fact newer */
@ -591,7 +592,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
/* New file not found, this shouldn't occur if the caller did its job */
@ -770,7 +772,8 @@ static uint32 get_correct_cversion(struct auth_session_info *session_info,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(3,("get_correct_cversion: Can't open file [%s], errno = "

View File

@ -2364,7 +2364,8 @@ WERROR _srvsvc_NetGetFileSecurity(struct pipes_struct *p,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(3,("_srvsvc_NetGetFileSecurity: can't open %s\n",
@ -2512,7 +2513,8 @@ WERROR _srvsvc_NetSetFileSecurity(struct pipes_struct *p,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(3,("_srvsvc_NetSetFileSecurity: can't open %s\n",

View File

@ -1147,7 +1147,8 @@ static NTSTATUS get_file_handle_for_metadata(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
ret_fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (NT_STATUS_IS_OK(status)) {
*need_close = true;

View File

@ -579,7 +579,8 @@ void reply_ntcreate_and_X(struct smb_request *req)
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -1186,7 +1187,8 @@ static void call_nt_transact_create(connection_struct *conn,
sd, /* sd */
ea_list, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if(!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -1430,7 +1432,8 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
NULL, /* sd */
NULL, /* ea_list */
&fsp1, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
goto out;
@ -1455,7 +1458,8 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
NULL, /* sd */
NULL, /* ea_list */
&fsp2, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
close_file(NULL, fsp1, ERROR_CLOSE);

View File

@ -3703,7 +3703,8 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (NT_STATUS_IS_OK(status)) {
close_file(req, fsp, NORMAL_CLOSE);
@ -3882,7 +3883,8 @@ NTSTATUS open_streams_for_delete(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&streams[i], /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("Could not open stream %s: %s\n",
@ -4831,7 +4833,9 @@ NTSTATUS create_file_default(connection_struct *conn,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
int info = FILE_WAS_OPENED;
files_struct *fsp = NULL;

View File

@ -648,9 +648,11 @@ NTSTATUS create_file_default(connection_struct *conn,
uint32_t private_flags,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo);
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs);
NTSTATUS get_relative_fid_filename(connection_struct *conn,
struct smb_request *req,
uint16_t root_dir_fid,

View File

@ -2009,7 +2009,8 @@ void reply_open(struct smb_request *req)
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -2178,7 +2179,8 @@ void reply_open_and_X(struct smb_request *req)
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&smb_action); /* pinfo */
&smb_action, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -2426,7 +2428,8 @@ void reply_mknew(struct smb_request *req)
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -2554,7 +2557,8 @@ void reply_ctemp(struct smb_request *req)
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
TALLOC_FREE(fname);
@ -2772,7 +2776,8 @@ static NTSTATUS do_unlink(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("SMB_VFS_CREATEFILE failed: %s\n",
@ -6039,7 +6044,8 @@ void reply_rmdir(struct smb_request *req)
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -6807,7 +6813,8 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Could not open rename source %s: %s\n",
@ -6954,7 +6961,8 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3,("rename_internals: SMB_VFS_CREATE_FILE "
@ -7224,7 +7232,8 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
NULL, /* sd */
NULL, /* ea_list */
&fsp1, /* result */
NULL); /* psbuf */
NULL, /* psbuf */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
goto out;
@ -7254,7 +7263,8 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
NULL, /* sd */
NULL, /* ea_list */
&fsp2, /* result */
NULL); /* psbuf */
NULL, /* psbuf */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
close_file(NULL, fsp1, ERROR_CLOSE);

View File

@ -1071,7 +1071,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
sec_desc,
ea_list,
&result,
&info);
&info,
&in_context_blobs,
state->out_context_blobs);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(smb1req->xconn, smb1req->mid)) {
SMBPROFILE_IOBYTES_ASYNC_SET_IDLE(smb2req->profile);

View File

@ -1227,7 +1227,8 @@ static void call_trans2open(connection_struct *conn,
NULL, /* sd */
ea_list, /* ea_list */
&fsp, /* result */
&smb_action); /* psbuf */
&smb_action, /* psbuf */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->xconn, req->mid)) {
@ -5995,7 +5996,8 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&new_fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
TALLOC_FREE(smb_fname_tmp);
@ -6981,7 +6983,8 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&new_fsp, /* result */
NULL); /* pinfo */
NULL, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
/* NB. We check for open_was_deferred in the caller. */
@ -7497,7 +7500,8 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (NT_STATUS_IS_OK(status)) {
close_file(req, fsp, NORMAL_CLOSE);
@ -7730,7 +7734,8 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
return status;
@ -7861,7 +7866,8 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
NULL, /* sd */
NULL, /* ea_list */
&fsp, /* result */
&info); /* pinfo */
&info, /* pinfo */
NULL, NULL); /* create context */
if (!NT_STATUS_IS_OK(status)) {
return status;

View File

@ -1545,7 +1545,9 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result,
int *pinfo)
int *pinfo,
const struct smb2_create_blobs *in_context_blobs,
struct smb2_create_blobs *out_context_blobs)
{
VFS_FIND(create_file);
return handle->fns->create_file_fn(
@ -1553,7 +1555,7 @@ NTSTATUS smb_vfs_call_create_file(struct vfs_handle_struct *handle,
share_access, create_disposition, create_options,
file_attributes, oplock_request, lease, allocation_size,
private_flags, sd, ea_list,
result, pinfo);
result, pinfo, in_context_blobs, out_context_blobs);
}
int smb_vfs_call_close(struct vfs_handle_struct *handle,