summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_full_audit.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2013-01-15 17:22:59 +0100
committerJeremy Allison <jra@samba.org>2013-01-16 23:15:06 +0100
commitef00eb90e56dfac2d823582cec92abf1fa9905f1 (patch)
tree3a582f5ce6ae0a1da9e55de2a380a79fa4bd8bdd /source3/modules/vfs_full_audit.c
parent2bde9636888067210dc38523b6fafaa0b179ec3b (diff)
downloadsamba-ef00eb90e56dfac2d823582cec92abf1fa9905f1.tar.gz
samba-ef00eb90e56dfac2d823582cec92abf1fa9905f1.tar.bz2
samba-ef00eb90e56dfac2d823582cec92abf1fa9905f1.zip
s3-vfs: add copy_chunk vfs hooks
copy_chunk copies n bytes from a source file at a specific offset to a destination file at a given offset. This interface will be used in handling smb2 FSCTL_SRV_COPYCHUNK ioctl requests. Use a pread/pwrite loop in vfs_default, so that requests referring to the same src and dest file are possible. Provide send and receive hooks for copy chunk VFS interface, allowing asynchronous behaviour. Check whether the request source offset + length exceeds the current size. Return STATUS_INVALID_VIEW_SIZE under such a condition, matching Windows server behaviour. Reviewed by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/modules/vfs_full_audit.c')
-rw-r--r--source3/modules/vfs_full_audit.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index b1fb090dc6..549f55e189 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -161,6 +161,8 @@ typedef enum _vfs_op_type {
SMB_VFS_OP_STRICT_LOCK,
SMB_VFS_OP_STRICT_UNLOCK,
SMB_VFS_OP_TRANSLATE_NAME,
+ SMB_VFS_OP_COPY_CHUNK_SEND,
+ SMB_VFS_OP_COPY_CHUNK_RECV,
/* NT ACL operations. */
@@ -281,6 +283,8 @@ static struct {
{ SMB_VFS_OP_STRICT_LOCK, "strict_lock" },
{ SMB_VFS_OP_STRICT_UNLOCK, "strict_unlock" },
{ SMB_VFS_OP_TRANSLATE_NAME, "translate_name" },
+ { SMB_VFS_OP_COPY_CHUNK_SEND, "copy_chunk_send" },
+ { SMB_VFS_OP_COPY_CHUNK_RECV, "copy_chunk_recv" },
{ SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" },
{ SMB_VFS_OP_GET_NT_ACL, "get_nt_acl" },
{ SMB_VFS_OP_FSET_NT_ACL, "fset_nt_acl" },
@@ -1732,6 +1736,38 @@ static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle,
return result;
}
+static struct tevent_req *smb_full_audit_copy_chunk_send(struct vfs_handle_struct *handle,
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct files_struct *src_fsp,
+ off_t src_off,
+ struct files_struct *dest_fsp,
+ off_t dest_off,
+ off_t num)
+{
+ struct tevent_req *req;
+
+ req = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp,
+ src_off, dest_fsp, dest_off, num);
+
+ do_log(SMB_VFS_OP_COPY_CHUNK_SEND, req, handle, "");
+
+ return req;
+}
+
+static NTSTATUS smb_full_audit_copy_chunk_recv(struct vfs_handle_struct *handle,
+ struct tevent_req *req,
+ off_t *copied)
+{
+ NTSTATUS result;
+
+ result = SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied);
+
+ do_log(SMB_VFS_OP_COPY_CHUNK_RECV, NT_STATUS_IS_OK(result), handle, "");
+
+ return result;
+}
+
static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info,
TALLOC_CTX *mem_ctx,
@@ -2131,6 +2167,8 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
.strict_lock_fn = smb_full_audit_strict_lock,
.strict_unlock_fn = smb_full_audit_strict_unlock,
.translate_name_fn = smb_full_audit_translate_name,
+ .copy_chunk_send_fn = smb_full_audit_copy_chunk_send,
+ .copy_chunk_recv_fn = smb_full_audit_copy_chunk_recv,
.fget_nt_acl_fn = smb_full_audit_fget_nt_acl,
.get_nt_acl_fn = smb_full_audit_get_nt_acl,
.fset_nt_acl_fn = smb_full_audit_fset_nt_acl,