s3: vfs: full_audit. Add audit_file_fn().
authorJeremy Allison <jra@samba.org>
Mon, 4 Apr 2016 23:27:05 +0000 (16:27 -0700)
committerVolker Lendecke <vl@samba.org>
Tue, 5 Apr 2016 03:26:18 +0000 (05:26 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_full_audit.c

index 7bceff555fb23480a6928cf0260b4ffa9348fd1f..dd1593923b864d7557628a37a3518d90013eecec 100644 (file)
@@ -187,7 +187,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_FGET_NT_ACL,
        SMB_VFS_OP_GET_NT_ACL,
        SMB_VFS_OP_FSET_NT_ACL,
-       /* Missing audit_file */
+       SMB_VFS_OP_AUDIT_FILE,
 
        /* POSIX ACL operations. */
 
@@ -326,7 +326,7 @@ static struct {
        { 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" },
-       /* Missing audit_file */
+       { SMB_VFS_OP_AUDIT_FILE,        "audit_file" },
        { SMB_VFS_OP_CHMOD_ACL, "chmod_acl" },
        { SMB_VFS_OP_FCHMOD_ACL,        "fchmod_acl" },
        { SMB_VFS_OP_SYS_ACL_GET_FILE,  "sys_acl_get_file" },
@@ -2106,6 +2106,26 @@ static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_stru
        return result;
 }
 
+static NTSTATUS smb_full_audit_audit_file(struct vfs_handle_struct *handle,
+                               struct smb_filename *file,
+                               struct security_acl *sacl,
+                               uint32_t access_requested,
+                               uint32_t access_denied)
+{
+       NTSTATUS result;
+
+       result = SMB_VFS_NEXT_AUDIT_FILE(handle,
+                                       file,
+                                       sacl,
+                                       access_requested,
+                                       access_denied);
+
+       do_log(SMB_VFS_OP_AUDIT_FILE, NT_STATUS_IS_OK(result), handle,
+                       "%s", smb_fname_str_do_log(file));
+
+       return result;
+}
+
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
                                const struct smb_filename *smb_fname,
                                mode_t mode)
@@ -2474,9 +2494,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .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,
-
-       /* Missing audit_file_fn */
-
+       .audit_file_fn = smb_full_audit_audit_file,
        .chmod_acl_fn = smb_full_audit_chmod_acl,
        .fchmod_acl_fn = smb_full_audit_fchmod_acl,
        .sys_acl_get_file_fn = smb_full_audit_sys_acl_get_file,