2 * Time auditing VFS module for samba. Log time taken for VFS call to syslog
5 * Copyright (C) Abhidnya Chirmule <achirmul@in.ibm.com> 2009
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 * This module implements logging for time taken for all Samba VFS operations.
24 * vfs objects = time_audit
31 #define DBGC_CLASS DBGC_VFS
33 static double audit_timeout;
35 static int smb_time_audit_connect(vfs_handle_struct *handle,
36 const char *svc, const char *user)
47 result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
48 timediff = timeval_elapsed(&tv);
49 if (timediff > audit_timeout) {
50 DEBUG(0, ("connect: Took %.2f seconds\n", timediff));
55 static void smb_time_audit_disconnect(vfs_handle_struct *handle)
61 SMB_VFS_NEXT_DISCONNECT(handle);
62 timediff = timeval_elapsed(&tv);
64 if (timediff > audit_timeout) {
65 DEBUG(0, ("disconnect: Took %.2f seconds\n", timediff));
71 static uint64_t smb_time_audit_disk_free(vfs_handle_struct *handle,
73 bool small_query, uint64_t *bsize,
74 uint64_t *dfree, uint64_t *dsize)
81 result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
83 timediff = timeval_elapsed(&tv);
85 /* Don't have a reasonable notion of failure here */
86 if (timediff > audit_timeout) {
87 DEBUG(0, ("disk_free: Took %.2f seconds\n", timediff));
93 static int smb_time_audit_get_quota(struct vfs_handle_struct *handle,
94 enum SMB_QUOTA_TYPE qtype, unid_t id,
102 result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
103 timediff = timeval_elapsed(&tv);
105 if (timediff > audit_timeout) {
106 DEBUG(0, ("get_quota: Took %.2f seconds\n", timediff));
111 static int smb_time_audit_set_quota(struct vfs_handle_struct *handle,
112 enum SMB_QUOTA_TYPE qtype, unid_t id,
120 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
121 timediff = timeval_elapsed(&tv);
123 if (timediff > audit_timeout) {
124 DEBUG(0, ("set_quota: Took %.2f seconds\n", timediff));
130 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
131 struct files_struct *fsp,
132 SHADOW_COPY_DATA *shadow_copy_data,
140 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp,
141 shadow_copy_data, labels);
142 timediff = timeval_elapsed(&tv);
144 if (timediff > audit_timeout) {
145 DEBUG(0, ("get_shadow_copy_data: Took %.2f seconds\n",
152 static int smb_time_audit_statvfs(struct vfs_handle_struct *handle,
154 struct vfs_statvfs_struct *statbuf)
161 result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
162 timediff = timeval_elapsed(&tv);
164 if (timediff > audit_timeout) {
165 DEBUG(0, ("statvfs: Took %.2f seconds\n", timediff));
171 static int smb_time_audit_fs_capabilities(struct vfs_handle_struct *handle)
178 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle);
179 timediff = timeval_elapsed(&tv);
181 if (timediff > audit_timeout) {
182 DEBUG(0, ("fs_capabilities: Took %.2f seconds\n",
189 static SMB_STRUCT_DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
191 const char *mask, uint32 attr)
193 SMB_STRUCT_DIR *result;
198 result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
199 timediff = timeval_elapsed(&tv);
201 if (timediff > audit_timeout) {
202 DEBUG(0, ("opendir: Took %.2f seconds\n", timediff));
208 static SMB_STRUCT_DIRENT *smb_time_audit_readdir(vfs_handle_struct *handle,
209 SMB_STRUCT_DIR *dirp,
210 SMB_STRUCT_STAT *sbuf)
212 SMB_STRUCT_DIRENT *result;
217 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
218 timediff = timeval_elapsed(&tv);
220 if (timediff > audit_timeout) {
221 DEBUG(0, ("readdir: Took %.2f seconds\n", timediff));
227 static void smb_time_audit_seekdir(vfs_handle_struct *handle,
228 SMB_STRUCT_DIR *dirp, long offset)
234 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
235 timediff = timeval_elapsed(&tv);
237 if (timediff > audit_timeout) {
238 DEBUG(0, ("seekdir: Took %.2f seconds\n", timediff));
244 static long smb_time_audit_telldir(vfs_handle_struct *handle,
245 SMB_STRUCT_DIR *dirp)
252 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
253 timediff = timeval_elapsed(&tv);
255 if (timediff > audit_timeout) {
256 DEBUG(0, ("telldir: Took %.2f seconds\n", timediff));
262 static void smb_time_audit_rewinddir(vfs_handle_struct *handle,
263 SMB_STRUCT_DIR *dirp)
269 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
270 timediff = timeval_elapsed(&tv);
272 if (timediff > audit_timeout) {
273 DEBUG(0, ("rewinddir: Took %.2f seconds\n", timediff));
279 static int smb_time_audit_mkdir(vfs_handle_struct *handle,
280 const char *path, mode_t mode)
287 result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
288 timediff = timeval_elapsed(&tv);
290 if (timediff > audit_timeout) {
291 DEBUG(0, ("mkdir: Took %.2f seconds\n", timediff));
297 static int smb_time_audit_rmdir(vfs_handle_struct *handle,
305 result = SMB_VFS_NEXT_RMDIR(handle, path);
306 timediff = timeval_elapsed(&tv);
308 if (timediff > audit_timeout) {
309 DEBUG(0, ("rmdir: Took %.2f seconds\n", timediff));
315 static int smb_time_audit_closedir(vfs_handle_struct *handle,
316 SMB_STRUCT_DIR *dirp)
323 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
324 timediff = timeval_elapsed(&tv);
326 if (timediff > audit_timeout) {
327 DEBUG(0, ("closedir: Took %.2f seconds\n", timediff));
333 static void smb_time_audit_init_search_op(vfs_handle_struct *handle,
334 SMB_STRUCT_DIR *dirp)
340 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
341 timediff = timeval_elapsed(&tv);
343 if (timediff > audit_timeout) {
344 DEBUG(0, ("init_search_op: Took %.2f seconds\n", timediff));
349 static int smb_time_audit_open(vfs_handle_struct *handle,
350 const char *fname, files_struct *fsp,
351 int flags, mode_t mode)
358 result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
359 timediff = timeval_elapsed(&tv);
361 if (timediff > audit_timeout) {
362 DEBUG(0, ("open: Took %.2f seconds\n", timediff));
368 static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
369 struct smb_request *req,
370 uint16_t root_dir_fid,
372 uint32_t create_file_flags,
373 uint32_t access_mask,
374 uint32_t share_access,
375 uint32_t create_disposition,
376 uint32_t create_options,
377 uint32_t file_attributes,
378 uint32_t oplock_request,
379 uint64_t allocation_size,
380 struct security_descriptor *sd,
381 struct ea_list *ea_list,
382 files_struct **result_fsp,
384 SMB_STRUCT_STAT *psbuf)
391 result = SMB_VFS_NEXT_CREATE_FILE(
394 root_dir_fid, /* root_dir_fid */
396 create_file_flags, /* create_file_flags */
397 access_mask, /* access_mask */
398 share_access, /* share_access */
399 create_disposition, /* create_disposition*/
400 create_options, /* create_options */
401 file_attributes, /* file_attributes */
402 oplock_request, /* oplock_request */
403 allocation_size, /* allocation_size */
405 ea_list, /* ea_list */
406 result_fsp, /* result */
409 timediff = timeval_elapsed(&tv);
411 if (timediff > audit_timeout) {
412 DEBUG(0, ("create_file: Took %.2f seconds\n", timediff));
418 static int smb_time_audit_close(vfs_handle_struct *handle, files_struct *fsp)
425 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
426 timediff = timeval_elapsed(&tv);
428 if (timediff > audit_timeout) {
429 DEBUG(0, ("close: Took %.2f seconds\n", timediff));
435 static ssize_t smb_time_audit_read(vfs_handle_struct *handle,
436 files_struct *fsp, void *data, size_t n)
443 result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
444 timediff = timeval_elapsed(&tv);
446 if (timediff > audit_timeout) {
447 DEBUG(0, ("read: Took %.2f seconds\n", timediff));
453 static ssize_t smb_time_audit_pread(vfs_handle_struct *handle,
455 void *data, size_t n, SMB_OFF_T offset)
462 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
463 timediff = timeval_elapsed(&tv);
465 if (timediff > audit_timeout) {
466 DEBUG(0, ("pread: Took %.2f seconds\n", timediff));
472 static ssize_t smb_time_audit_write(vfs_handle_struct *handle,
474 const void *data, size_t n)
481 result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
482 timediff = timeval_elapsed(&tv);
484 if (timediff > audit_timeout) {
485 DEBUG(0, ("write: Took %.2f seconds\n", timediff));
491 static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle,
493 const void *data, size_t n,
501 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
502 timediff = timeval_elapsed(&tv);
504 if (timediff > audit_timeout) {
505 DEBUG(0, ("pwrite: Took %.2f seconds\n", timediff));
511 static SMB_OFF_T smb_time_audit_lseek(vfs_handle_struct *handle,
513 SMB_OFF_T offset, int whence)
520 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
521 timediff = timeval_elapsed(&tv);
523 if (timediff > audit_timeout) {
524 DEBUG(0, ("lseek: Took %.2f seconds\n", timediff));
530 static ssize_t smb_time_audit_sendfile(vfs_handle_struct *handle, int tofd,
531 files_struct *fromfsp,
532 const DATA_BLOB *hdr, SMB_OFF_T offset,
540 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
541 timediff = timeval_elapsed(&tv);
543 if (timediff > audit_timeout) {
544 DEBUG(0, ("sendfile: Took %.2f seconds\n", timediff));
550 static ssize_t smb_time_audit_recvfile(vfs_handle_struct *handle, int fromfd,
560 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
561 timediff = timeval_elapsed(&tv);
563 if (timediff > audit_timeout) {
564 DEBUG(0, ("recvfile: Took %.2f seconds\n", timediff));
570 static int smb_time_audit_rename(vfs_handle_struct *handle,
571 const char *oldname, const char *newname)
578 result = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
579 timediff = timeval_elapsed(&tv);
581 if (timediff > audit_timeout) {
582 DEBUG(0, ("rename: Took %.2f seconds\n", timediff));
588 static int smb_time_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
595 result = SMB_VFS_NEXT_FSYNC(handle, fsp);
596 timediff = timeval_elapsed(&tv);
598 if (timediff > audit_timeout) {
599 DEBUG(0, ("fsync: Took %.2f seconds\n", timediff));
605 static int smb_time_audit_stat(vfs_handle_struct *handle,
606 const char *fname, SMB_STRUCT_STAT *sbuf)
613 result = SMB_VFS_NEXT_STAT(handle, fname, sbuf);
614 timediff = timeval_elapsed(&tv);
616 if (timediff > audit_timeout) {
617 DEBUG(0, ("stat: Took %.2f seconds\n", timediff));
623 static int smb_time_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
624 SMB_STRUCT_STAT *sbuf)
631 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
632 timediff = timeval_elapsed(&tv);
634 if (timediff > audit_timeout) {
635 DEBUG(0, ("fstat: Took %.2f seconds\n", timediff));
641 static int smb_time_audit_lstat(vfs_handle_struct *handle,
642 const char *path, SMB_STRUCT_STAT *sbuf)
649 result = SMB_VFS_NEXT_LSTAT(handle, path, sbuf);
650 timediff = timeval_elapsed(&tv);
652 if (timediff > audit_timeout) {
653 DEBUG(0, ("lstat: Took %.2f seconds\n", timediff));
659 static int smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
661 const SMB_STRUCT_STAT *sbuf)
668 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
669 timediff = timeval_elapsed(&tv);
671 if (timediff > audit_timeout) {
672 DEBUG(0, ("get_alloc_size: Took %.2f seconds\n", timediff));
678 static int smb_time_audit_unlink(vfs_handle_struct *handle,
686 result = SMB_VFS_NEXT_UNLINK(handle, path);
687 timediff = timeval_elapsed(&tv);
689 if (timediff > audit_timeout) {
690 DEBUG(0, ("unlink: Took %.2f seconds\n", timediff));
696 static int smb_time_audit_chmod(vfs_handle_struct *handle,
697 const char *path, mode_t mode)
704 result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
705 timediff = timeval_elapsed(&tv);
707 if (timediff > audit_timeout) {
708 DEBUG(0, ("chmod: Took %.2f seconds\n", timediff));
714 static int smb_time_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
722 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
723 timediff = timeval_elapsed(&tv);
725 if (timediff > audit_timeout) {
726 DEBUG(0, ("fchmod: Took %.2f seconds\n", timediff));
732 static int smb_time_audit_chown(vfs_handle_struct *handle,
733 const char *path, uid_t uid, gid_t gid)
740 result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
741 timediff = timeval_elapsed(&tv);
743 if (timediff > audit_timeout) {
744 DEBUG(0, ("chown: Took %.2f seconds\n", timediff));
750 static int smb_time_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
751 uid_t uid, gid_t gid)
758 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
759 timediff = timeval_elapsed(&tv);
761 if (timediff > audit_timeout) {
762 DEBUG(0, ("fchown: Took %.2f seconds\n", timediff));
768 static int smb_time_audit_lchown(vfs_handle_struct *handle,
769 const char *path, uid_t uid, gid_t gid)
776 result = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
777 timediff = timeval_elapsed(&tv);
779 if (timediff > audit_timeout) {
780 DEBUG(0, ("lchown: Took %.2f seconds\n", timediff));
786 static int smb_time_audit_chdir(vfs_handle_struct *handle, const char *path)
793 result = SMB_VFS_NEXT_CHDIR(handle, path);
794 timediff = timeval_elapsed(&tv);
796 if (timediff > audit_timeout) {
797 DEBUG(0, ("chdir: Took %.2f seconds\n", timediff));
803 static char *smb_time_audit_getwd(vfs_handle_struct *handle, char *path)
810 result = SMB_VFS_NEXT_GETWD(handle, path);
811 timediff = timeval_elapsed(&tv);
813 if (timediff > audit_timeout) {
814 DEBUG(0, ("getwd: Took %.2f seconds\n", timediff));
820 static int smb_time_audit_ntimes(vfs_handle_struct *handle,
821 const char *path, struct smb_file_time *ft)
828 result = SMB_VFS_NEXT_NTIMES(handle, path, ft);
829 timediff = timeval_elapsed(&tv);
831 if (timediff > audit_timeout) {
832 DEBUG(0, ("ntimes: Took %.2f seconds\n", timediff));
838 static int smb_time_audit_ftruncate(vfs_handle_struct *handle,
847 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
848 timediff = timeval_elapsed(&tv);
850 if (timediff > audit_timeout) {
851 DEBUG(0, ("ftruncate: Took %.2f seconds\n", timediff));
857 static bool smb_time_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
858 int op, SMB_OFF_T offset, SMB_OFF_T count,
866 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
867 timediff = timeval_elapsed(&tv);
869 if (timediff > audit_timeout) {
870 DEBUG(0, ("lock: Took %.2f seconds\n", timediff));
876 static int smb_time_audit_kernel_flock(struct vfs_handle_struct *handle,
877 struct files_struct *fsp,
878 uint32 share_mode, uint32 access_mask)
885 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode,
887 timediff = timeval_elapsed(&tv);
889 if (timediff > audit_timeout) {
890 DEBUG(0, ("kernel_flock: Took %.2f seconds\n", timediff));
896 static int smb_time_audit_linux_setlease(vfs_handle_struct *handle,
905 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
906 timediff = timeval_elapsed(&tv);
908 if (timediff > audit_timeout) {
909 DEBUG(0, ("linux_setlease: Took %.2f seconds\n", timediff));
915 static bool smb_time_audit_getlock(vfs_handle_struct *handle,
917 SMB_OFF_T *poffset, SMB_OFF_T *pcount,
918 int *ptype, pid_t *ppid)
925 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype,
927 timediff = timeval_elapsed(&tv);
929 if (timediff > audit_timeout) {
930 DEBUG(0, ("getlock: Took %.2f seconds\n", timediff));
936 static int smb_time_audit_symlink(vfs_handle_struct *handle,
937 const char *oldpath, const char *newpath)
944 result = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
945 timediff = timeval_elapsed(&tv);
947 if (timediff > audit_timeout) {
948 DEBUG(0, ("symlink: Took %.2f seconds\n", timediff));
954 static int smb_time_audit_readlink(vfs_handle_struct *handle,
955 const char *path, char *buf, size_t bufsiz)
962 result = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
963 timediff = timeval_elapsed(&tv);
965 if (timediff > audit_timeout) {
966 DEBUG(0, ("readlink: Took %.2f seconds\n", timediff));
972 static int smb_time_audit_link(vfs_handle_struct *handle,
973 const char *oldpath, const char *newpath)
980 result = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
981 timediff = timeval_elapsed(&tv);
983 if (timediff > audit_timeout) {
984 DEBUG(0, ("link: Took %.2f seconds\n", timediff));
990 static int smb_time_audit_mknod(vfs_handle_struct *handle,
991 const char *pathname, mode_t mode,
999 result = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
1000 timediff = timeval_elapsed(&tv);
1002 if (timediff > audit_timeout) {
1003 DEBUG(0, ("mknod: Took %.2f seconds\n", timediff));
1009 static char *smb_time_audit_realpath(vfs_handle_struct *handle,
1010 const char *path, char *resolved_path)
1017 result = SMB_VFS_NEXT_REALPATH(handle, path, resolved_path);
1018 timediff = timeval_elapsed(&tv);
1020 if (timediff > audit_timeout) {
1021 DEBUG(0, ("realpath: Took %.2f seconds\n", timediff));
1027 static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
1028 struct sys_notify_context *ctx,
1029 struct notify_entry *e,
1030 void (*callback)(struct sys_notify_context *ctx,
1032 struct notify_event *ev),
1033 void *private_data, void *handle_p)
1040 result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
1041 private_data, handle_p);
1042 timediff = timeval_elapsed(&tv);
1044 if (timediff > audit_timeout) {
1045 DEBUG(0, ("notify_watch: Took %.2f seconds\n", timediff));
1051 static int smb_time_audit_chflags(vfs_handle_struct *handle,
1052 const char *path, unsigned int flags)
1059 result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
1060 timediff = timeval_elapsed(&tv);
1062 if (timediff > audit_timeout) {
1063 DEBUG(0, ("chflags: Took %.2f seconds\n", timediff));
1069 static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *handle,
1070 const SMB_STRUCT_STAT *sbuf)
1072 struct file_id id_zero;
1073 struct file_id result;
1077 ZERO_STRUCT(id_zero);
1080 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1081 timediff = timeval_elapsed(&tv);
1083 if (timediff > audit_timeout) {
1084 DEBUG(0, ("file_id_create: Took %.2f seconds\n", timediff));
1090 static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
1091 struct files_struct *fsp,
1093 TALLOC_CTX *mem_ctx,
1094 unsigned int *pnum_streams,
1095 struct stream_struct **pstreams)
1102 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
1103 pnum_streams, pstreams);
1104 timediff = timeval_elapsed(&tv);
1106 if (timediff > audit_timeout) {
1107 DEBUG(0, ("streaminfo: Took %.2f seconds\n", timediff));
1113 static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
1116 TALLOC_CTX *mem_ctx,
1124 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1126 timediff = timeval_elapsed(&tv);
1128 if (timediff > audit_timeout) {
1129 DEBUG(0, ("get_real_filename: Took %.2f seconds\n",
1136 static const char *smb_time_audit_connectpath(vfs_handle_struct *handle,
1144 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
1145 timediff = timeval_elapsed(&tv);
1147 if (timediff > audit_timeout) {
1148 DEBUG(0, ("connectpath: Took %.2f seconds\n", timediff));
1154 static NTSTATUS smb_time_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1155 struct byte_range_lock *br_lck,
1156 struct lock_struct *plock,
1158 struct blocking_lock_record *blr)
1165 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1166 blocking_lock, blr);
1167 timediff = timeval_elapsed(&tv);
1169 if (timediff > audit_timeout) {
1170 DEBUG(0, ("brl_lock_windows: Took %.2f seconds\n",
1177 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1178 struct messaging_context *msg_ctx,
1179 struct byte_range_lock *br_lck,
1180 const struct lock_struct *plock)
1187 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1189 timediff = timeval_elapsed(&tv);
1191 if (timediff > audit_timeout) {
1192 DEBUG(0, ("brl_unlock_windows: Took %.2f seconds\n", timediff));
1198 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1199 struct byte_range_lock *br_lck,
1200 struct lock_struct *plock,
1201 struct blocking_lock_record *blr)
1208 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
1209 timediff = timeval_elapsed(&tv);
1211 if (timediff > audit_timeout) {
1212 DEBUG(0, ("brl_cancel_windows: Took %.2f seconds\n",
1219 static bool smb_time_audit_strict_lock(struct vfs_handle_struct *handle,
1220 struct files_struct *fsp,
1221 struct lock_struct *plock)
1228 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1229 timediff = timeval_elapsed(&tv);
1231 if (timediff > audit_timeout) {
1232 DEBUG(0, ("strict_lock: Took %.2f seconds\n", timediff));
1238 static void smb_time_audit_strict_unlock(struct vfs_handle_struct *handle,
1239 struct files_struct *fsp,
1240 struct lock_struct *plock)
1246 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
1247 timediff = timeval_elapsed(&tv);
1249 if (timediff > audit_timeout) {
1250 DEBUG(0, ("strict_unlock: Took %.2f seconds\n", timediff));
1256 static NTSTATUS smb_time_audit_fget_nt_acl(vfs_handle_struct *handle,
1258 uint32 security_info,
1266 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
1267 timediff = timeval_elapsed(&tv);
1269 if (timediff > audit_timeout) {
1270 DEBUG(0, ("fget_nt_acl: Took %.2f seconds\n", timediff));
1276 static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle,
1278 uint32 security_info,
1286 result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
1287 timediff = timeval_elapsed(&tv);
1289 if (timediff > audit_timeout) {
1290 DEBUG(0, ("get_nt_acl: Took %.2f seconds\n", timediff));
1296 static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
1298 uint32 security_info_sent,
1299 const SEC_DESC *psd)
1306 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent,
1308 timediff = timeval_elapsed(&tv);
1310 if (timediff > audit_timeout) {
1311 DEBUG(0, ("fset_nt_acl: Took %.2f seconds\n", timediff));
1317 static int smb_time_audit_chmod_acl(vfs_handle_struct *handle,
1318 const char *path, mode_t mode)
1325 result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
1326 timediff = timeval_elapsed(&tv);
1328 if (timediff > audit_timeout) {
1329 DEBUG(0, ("chmod_acl: Took %.2f seconds\n", timediff));
1335 static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
1336 files_struct *fsp, mode_t mode)
1343 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
1344 timediff = timeval_elapsed(&tv);
1346 if (timediff > audit_timeout) {
1347 DEBUG(0, ("fchmod_acl: Took %.2f seconds\n", timediff));
1353 static int smb_time_audit_sys_acl_get_entry(vfs_handle_struct *handle,
1354 SMB_ACL_T theacl, int entry_id,
1355 SMB_ACL_ENTRY_T *entry_p)
1362 result = SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id,
1364 timediff = timeval_elapsed(&tv);
1366 if (timediff > audit_timeout) {
1367 DEBUG(0, ("sys_acl_get_entry: Took %.2f seconds\n",
1374 static int smb_time_audit_sys_acl_get_tag_type(vfs_handle_struct *handle,
1375 SMB_ACL_ENTRY_T entry_d,
1376 SMB_ACL_TAG_T *tag_type_p)
1383 result = SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d,
1385 timediff = timeval_elapsed(&tv);
1387 if (timediff > audit_timeout) {
1388 DEBUG(0, ("sys_acl_get_tag_type: Took %.2f seconds\n",
1395 static int smb_time_audit_sys_acl_get_permset(vfs_handle_struct *handle,
1396 SMB_ACL_ENTRY_T entry_d,
1397 SMB_ACL_PERMSET_T *permset_p)
1404 result = SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d,
1406 timediff = timeval_elapsed(&tv);
1408 if (timediff > audit_timeout) {
1409 DEBUG(0, ("sys_acl_get_permset: Took %.2f seconds\n",
1416 static void * smb_time_audit_sys_acl_get_qualifier(vfs_handle_struct *handle,
1417 SMB_ACL_ENTRY_T entry_d)
1424 result = SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
1425 timediff = timeval_elapsed(&tv);
1427 if (timediff > audit_timeout) {
1428 DEBUG(0, ("sys_acl_get_qualifier: Took %.2f seconds\n",
1435 static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
1437 SMB_ACL_TYPE_T type)
1444 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
1445 timediff = timeval_elapsed(&tv);
1447 if (timediff > audit_timeout) {
1448 DEBUG(0, ("sys_acl_get_file: Took %.2f seconds\n",
1455 static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
1463 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
1464 timediff = timeval_elapsed(&tv);
1466 if (timediff > audit_timeout) {
1467 DEBUG(0, ("sys_acl_get_fd: Took %.2f seconds\n",
1474 static int smb_time_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
1475 SMB_ACL_PERMSET_T permset)
1482 result = SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
1483 timediff = timeval_elapsed(&tv);
1485 if (timediff > audit_timeout) {
1486 DEBUG(0, ("sys_acl_clear_perms: Took %.2f seconds\n",
1493 static int smb_time_audit_sys_acl_add_perm(vfs_handle_struct *handle,
1494 SMB_ACL_PERMSET_T permset,
1495 SMB_ACL_PERM_T perm)
1502 result = SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
1503 timediff = timeval_elapsed(&tv);
1505 if (timediff > audit_timeout) {
1506 DEBUG(0, ("sys_acl_add_perm: Took %.2f seconds\n",
1513 static char * smb_time_audit_sys_acl_to_text(vfs_handle_struct *handle,
1522 result = SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
1523 timediff = timeval_elapsed(&tv);
1525 if (timediff > audit_timeout) {
1526 DEBUG(0, ("sys_acl_to_text: Took %.2f seconds\n",
1533 static SMB_ACL_T smb_time_audit_sys_acl_init(vfs_handle_struct *handle,
1541 result = SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
1542 timediff = timeval_elapsed(&tv);
1544 if (timediff > audit_timeout) {
1545 DEBUG(0, ("sys_acl_init: Took %.2f seconds\n", timediff));
1551 static int smb_time_audit_sys_acl_create_entry(vfs_handle_struct *handle,
1553 SMB_ACL_ENTRY_T *pentry)
1560 result = SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
1561 timediff = timeval_elapsed(&tv);
1563 if (timediff > audit_timeout) {
1564 DEBUG(0, ("sys_acl_create_entry: Took %.2f seconds\n",
1571 static int smb_time_audit_sys_acl_set_tag_type(vfs_handle_struct *handle,
1572 SMB_ACL_ENTRY_T entry,
1573 SMB_ACL_TAG_T tagtype)
1580 result = SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry,
1582 timediff = timeval_elapsed(&tv);
1584 if (timediff > audit_timeout) {
1585 DEBUG(0, ("sys_acl_set_tag_type: Took %.2f seconds\n",
1592 static int smb_time_audit_sys_acl_set_qualifier(vfs_handle_struct *handle,
1593 SMB_ACL_ENTRY_T entry,
1601 result = SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
1602 timediff = timeval_elapsed(&tv);
1604 if (timediff > audit_timeout) {
1605 DEBUG(0, ("sys_acl_set_qualifier: Took %.2f seconds\n",
1612 static int smb_time_audit_sys_acl_set_permset(vfs_handle_struct *handle,
1613 SMB_ACL_ENTRY_T entry,
1614 SMB_ACL_PERMSET_T permset)
1621 result = SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
1622 timediff = timeval_elapsed(&tv);
1624 if (timediff > audit_timeout) {
1625 DEBUG(0, ("sys_acl_set_permset: Took %.2f seconds\n",
1632 static int smb_time_audit_sys_acl_valid(vfs_handle_struct *handle,
1640 result = SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
1641 timediff = timeval_elapsed(&tv);
1643 if (timediff > audit_timeout) {
1644 DEBUG(0, ("sys_acl_valid: Took %.2f seconds\n",
1651 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
1653 SMB_ACL_TYPE_T acltype,
1661 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
1663 timediff = timeval_elapsed(&tv);
1665 if (timediff > audit_timeout) {
1666 DEBUG(0, ("sys_acl_set_file: Took %.2f seconds\n",
1673 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
1682 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
1683 timediff = timeval_elapsed(&tv);
1685 if (timediff > audit_timeout) {
1686 DEBUG(0, ("sys_acl_set_fd: Took %.2f seconds\n",
1693 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
1701 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
1702 timediff = timeval_elapsed(&tv);
1704 if (timediff > audit_timeout) {
1705 DEBUG(0, ("sys_acl_delete_def_file: Took %.2f seconds\n",
1712 static int smb_time_audit_sys_acl_get_perm(vfs_handle_struct *handle,
1713 SMB_ACL_PERMSET_T permset,
1714 SMB_ACL_PERM_T perm)
1721 result = SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
1722 timediff = timeval_elapsed(&tv);
1724 if (timediff > audit_timeout) {
1725 DEBUG(0, ("sys_acl_get_perm: Took %.2f seconds\n",
1732 static int smb_time_audit_sys_acl_free_text(vfs_handle_struct *handle,
1740 result = SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
1741 timediff = timeval_elapsed(&tv);
1743 if (timediff > audit_timeout) {
1744 DEBUG(0, ("sys_acl_free_text: Took %.2f seconds\n",
1751 static int smb_time_audit_sys_acl_free_acl(vfs_handle_struct *handle,
1752 SMB_ACL_T posix_acl)
1759 result = SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
1760 timediff = timeval_elapsed(&tv);
1762 if (timediff > audit_timeout) {
1763 DEBUG(0, ("sys_acl_free_acl: Took %.2f seconds\n",
1770 static int smb_time_audit_sys_acl_free_qualifier(vfs_handle_struct *handle,
1772 SMB_ACL_TAG_T tagtype)
1779 result = SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier,
1781 timediff = timeval_elapsed(&tv);
1783 if (timediff > audit_timeout) {
1784 DEBUG(0, ("sys_acl_free_qualifier: Took %.2f seconds\n",
1791 static ssize_t smb_time_audit_getxattr(struct vfs_handle_struct *handle,
1792 const char *path, const char *name,
1793 void *value, size_t size)
1800 result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
1801 timediff = timeval_elapsed(&tv);
1803 if (timediff > audit_timeout) {
1804 DEBUG(0, ("getxattr: Took %.2f seconds\n", timediff));
1810 static ssize_t smb_time_audit_lgetxattr(struct vfs_handle_struct *handle,
1811 const char *path, const char *name,
1812 void *value, size_t size)
1819 result = SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
1820 timediff = timeval_elapsed(&tv);
1822 if (timediff > audit_timeout) {
1823 DEBUG(0, ("lgetxattr: Took %.2f seconds\n", timediff));
1829 static ssize_t smb_time_audit_fgetxattr(struct vfs_handle_struct *handle,
1830 struct files_struct *fsp,
1831 const char *name, void *value,
1839 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1840 timediff = timeval_elapsed(&tv);
1842 if (timediff > audit_timeout) {
1843 DEBUG(0, ("fgetxattr: Took %.2f seconds\n", timediff));
1849 static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
1850 const char *path, char *list,
1858 result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
1859 timediff = timeval_elapsed(&tv);
1861 if (timediff > audit_timeout) {
1862 DEBUG(0, ("listxattr: Took %.2f seconds\n", timediff));
1868 static ssize_t smb_time_audit_llistxattr(struct vfs_handle_struct *handle,
1869 const char *path, char *list,
1877 result = SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
1878 timediff = timeval_elapsed(&tv);
1880 if (timediff > audit_timeout) {
1881 DEBUG(0, ("llistxattr: Took %.2f seconds\n", timediff));
1887 static ssize_t smb_time_audit_flistxattr(struct vfs_handle_struct *handle,
1888 struct files_struct *fsp, char *list,
1896 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
1897 timediff = timeval_elapsed(&tv);
1899 if (timediff > audit_timeout) {
1900 DEBUG(0, ("flistxattr: Took %.2f seconds\n", timediff));
1906 static int smb_time_audit_removexattr(struct vfs_handle_struct *handle,
1907 const char *path, const char *name)
1914 result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
1915 timediff = timeval_elapsed(&tv);
1917 if (timediff > audit_timeout) {
1918 DEBUG(0, ("removexattr: Took %.2f seconds\n", timediff));
1924 static int smb_time_audit_lremovexattr(struct vfs_handle_struct *handle,
1925 const char *path, const char *name)
1932 result = SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
1933 timediff = timeval_elapsed(&tv);
1935 if (timediff > audit_timeout) {
1936 DEBUG(0, ("lremovexattr: Took %.2f seconds\n", timediff));
1942 static int smb_time_audit_fremovexattr(struct vfs_handle_struct *handle,
1943 struct files_struct *fsp,
1951 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
1952 timediff = timeval_elapsed(&tv);
1954 if (timediff > audit_timeout) {
1955 DEBUG(0, ("fremovexattr: Took %.2f seconds\n", timediff));
1961 static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
1962 const char *path, const char *name,
1963 const void *value, size_t size,
1971 result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
1973 timediff = timeval_elapsed(&tv);
1975 if (timediff > audit_timeout) {
1976 DEBUG(0, ("setxattr: Took %.2f seconds\n", timediff));
1982 static int smb_time_audit_lsetxattr(struct vfs_handle_struct *handle,
1983 const char *path, const char *name,
1984 const void *value, size_t size,
1992 result = SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size,
1994 timediff = timeval_elapsed(&tv);
1996 if (timediff > audit_timeout) {
1997 DEBUG(0, ("lsetxattr: Took %.2f seconds\n", timediff));
2003 static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle,
2004 struct files_struct *fsp, const char *name,
2005 const void *value, size_t size, int flags)
2012 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2013 timediff = timeval_elapsed(&tv);
2015 if (timediff > audit_timeout) {
2016 DEBUG(0, ("fsetxattr: Took %.2f seconds\n", timediff));
2022 static int smb_time_audit_aio_read(struct vfs_handle_struct *handle,
2023 struct files_struct *fsp,
2024 SMB_STRUCT_AIOCB *aiocb)
2031 result = SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
2032 timediff = timeval_elapsed(&tv);
2034 if (timediff > audit_timeout) {
2035 DEBUG(0, ("aio_read: Took %.2f seconds\n", timediff));
2041 static int smb_time_audit_aio_write(struct vfs_handle_struct *handle,
2042 struct files_struct *fsp,
2043 SMB_STRUCT_AIOCB *aiocb)
2050 result = SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
2051 timediff = timeval_elapsed(&tv);
2053 if (timediff > audit_timeout) {
2054 DEBUG(0, ("aio_write: Took %.2f seconds\n", timediff));
2060 static ssize_t smb_time_audit_aio_return(struct vfs_handle_struct *handle,
2061 struct files_struct *fsp,
2062 SMB_STRUCT_AIOCB *aiocb)
2069 result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
2070 timediff = timeval_elapsed(&tv);
2072 if (timediff > audit_timeout) {
2073 DEBUG(0, ("aio_return: Took %.2f seconds\n", timediff));
2079 static int smb_time_audit_aio_cancel(struct vfs_handle_struct *handle,
2080 struct files_struct *fsp,
2081 SMB_STRUCT_AIOCB *aiocb)
2088 result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
2089 timediff = timeval_elapsed(&tv);
2091 if (timediff > audit_timeout) {
2092 DEBUG(0, ("aio_cancel: Took %.2f seconds\n", timediff));
2098 static int smb_time_audit_aio_error(struct vfs_handle_struct *handle,
2099 struct files_struct *fsp,
2100 SMB_STRUCT_AIOCB *aiocb)
2107 result = SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
2108 timediff = timeval_elapsed(&tv);
2110 if (timediff > audit_timeout) {
2111 DEBUG(0, ("aio_error: Took %.2f seconds\n", timediff));
2117 static int smb_time_audit_aio_fsync(struct vfs_handle_struct *handle,
2118 struct files_struct *fsp, int op,
2119 SMB_STRUCT_AIOCB *aiocb)
2126 result = SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
2127 timediff = timeval_elapsed(&tv);
2129 if (timediff > audit_timeout) {
2130 DEBUG(0, ("aio_fsync: Took %.2f seconds\n", timediff));
2136 static int smb_time_audit_aio_suspend(struct vfs_handle_struct *handle,
2137 struct files_struct *fsp,
2138 const SMB_STRUCT_AIOCB * const aiocb[],
2139 int n, const struct timespec *ts)
2146 result = SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
2147 timediff = timeval_elapsed(&tv);
2149 if (timediff > audit_timeout) {
2150 DEBUG(0, ("aio_suspend: Took %.2f seconds\n", timediff));
2156 static bool smb_time_audit_aio_force(struct vfs_handle_struct *handle,
2157 struct files_struct *fsp)
2164 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2165 timediff = timeval_elapsed(&tv);
2167 if (timediff > audit_timeout) {
2168 DEBUG(0, ("aio_force: Took %.2f seconds\n", timediff));
2176 /* VFS operations */
2178 static vfs_op_tuple audit_op_tuples[] = {
2180 /* Disk operations */
2182 {SMB_VFS_OP(smb_time_audit_connect), SMB_VFS_OP_CONNECT,
2183 SMB_VFS_LAYER_LOGGER},
2184 {SMB_VFS_OP(smb_time_audit_disconnect), SMB_VFS_OP_DISCONNECT,
2185 SMB_VFS_LAYER_LOGGER},
2186 {SMB_VFS_OP(smb_time_audit_disk_free), SMB_VFS_OP_DISK_FREE,
2187 SMB_VFS_LAYER_LOGGER},
2188 {SMB_VFS_OP(smb_time_audit_get_quota), SMB_VFS_OP_GET_QUOTA,
2189 SMB_VFS_LAYER_LOGGER},
2190 {SMB_VFS_OP(smb_time_audit_set_quota), SMB_VFS_OP_SET_QUOTA,
2191 SMB_VFS_LAYER_LOGGER},
2192 {SMB_VFS_OP(smb_time_audit_get_shadow_copy_data),
2193 SMB_VFS_OP_GET_SHADOW_COPY_DATA,
2194 SMB_VFS_LAYER_LOGGER},
2195 {SMB_VFS_OP(smb_time_audit_statvfs), SMB_VFS_OP_STATVFS,
2196 SMB_VFS_LAYER_LOGGER},
2197 {SMB_VFS_OP(smb_time_audit_fs_capabilities),
2198 SMB_VFS_OP_FS_CAPABILITIES,
2199 SMB_VFS_LAYER_LOGGER},
2201 /* Directory operations */
2203 {SMB_VFS_OP(smb_time_audit_opendir), SMB_VFS_OP_OPENDIR,
2204 SMB_VFS_LAYER_LOGGER},
2205 {SMB_VFS_OP(smb_time_audit_readdir), SMB_VFS_OP_READDIR,
2206 SMB_VFS_LAYER_LOGGER},
2207 {SMB_VFS_OP(smb_time_audit_seekdir), SMB_VFS_OP_SEEKDIR,
2208 SMB_VFS_LAYER_LOGGER},
2209 {SMB_VFS_OP(smb_time_audit_telldir), SMB_VFS_OP_TELLDIR,
2210 SMB_VFS_LAYER_LOGGER},
2211 {SMB_VFS_OP(smb_time_audit_rewinddir), SMB_VFS_OP_REWINDDIR,
2212 SMB_VFS_LAYER_LOGGER},
2213 {SMB_VFS_OP(smb_time_audit_mkdir), SMB_VFS_OP_MKDIR,
2214 SMB_VFS_LAYER_LOGGER},
2215 {SMB_VFS_OP(smb_time_audit_rmdir), SMB_VFS_OP_RMDIR,
2216 SMB_VFS_LAYER_LOGGER},
2217 {SMB_VFS_OP(smb_time_audit_closedir), SMB_VFS_OP_CLOSEDIR,
2218 SMB_VFS_LAYER_LOGGER},
2219 {SMB_VFS_OP(smb_time_audit_init_search_op), SMB_VFS_OP_INIT_SEARCH_OP,
2220 SMB_VFS_LAYER_LOGGER},
2222 /* File operations */
2224 {SMB_VFS_OP(smb_time_audit_open), SMB_VFS_OP_OPEN,
2225 SMB_VFS_LAYER_LOGGER},
2226 {SMB_VFS_OP(smb_time_audit_create_file),SMB_VFS_OP_CREATE_FILE,
2227 SMB_VFS_LAYER_LOGGER},
2228 {SMB_VFS_OP(smb_time_audit_close), SMB_VFS_OP_CLOSE,
2229 SMB_VFS_LAYER_LOGGER},
2230 {SMB_VFS_OP(smb_time_audit_read), SMB_VFS_OP_READ,
2231 SMB_VFS_LAYER_LOGGER},
2232 {SMB_VFS_OP(smb_time_audit_pread), SMB_VFS_OP_PREAD,
2233 SMB_VFS_LAYER_LOGGER},
2234 {SMB_VFS_OP(smb_time_audit_write), SMB_VFS_OP_WRITE,
2235 SMB_VFS_LAYER_LOGGER},
2236 {SMB_VFS_OP(smb_time_audit_pwrite), SMB_VFS_OP_PWRITE,
2237 SMB_VFS_LAYER_LOGGER},
2238 {SMB_VFS_OP(smb_time_audit_lseek), SMB_VFS_OP_LSEEK,
2239 SMB_VFS_LAYER_LOGGER},
2240 {SMB_VFS_OP(smb_time_audit_sendfile), SMB_VFS_OP_SENDFILE,
2241 SMB_VFS_LAYER_LOGGER},
2242 {SMB_VFS_OP(smb_time_audit_recvfile), SMB_VFS_OP_RECVFILE,
2243 SMB_VFS_LAYER_LOGGER},
2244 {SMB_VFS_OP(smb_time_audit_rename), SMB_VFS_OP_RENAME,
2245 SMB_VFS_LAYER_LOGGER},
2246 {SMB_VFS_OP(smb_time_audit_fsync), SMB_VFS_OP_FSYNC,
2247 SMB_VFS_LAYER_LOGGER},
2248 {SMB_VFS_OP(smb_time_audit_stat), SMB_VFS_OP_STAT,
2249 SMB_VFS_LAYER_LOGGER},
2250 {SMB_VFS_OP(smb_time_audit_fstat), SMB_VFS_OP_FSTAT,
2251 SMB_VFS_LAYER_LOGGER},
2252 {SMB_VFS_OP(smb_time_audit_lstat), SMB_VFS_OP_LSTAT,
2253 SMB_VFS_LAYER_LOGGER},
2254 {SMB_VFS_OP(smb_time_audit_get_alloc_size),
2255 SMB_VFS_OP_GET_ALLOC_SIZE,
2256 SMB_VFS_LAYER_LOGGER},
2257 {SMB_VFS_OP(smb_time_audit_unlink), SMB_VFS_OP_UNLINK,
2258 SMB_VFS_LAYER_LOGGER},
2259 {SMB_VFS_OP(smb_time_audit_chmod), SMB_VFS_OP_CHMOD,
2260 SMB_VFS_LAYER_LOGGER},
2261 {SMB_VFS_OP(smb_time_audit_fchmod), SMB_VFS_OP_FCHMOD,
2262 SMB_VFS_LAYER_LOGGER},
2263 {SMB_VFS_OP(smb_time_audit_chown), SMB_VFS_OP_CHOWN,
2264 SMB_VFS_LAYER_LOGGER},
2265 {SMB_VFS_OP(smb_time_audit_fchown), SMB_VFS_OP_FCHOWN,
2266 SMB_VFS_LAYER_LOGGER},
2267 {SMB_VFS_OP(smb_time_audit_lchown), SMB_VFS_OP_LCHOWN,
2268 SMB_VFS_LAYER_LOGGER},
2269 {SMB_VFS_OP(smb_time_audit_chdir), SMB_VFS_OP_CHDIR,
2270 SMB_VFS_LAYER_LOGGER},
2271 {SMB_VFS_OP(smb_time_audit_getwd), SMB_VFS_OP_GETWD,
2272 SMB_VFS_LAYER_LOGGER},
2273 {SMB_VFS_OP(smb_time_audit_ntimes), SMB_VFS_OP_NTIMES,
2274 SMB_VFS_LAYER_LOGGER},
2275 {SMB_VFS_OP(smb_time_audit_ftruncate), SMB_VFS_OP_FTRUNCATE,
2276 SMB_VFS_LAYER_LOGGER},
2277 {SMB_VFS_OP(smb_time_audit_lock), SMB_VFS_OP_LOCK,
2278 SMB_VFS_LAYER_LOGGER},
2279 {SMB_VFS_OP(smb_time_audit_kernel_flock),
2280 SMB_VFS_OP_KERNEL_FLOCK,
2281 SMB_VFS_LAYER_LOGGER},
2282 {SMB_VFS_OP(smb_time_audit_linux_setlease),
2283 SMB_VFS_OP_LINUX_SETLEASE,
2284 SMB_VFS_LAYER_LOGGER},
2285 {SMB_VFS_OP(smb_time_audit_getlock), SMB_VFS_OP_GETLOCK,
2286 SMB_VFS_LAYER_LOGGER},
2287 {SMB_VFS_OP(smb_time_audit_symlink), SMB_VFS_OP_SYMLINK,
2288 SMB_VFS_LAYER_LOGGER},
2289 {SMB_VFS_OP(smb_time_audit_readlink), SMB_VFS_OP_READLINK,
2290 SMB_VFS_LAYER_LOGGER},
2291 {SMB_VFS_OP(smb_time_audit_link), SMB_VFS_OP_LINK,
2292 SMB_VFS_LAYER_LOGGER},
2293 {SMB_VFS_OP(smb_time_audit_mknod), SMB_VFS_OP_MKNOD,
2294 SMB_VFS_LAYER_LOGGER},
2295 {SMB_VFS_OP(smb_time_audit_realpath), SMB_VFS_OP_REALPATH,
2296 SMB_VFS_LAYER_LOGGER},
2297 {SMB_VFS_OP(smb_time_audit_notify_watch),SMB_VFS_OP_NOTIFY_WATCH,
2298 SMB_VFS_LAYER_LOGGER},
2299 {SMB_VFS_OP(smb_time_audit_chflags), SMB_VFS_OP_CHFLAGS,
2300 SMB_VFS_LAYER_LOGGER},
2301 {SMB_VFS_OP(smb_time_audit_file_id_create),
2302 SMB_VFS_OP_FILE_ID_CREATE,
2303 SMB_VFS_LAYER_LOGGER},
2304 {SMB_VFS_OP(smb_time_audit_streaminfo), SMB_VFS_OP_STREAMINFO,
2305 SMB_VFS_LAYER_LOGGER},
2306 {SMB_VFS_OP(smb_time_audit_get_real_filename),
2307 SMB_VFS_OP_GET_REAL_FILENAME,
2308 SMB_VFS_LAYER_LOGGER},
2309 {SMB_VFS_OP(smb_time_audit_connectpath), SMB_VFS_OP_CONNECTPATH,
2310 SMB_VFS_LAYER_LOGGER},
2311 {SMB_VFS_OP(smb_time_audit_brl_lock_windows),
2312 SMB_VFS_OP_BRL_LOCK_WINDOWS,
2313 SMB_VFS_LAYER_LOGGER},
2314 {SMB_VFS_OP(smb_time_audit_brl_unlock_windows),
2315 SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
2316 SMB_VFS_LAYER_LOGGER},
2317 {SMB_VFS_OP(smb_time_audit_brl_cancel_windows),
2318 SMB_VFS_OP_BRL_CANCEL_WINDOWS,
2319 SMB_VFS_LAYER_LOGGER},
2320 {SMB_VFS_OP(smb_time_audit_strict_lock), SMB_VFS_OP_STRICT_LOCK,
2321 SMB_VFS_LAYER_LOGGER},
2322 {SMB_VFS_OP(smb_time_audit_strict_unlock), SMB_VFS_OP_STRICT_UNLOCK,
2323 SMB_VFS_LAYER_LOGGER},
2325 /* NT ACL operations. */
2327 {SMB_VFS_OP(smb_time_audit_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL,
2328 SMB_VFS_LAYER_LOGGER},
2329 {SMB_VFS_OP(smb_time_audit_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
2330 SMB_VFS_LAYER_LOGGER},
2331 {SMB_VFS_OP(smb_time_audit_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL,
2332 SMB_VFS_LAYER_LOGGER},
2334 /* POSIX ACL operations. */
2336 {SMB_VFS_OP(smb_time_audit_chmod_acl), SMB_VFS_OP_CHMOD_ACL,
2337 SMB_VFS_LAYER_LOGGER},
2338 {SMB_VFS_OP(smb_time_audit_fchmod_acl), SMB_VFS_OP_FCHMOD_ACL,
2339 SMB_VFS_LAYER_LOGGER},
2340 {SMB_VFS_OP(smb_time_audit_sys_acl_get_entry),
2341 SMB_VFS_OP_SYS_ACL_GET_ENTRY,
2342 SMB_VFS_LAYER_LOGGER},
2343 {SMB_VFS_OP(smb_time_audit_sys_acl_get_tag_type),
2344 SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE,
2345 SMB_VFS_LAYER_LOGGER},
2346 {SMB_VFS_OP(smb_time_audit_sys_acl_get_permset),
2347 SMB_VFS_OP_SYS_ACL_GET_PERMSET,
2348 SMB_VFS_LAYER_LOGGER},
2349 {SMB_VFS_OP(smb_time_audit_sys_acl_get_qualifier),
2350 SMB_VFS_OP_SYS_ACL_GET_QUALIFIER,
2351 SMB_VFS_LAYER_LOGGER},
2352 {SMB_VFS_OP(smb_time_audit_sys_acl_get_file),
2353 SMB_VFS_OP_SYS_ACL_GET_FILE,
2354 SMB_VFS_LAYER_LOGGER},
2355 {SMB_VFS_OP(smb_time_audit_sys_acl_get_fd),
2356 SMB_VFS_OP_SYS_ACL_GET_FD,
2357 SMB_VFS_LAYER_LOGGER},
2358 {SMB_VFS_OP(smb_time_audit_sys_acl_clear_perms),
2359 SMB_VFS_OP_SYS_ACL_CLEAR_PERMS,
2360 SMB_VFS_LAYER_LOGGER},
2361 {SMB_VFS_OP(smb_time_audit_sys_acl_add_perm),
2362 SMB_VFS_OP_SYS_ACL_ADD_PERM,
2363 SMB_VFS_LAYER_LOGGER},
2364 {SMB_VFS_OP(smb_time_audit_sys_acl_to_text),
2365 SMB_VFS_OP_SYS_ACL_TO_TEXT,
2366 SMB_VFS_LAYER_LOGGER},
2367 {SMB_VFS_OP(smb_time_audit_sys_acl_init),
2368 SMB_VFS_OP_SYS_ACL_INIT,
2369 SMB_VFS_LAYER_LOGGER},
2370 {SMB_VFS_OP(smb_time_audit_sys_acl_create_entry),
2371 SMB_VFS_OP_SYS_ACL_CREATE_ENTRY,
2372 SMB_VFS_LAYER_LOGGER},
2373 {SMB_VFS_OP(smb_time_audit_sys_acl_set_tag_type),
2374 SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE,
2375 SMB_VFS_LAYER_LOGGER},
2376 {SMB_VFS_OP(smb_time_audit_sys_acl_set_qualifier),
2377 SMB_VFS_OP_SYS_ACL_SET_QUALIFIER,
2378 SMB_VFS_LAYER_LOGGER},
2379 {SMB_VFS_OP(smb_time_audit_sys_acl_set_permset),
2380 SMB_VFS_OP_SYS_ACL_SET_PERMSET,
2381 SMB_VFS_LAYER_LOGGER},
2382 {SMB_VFS_OP(smb_time_audit_sys_acl_valid),
2383 SMB_VFS_OP_SYS_ACL_VALID,
2384 SMB_VFS_LAYER_LOGGER},
2385 {SMB_VFS_OP(smb_time_audit_sys_acl_set_file),
2386 SMB_VFS_OP_SYS_ACL_SET_FILE,
2387 SMB_VFS_LAYER_LOGGER},
2388 {SMB_VFS_OP(smb_time_audit_sys_acl_set_fd),
2389 SMB_VFS_OP_SYS_ACL_SET_FD,
2390 SMB_VFS_LAYER_LOGGER},
2391 {SMB_VFS_OP(smb_time_audit_sys_acl_delete_def_file),
2392 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
2393 SMB_VFS_LAYER_LOGGER},
2394 {SMB_VFS_OP(smb_time_audit_sys_acl_get_perm),
2395 SMB_VFS_OP_SYS_ACL_GET_PERM,
2396 SMB_VFS_LAYER_LOGGER},
2397 {SMB_VFS_OP(smb_time_audit_sys_acl_free_text),
2398 SMB_VFS_OP_SYS_ACL_FREE_TEXT,
2399 SMB_VFS_LAYER_LOGGER},
2400 {SMB_VFS_OP(smb_time_audit_sys_acl_free_acl),
2401 SMB_VFS_OP_SYS_ACL_FREE_ACL,
2402 SMB_VFS_LAYER_LOGGER},
2403 {SMB_VFS_OP(smb_time_audit_sys_acl_free_qualifier),
2404 SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
2405 SMB_VFS_LAYER_LOGGER},
2407 /* EA operations. */
2409 {SMB_VFS_OP(smb_time_audit_getxattr), SMB_VFS_OP_GETXATTR,
2410 SMB_VFS_LAYER_LOGGER},
2411 {SMB_VFS_OP(smb_time_audit_lgetxattr), SMB_VFS_OP_LGETXATTR,
2412 SMB_VFS_LAYER_LOGGER},
2413 {SMB_VFS_OP(smb_time_audit_fgetxattr), SMB_VFS_OP_FGETXATTR,
2414 SMB_VFS_LAYER_LOGGER},
2415 {SMB_VFS_OP(smb_time_audit_listxattr), SMB_VFS_OP_LISTXATTR,
2416 SMB_VFS_LAYER_LOGGER},
2417 {SMB_VFS_OP(smb_time_audit_llistxattr), SMB_VFS_OP_LLISTXATTR,
2418 SMB_VFS_LAYER_LOGGER},
2419 {SMB_VFS_OP(smb_time_audit_flistxattr), SMB_VFS_OP_FLISTXATTR,
2420 SMB_VFS_LAYER_LOGGER},
2421 {SMB_VFS_OP(smb_time_audit_removexattr),
2422 SMB_VFS_OP_REMOVEXATTR,
2423 SMB_VFS_LAYER_LOGGER},
2424 {SMB_VFS_OP(smb_time_audit_lremovexattr),
2425 SMB_VFS_OP_LREMOVEXATTR,
2426 SMB_VFS_LAYER_LOGGER},
2427 {SMB_VFS_OP(smb_time_audit_fremovexattr),
2428 SMB_VFS_OP_FREMOVEXATTR,
2429 SMB_VFS_LAYER_LOGGER},
2430 {SMB_VFS_OP(smb_time_audit_setxattr), SMB_VFS_OP_SETXATTR,
2431 SMB_VFS_LAYER_LOGGER},
2432 {SMB_VFS_OP(smb_time_audit_lsetxattr), SMB_VFS_OP_LSETXATTR,
2433 SMB_VFS_LAYER_LOGGER},
2434 {SMB_VFS_OP(smb_time_audit_fsetxattr), SMB_VFS_OP_FSETXATTR,
2435 SMB_VFS_LAYER_LOGGER},
2437 {SMB_VFS_OP(smb_time_audit_aio_read), SMB_VFS_OP_AIO_READ,
2438 SMB_VFS_LAYER_LOGGER},
2439 {SMB_VFS_OP(smb_time_audit_aio_write), SMB_VFS_OP_AIO_WRITE,
2440 SMB_VFS_LAYER_LOGGER},
2441 {SMB_VFS_OP(smb_time_audit_aio_return), SMB_VFS_OP_AIO_RETURN,
2442 SMB_VFS_LAYER_LOGGER},
2443 {SMB_VFS_OP(smb_time_audit_aio_cancel), SMB_VFS_OP_AIO_CANCEL,
2444 SMB_VFS_LAYER_LOGGER},
2445 {SMB_VFS_OP(smb_time_audit_aio_error), SMB_VFS_OP_AIO_ERROR,
2446 SMB_VFS_LAYER_LOGGER},
2447 {SMB_VFS_OP(smb_time_audit_aio_fsync), SMB_VFS_OP_AIO_FSYNC,
2448 SMB_VFS_LAYER_LOGGER},
2449 {SMB_VFS_OP(smb_time_audit_aio_suspend),SMB_VFS_OP_AIO_SUSPEND,
2450 SMB_VFS_LAYER_LOGGER},
2451 {SMB_VFS_OP(smb_time_audit_aio_force),SMB_VFS_OP_AIO_FORCE,
2452 SMB_VFS_LAYER_LOGGER},
2454 /* Finish VFS operations definition */
2456 {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP,
2461 NTSTATUS vfs_time_audit_init(void);
2462 NTSTATUS vfs_time_audit_init(void)
2464 audit_timeout = (double)lp_parm_int(-1, "time_audit", "timeout",
2466 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "time_audit",