1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

vfs_full_audit: implement SMB_VFS_OPENAT()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-05-20 23:02:39 +02:00 committed by Jeremy Allison
parent 104302ae1e
commit df7882dd08

View 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,