]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_full_audit: implement SMB_VFS_OPENAT()
authorRalph Boehme <slow@samba.org>
Wed, 20 May 2020 21:02:39 +0000 (23:02 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 21 May 2020 20:38:32 +0000 (20:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_full_audit.c

index e7204767f3e987cbdac4f94212458e4ea0e56434..15bc0fd4b916f97d6dc5f6ef117adae8af351493 100644 (file)
@@ -117,6 +117,7 @@ typedef enum _vfs_op_type {
        /* File operations */
 
        SMB_VFS_OP_OPEN,
+       SMB_VFS_OP_OPENAT,
        SMB_VFS_OP_CREATE_FILE,
        SMB_VFS_OP_CLOSE,
        SMB_VFS_OP_READ,
@@ -260,6 +261,7 @@ static struct {
        { SMB_VFS_OP_MKDIRAT,   "mkdirat" },
        { SMB_VFS_OP_CLOSEDIR,  "closedir" },
        { SMB_VFS_OP_OPEN,      "open" },
+       { SMB_VFS_OP_OPENAT,    "openat" },
        { SMB_VFS_OP_CREATE_FILE, "create_file" },
        { SMB_VFS_OP_CLOSE,     "close" },
        { SMB_VFS_OP_READ,      "read" },
@@ -1091,6 +1093,24 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
        return result;
 }
 
+static int smb_full_audit_openat(vfs_handle_struct *handle,
+                                const struct files_struct *dirfsp,
+                                const struct smb_filename *smb_fname,
+                                struct files_struct *fsp,
+                                int flags,
+                                mode_t mode)
+{
+       int result;
+
+       result = SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+
+       do_log(SMB_VFS_OP_OPENAT, (result >= 0), handle, "%s|%s",
+              ((flags & O_WRONLY) || (flags & O_RDWR))?"w":"r",
+              fsp_str_do_log(fsp));
+
+       return result;
+}
+
 static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
                                      struct smb_request *req,
                                      struct files_struct **dirfsp,
@@ -2987,6 +3007,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .mkdirat_fn = smb_full_audit_mkdirat,
        .closedir_fn = smb_full_audit_closedir,
        .open_fn = smb_full_audit_open,
+       .openat_fn = smb_full_audit_openat,
        .create_file_fn = smb_full_audit_create_file,
        .close_fn = smb_full_audit_close,
        .pread_fn = smb_full_audit_pread,