From: Jeremy Allison Date: Thu, 5 Sep 2019 18:03:29 +0000 (-0700) Subject: s3: VFS: vfs_time_audit. Implement mkdirat(). X-Git-Tag: talloc-2.3.1~893 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b691df9c2f8a8158c0892c7461cf7ccdbe9ed1b1;p=thirdparty%2Fsamba.git s3: VFS: vfs_time_audit. Implement mkdirat(). Currently identical to mkdir(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 4d1e4793e5e..c561e61349b 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -527,6 +527,32 @@ static int smb_time_audit_mkdir(vfs_handle_struct *handle, return result; } +static int smb_time_audit_mkdirat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + mode_t mode) +{ + int result; + struct timespec ts1,ts2; + double timediff; + + clock_gettime_mono(&ts1); + result = SMB_VFS_NEXT_MKDIRAT(handle, + dirfsp, + smb_fname, + mode); + clock_gettime_mono(&ts2); + timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; + + if (timediff > audit_timeout) { + smb_time_audit_log_smb_fname("mkdirat", + timediff, + smb_fname); + } + + return result; +} + static int smb_time_audit_rmdir(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { @@ -2823,6 +2849,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .telldir_fn = smb_time_audit_telldir, .rewind_dir_fn = smb_time_audit_rewinddir, .mkdir_fn = smb_time_audit_mkdir, + .mkdirat_fn = smb_time_audit_mkdirat, .rmdir_fn = smb_time_audit_rmdir, .closedir_fn = smb_time_audit_closedir, .open_fn = smb_time_audit_open,