From 6923a6c82319adb48e1db8d6e1a0dce64a242c1f Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Thu, 20 Sep 2012 08:20:57 +0200 Subject: [PATCH 1/4] vfs: fix lock logging in vfs_full_audit (cherry picked from commit 47becf6e20a970d273afab8be176d8cbe5ab2b9c) --- source3/modules/vfs_full_audit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 392baea..7f8159f 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1649,7 +1649,7 @@ static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle, "%s:%llu-%llu. type=%d. blocking=%d", fsp_str_do_log(br_lck->fsp), - plock->start, plock->size, plock->lock_type, blocking_lock ); + plock->start, plock->size, plock->lock_type, blocking_lock); return result; } @@ -1682,7 +1682,7 @@ static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct *handle, do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS, (result == 0), handle, "%s:%llu-%llu:%d", fsp_str_do_log(br_lck->fsp), plock->start, - plock->size); + plock->size, plock->lock_type); return result; } @@ -1697,7 +1697,7 @@ static bool smb_full_audit_strict_lock(struct vfs_handle_struct *handle, do_log(SMB_VFS_OP_STRICT_LOCK, result, handle, "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start, - plock->size); + plock->size, plock->lock_type); return result; } @@ -1710,7 +1710,7 @@ static void smb_full_audit_strict_unlock(struct vfs_handle_struct *handle, do_log(SMB_VFS_OP_STRICT_UNLOCK, true, handle, "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start, - plock->size); + plock->size, plock->lock_type); } static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle, -- 1.7.9.5 From ec7c4659d6ac23673f55106023a98dd8eb7e604a Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Thu, 20 Sep 2012 08:35:27 +0200 Subject: [PATCH 2/4] vfs: fix acl_blob_get* in vfs_full_audit Plumb-in functions and use correct return types. Autobuild-User(master): David Disseldorp Autobuild-Date(master): Thu Sep 20 20:42:09 CEST 2012 on sn-devel-104 (cherry picked from commit a125ea7419142dfb86c4f32b1d46896f3bf40704) --- source3/modules/vfs_full_audit.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 7f8159f..1a481ab 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1827,32 +1827,32 @@ static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle, static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, - SMB_ACL_TYPE_T type, - TALLOC_CTX *mem_ctx, + SMB_ACL_TYPE_T type, + TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) { - SMB_ACL_T result; + int result; result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, type, mem_ctx, blob_description, blob); - do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, (result >= 0), handle, + do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, (result >= 0), handle, "%s", path_p); return result; } static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle, - files_struct *fsp, - TALLOC_CTX *mem_ctx, + files_struct *fsp, + TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob) { - SMB_ACL_T result; + int result; - result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description,blob); + result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob); - do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, (result >= 0), handle, + do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, (result >= 0), handle, "%s", fsp_str_do_log(fsp)); return result; @@ -2131,6 +2131,8 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .fchmod_acl_fn = smb_full_audit_fchmod_acl, .sys_acl_get_file_fn = smb_full_audit_sys_acl_get_file, .sys_acl_get_fd_fn = smb_full_audit_sys_acl_get_fd, + .sys_acl_blob_get_file_fn = smb_full_audit_sys_acl_blob_get_file, + .sys_acl_blob_get_fd_fn = smb_full_audit_sys_acl_blob_get_fd, .sys_acl_set_file_fn = smb_full_audit_sys_acl_set_file, .sys_acl_set_fd_fn = smb_full_audit_sys_acl_set_fd, .sys_acl_delete_def_file_fn = smb_full_audit_sys_acl_delete_def_file, -- 1.7.9.5 From f52642e49cac64b6c27e52959b416a04a2455842 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Thu, 27 Sep 2012 11:50:22 +0200 Subject: [PATCH 3/4] vfs: add missing pwrite ops to full_audit The op enum is used by audit_opname() as an index into the vfs_op_names array, so any decrepencies cause bogus audit log entries. Signed-off-by: Jim McDonough (cherry picked from commit e8e91fbbab16c7bcaa9665839d86c7d169e89fff) --- source3/modules/vfs_full_audit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 1a481ab..5c5f91c 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -236,6 +236,8 @@ static struct { { SMB_VFS_OP_PREAD_RECV, "pread_recv" }, { SMB_VFS_OP_WRITE, "write" }, { SMB_VFS_OP_PWRITE, "pwrite" }, + { SMB_VFS_OP_PWRITE_SEND, "pwrite_send" }, + { SMB_VFS_OP_PWRITE_RECV, "pwrite_recv" }, { SMB_VFS_OP_LSEEK, "lseek" }, { SMB_VFS_OP_SENDFILE, "sendfile" }, { SMB_VFS_OP_RECVFILE, "recvfile" }, -- 1.7.9.5 From 30552f85dd19e010c64b95303341fc102c25260b Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Thu, 27 Sep 2012 12:34:53 +0200 Subject: [PATCH 4/4] vfs: check full_audit enum->str mapping on startup Signed-off-by: Jim McDonough Autobuild-User(master): David Disseldorp Autobuild-Date(master): Fri Sep 28 19:28:49 CEST 2012 on sn-devel-104 (cherry picked from commit 0d7a2af9084c376ad4f664389bb8a59dd6887ab7) --- source3/modules/vfs_full_audit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 5c5f91c..6050c55 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -203,7 +203,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_LAST } vfs_op_type; -/* The following array *must* be in the same order as defined in vfs.h */ +/* The following array *must* be in the same order as defined in vfs_op_type */ static struct { vfs_op_type type; @@ -444,9 +444,10 @@ static struct bitmap *init_bitmap(TALLOC_CTX *mem_ctx, const char **ops) } for (i=0; i