From: Jeremy Allison Date: Wed, 21 Aug 2019 19:09:24 +0000 (-0700) Subject: s3: VFS: vfs_time_audit. Implement mknodat(). X-Git-Tag: tevent-0.10.1~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9099618eb68b0a23b1260902b5df87428201a91;p=thirdparty%2Fsamba.git s3: VFS: vfs_time_audit. Implement mknodat(). Currently identical to mknod(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 697a75f1d2f..d449f955a6b 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1450,7 +1450,6 @@ static int smb_time_audit_linkat(vfs_handle_struct *handle, return result; } - static int smb_time_audit_mknod(vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode, @@ -1472,6 +1471,32 @@ static int smb_time_audit_mknod(vfs_handle_struct *handle, return result; } +static int smb_time_audit_mknodat(vfs_handle_struct *handle, + files_struct *dirfsp, + const struct smb_filename *smb_fname, + mode_t mode, + SMB_DEV_T dev) +{ + int result; + struct timespec ts1,ts2; + double timediff; + + clock_gettime_mono(&ts1); + result = SMB_VFS_NEXT_MKNODAT(handle, + dirfsp, + smb_fname, + mode, + dev); + clock_gettime_mono(&ts2); + timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; + + if (timediff > audit_timeout) { + smb_time_audit_log_smb_fname("mknodat", timediff, smb_fname); + } + + return result; +} + static struct smb_filename *smb_time_audit_realpath(vfs_handle_struct *handle, TALLOC_CTX *ctx, const struct smb_filename *smb_fname) @@ -2851,6 +2876,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .readlink_fn = smb_time_audit_readlink, .linkat_fn = smb_time_audit_linkat, .mknod_fn = smb_time_audit_mknod, + .mknodat_fn = smb_time_audit_mknodat, .realpath_fn = smb_time_audit_realpath, .chflags_fn = smb_time_audit_chflags, .file_id_create_fn = smb_time_audit_file_id_create,