build do not add -no-undefined on openbsd
[Samba.git] / source3 / modules / vfs_time_audit.c
blobe9481b5d6754e85ff64bb5f21301032f6deceae6
1 /*
2 * Time auditing VFS module for samba. Log time taken for VFS call to syslog
3 * facility.
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
28 #include "includes.h"
30 #undef DBGC_CLASS
31 #define DBGC_CLASS DBGC_VFS
33 static double audit_timeout;
35 static void smb_time_audit_log(const char *syscallname, double elapsed)
37 DEBUG(0, ("WARNING: System call \"%s\" took unexpectedly long "
38 "(%.2f seconds) -- Validate that file and storage "
39 "subsystems are operating normally\n", syscallname,
40 elapsed));
43 static int smb_time_audit_connect(vfs_handle_struct *handle,
44 const char *svc, const char *user)
46 int result;
47 struct timespec ts1,ts2;
48 double timediff;
50 if (!handle) {
51 return -1;
54 clock_gettime_mono(&ts1);
55 result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
56 clock_gettime_mono(&ts2);
57 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
58 if (timediff > audit_timeout) {
59 smb_time_audit_log("connect", timediff);
61 return result;
64 static void smb_time_audit_disconnect(vfs_handle_struct *handle)
66 struct timespec ts1,ts2;
67 double timediff;
69 clock_gettime_mono(&ts1);
70 SMB_VFS_NEXT_DISCONNECT(handle);
71 clock_gettime_mono(&ts2);
72 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
74 if (timediff > audit_timeout) {
75 smb_time_audit_log("disconnect", timediff);
78 return;
81 static uint64_t smb_time_audit_disk_free(vfs_handle_struct *handle,
82 const char *path,
83 bool small_query, uint64_t *bsize,
84 uint64_t *dfree, uint64_t *dsize)
86 uint64_t result;
87 struct timespec ts1,ts2;
88 double timediff;
90 clock_gettime_mono(&ts1);
91 result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
92 dfree, dsize);
93 clock_gettime_mono(&ts2);
94 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
96 /* Don't have a reasonable notion of failure here */
97 if (timediff > audit_timeout) {
98 smb_time_audit_log("disk_free", timediff);
101 return result;
104 static int smb_time_audit_get_quota(struct vfs_handle_struct *handle,
105 enum SMB_QUOTA_TYPE qtype, unid_t id,
106 SMB_DISK_QUOTA *qt)
108 int result;
109 struct timespec ts1,ts2;
110 double timediff;
112 clock_gettime_mono(&ts1);
113 result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
114 clock_gettime_mono(&ts2);
115 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
117 if (timediff > audit_timeout) {
118 smb_time_audit_log("get_quota", timediff);
120 return result;
123 static int smb_time_audit_set_quota(struct vfs_handle_struct *handle,
124 enum SMB_QUOTA_TYPE qtype, unid_t id,
125 SMB_DISK_QUOTA *qt)
127 int result;
128 struct timespec ts1,ts2;
129 double timediff;
131 clock_gettime_mono(&ts1);
132 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
133 clock_gettime_mono(&ts2);
134 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
136 if (timediff > audit_timeout) {
137 smb_time_audit_log("set_quota", timediff);
140 return result;
143 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
144 struct files_struct *fsp,
145 SHADOW_COPY_DATA *shadow_copy_data,
146 bool labels)
148 int result;
149 struct timespec ts1,ts2;
150 double timediff;
152 clock_gettime_mono(&ts1);
153 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp,
154 shadow_copy_data, labels);
155 clock_gettime_mono(&ts2);
156 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
158 if (timediff > audit_timeout) {
159 smb_time_audit_log("get_shadow_copy_data", timediff);
162 return result;
165 static int smb_time_audit_statvfs(struct vfs_handle_struct *handle,
166 const char *path,
167 struct vfs_statvfs_struct *statbuf)
169 int result;
170 struct timespec ts1,ts2;
171 double timediff;
173 clock_gettime_mono(&ts1);
174 result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
175 clock_gettime_mono(&ts2);
176 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
178 if (timediff > audit_timeout) {
179 smb_time_audit_log("statvfs", timediff);
182 return result;
185 static uint32_t smb_time_audit_fs_capabilities(struct vfs_handle_struct *handle,
186 enum timestamp_set_resolution *p_ts_res)
188 uint32_t result;
189 struct timespec ts1,ts2;
190 double timediff;
192 clock_gettime_mono(&ts1);
193 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
194 clock_gettime_mono(&ts2);
195 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
197 if (timediff > audit_timeout) {
198 smb_time_audit_log("fs_capabilities", timediff);
201 return result;
204 static SMB_STRUCT_DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
205 const char *fname,
206 const char *mask, uint32 attr)
208 SMB_STRUCT_DIR *result;
209 struct timespec ts1,ts2;
210 double timediff;
212 clock_gettime_mono(&ts1);
213 result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
214 clock_gettime_mono(&ts2);
215 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
217 if (timediff > audit_timeout) {
218 smb_time_audit_log("opendir", timediff);
221 return result;
224 static SMB_STRUCT_DIRENT *smb_time_audit_readdir(vfs_handle_struct *handle,
225 SMB_STRUCT_DIR *dirp,
226 SMB_STRUCT_STAT *sbuf)
228 SMB_STRUCT_DIRENT *result;
229 struct timespec ts1,ts2;
230 double timediff;
232 clock_gettime_mono(&ts1);
233 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
234 clock_gettime_mono(&ts2);
235 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
237 if (timediff > audit_timeout) {
238 smb_time_audit_log("readdir", timediff);
241 return result;
244 static void smb_time_audit_seekdir(vfs_handle_struct *handle,
245 SMB_STRUCT_DIR *dirp, long offset)
247 struct timespec ts1,ts2;
248 double timediff;
250 clock_gettime_mono(&ts1);
251 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
252 clock_gettime_mono(&ts2);
253 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
255 if (timediff > audit_timeout) {
256 smb_time_audit_log("seekdir", timediff);
259 return;
262 static long smb_time_audit_telldir(vfs_handle_struct *handle,
263 SMB_STRUCT_DIR *dirp)
265 long result;
266 struct timespec ts1,ts2;
267 double timediff;
269 clock_gettime_mono(&ts1);
270 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
271 clock_gettime_mono(&ts2);
272 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
274 if (timediff > audit_timeout) {
275 smb_time_audit_log("telldir", timediff);
278 return result;
281 static void smb_time_audit_rewinddir(vfs_handle_struct *handle,
282 SMB_STRUCT_DIR *dirp)
284 struct timespec ts1,ts2;
285 double timediff;
287 clock_gettime_mono(&ts1);
288 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
289 clock_gettime_mono(&ts2);
290 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
292 if (timediff > audit_timeout) {
293 smb_time_audit_log("rewinddir", timediff);
296 return;
299 static int smb_time_audit_mkdir(vfs_handle_struct *handle,
300 const char *path, mode_t mode)
302 int result;
303 struct timespec ts1,ts2;
304 double timediff;
306 clock_gettime_mono(&ts1);
307 result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
308 clock_gettime_mono(&ts2);
309 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
311 if (timediff > audit_timeout) {
312 smb_time_audit_log("mkdir", timediff);
315 return result;
318 static int smb_time_audit_rmdir(vfs_handle_struct *handle,
319 const char *path)
321 int result;
322 struct timespec ts1,ts2;
323 double timediff;
325 clock_gettime_mono(&ts1);
326 result = SMB_VFS_NEXT_RMDIR(handle, path);
327 clock_gettime_mono(&ts2);
328 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
330 if (timediff > audit_timeout) {
331 smb_time_audit_log("rmdir", timediff);
334 return result;
337 static int smb_time_audit_closedir(vfs_handle_struct *handle,
338 SMB_STRUCT_DIR *dirp)
340 int result;
341 struct timespec ts1,ts2;
342 double timediff;
344 clock_gettime_mono(&ts1);
345 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
346 clock_gettime_mono(&ts2);
347 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
349 if (timediff > audit_timeout) {
350 smb_time_audit_log("closedir", timediff);
353 return result;
356 static void smb_time_audit_init_search_op(vfs_handle_struct *handle,
357 SMB_STRUCT_DIR *dirp)
359 struct timespec ts1,ts2;
360 double timediff;
362 clock_gettime_mono(&ts1);
363 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
364 clock_gettime_mono(&ts2);
365 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
367 if (timediff > audit_timeout) {
368 smb_time_audit_log("init_search_op", timediff);
370 return;
373 static int smb_time_audit_open(vfs_handle_struct *handle,
374 struct smb_filename *fname,
375 files_struct *fsp,
376 int flags, mode_t mode)
378 int result;
379 struct timespec ts1,ts2;
380 double timediff;
382 clock_gettime_mono(&ts1);
383 result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
384 clock_gettime_mono(&ts2);
385 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
387 if (timediff > audit_timeout) {
388 smb_time_audit_log("open", timediff);
391 return result;
394 static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
395 struct smb_request *req,
396 uint16_t root_dir_fid,
397 struct smb_filename *fname,
398 uint32_t access_mask,
399 uint32_t share_access,
400 uint32_t create_disposition,
401 uint32_t create_options,
402 uint32_t file_attributes,
403 uint32_t oplock_request,
404 uint64_t allocation_size,
405 uint32_t private_flags,
406 struct security_descriptor *sd,
407 struct ea_list *ea_list,
408 files_struct **result_fsp,
409 int *pinfo)
411 NTSTATUS result;
412 struct timespec ts1,ts2;
413 double timediff;
415 clock_gettime_mono(&ts1);
416 result = SMB_VFS_NEXT_CREATE_FILE(
417 handle, /* handle */
418 req, /* req */
419 root_dir_fid, /* root_dir_fid */
420 fname, /* fname */
421 access_mask, /* access_mask */
422 share_access, /* share_access */
423 create_disposition, /* create_disposition*/
424 create_options, /* create_options */
425 file_attributes, /* file_attributes */
426 oplock_request, /* oplock_request */
427 allocation_size, /* allocation_size */
428 private_flags,
429 sd, /* sd */
430 ea_list, /* ea_list */
431 result_fsp, /* result */
432 pinfo);
433 clock_gettime_mono(&ts2);
434 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
436 if (timediff > audit_timeout) {
437 smb_time_audit_log("create_file", timediff);
440 return result;
443 static int smb_time_audit_close(vfs_handle_struct *handle, files_struct *fsp)
445 int result;
446 struct timespec ts1,ts2;
447 double timediff;
449 clock_gettime_mono(&ts1);
450 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
451 clock_gettime_mono(&ts2);
452 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
454 if (timediff > audit_timeout) {
455 smb_time_audit_log("close", timediff);
458 return result;
461 static ssize_t smb_time_audit_read(vfs_handle_struct *handle,
462 files_struct *fsp, void *data, size_t n)
464 ssize_t result;
465 struct timespec ts1,ts2;
466 double timediff;
468 clock_gettime_mono(&ts1);
469 result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
470 clock_gettime_mono(&ts2);
471 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
473 if (timediff > audit_timeout) {
474 smb_time_audit_log("read", timediff);
477 return result;
480 static ssize_t smb_time_audit_pread(vfs_handle_struct *handle,
481 files_struct *fsp,
482 void *data, size_t n, SMB_OFF_T offset)
484 ssize_t result;
485 struct timespec ts1,ts2;
486 double timediff;
488 clock_gettime_mono(&ts1);
489 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
490 clock_gettime_mono(&ts2);
491 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
493 if (timediff > audit_timeout) {
494 smb_time_audit_log("pread", timediff);
497 return result;
500 static ssize_t smb_time_audit_write(vfs_handle_struct *handle,
501 files_struct *fsp,
502 const void *data, size_t n)
504 ssize_t result;
505 struct timespec ts1,ts2;
506 double timediff;
508 clock_gettime_mono(&ts1);
509 result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
510 clock_gettime_mono(&ts2);
511 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
513 if (timediff > audit_timeout) {
514 smb_time_audit_log("write", timediff);
517 return result;
520 static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle,
521 files_struct *fsp,
522 const void *data, size_t n,
523 SMB_OFF_T offset)
525 ssize_t result;
526 struct timespec ts1,ts2;
527 double timediff;
529 clock_gettime_mono(&ts1);
530 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
531 clock_gettime_mono(&ts2);
532 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
534 if (timediff > audit_timeout) {
535 smb_time_audit_log("pwrite", timediff);
538 return result;
541 static SMB_OFF_T smb_time_audit_lseek(vfs_handle_struct *handle,
542 files_struct *fsp,
543 SMB_OFF_T offset, int whence)
545 ssize_t result;
546 struct timespec ts1,ts2;
547 double timediff;
549 clock_gettime_mono(&ts1);
550 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
551 clock_gettime_mono(&ts2);
552 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
554 if (timediff > audit_timeout) {
555 smb_time_audit_log("lseek", timediff);
558 return result;
561 static ssize_t smb_time_audit_sendfile(vfs_handle_struct *handle, int tofd,
562 files_struct *fromfsp,
563 const DATA_BLOB *hdr, SMB_OFF_T offset,
564 size_t n)
566 ssize_t result;
567 struct timespec ts1,ts2;
568 double timediff;
570 clock_gettime_mono(&ts1);
571 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
572 clock_gettime_mono(&ts2);
573 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
575 if (timediff > audit_timeout) {
576 smb_time_audit_log("sendfile", timediff);
579 return result;
582 static ssize_t smb_time_audit_recvfile(vfs_handle_struct *handle, int fromfd,
583 files_struct *tofsp,
584 SMB_OFF_T offset,
585 size_t n)
587 ssize_t result;
588 struct timespec ts1,ts2;
589 double timediff;
591 clock_gettime_mono(&ts1);
592 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
593 clock_gettime_mono(&ts2);
594 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
596 if (timediff > audit_timeout) {
597 smb_time_audit_log("recvfile", timediff);
600 return result;
603 static int smb_time_audit_rename(vfs_handle_struct *handle,
604 const struct smb_filename *oldname,
605 const struct smb_filename *newname)
607 int result;
608 struct timespec ts1,ts2;
609 double timediff;
611 clock_gettime_mono(&ts1);
612 result = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
613 clock_gettime_mono(&ts2);
614 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
616 if (timediff > audit_timeout) {
617 smb_time_audit_log("rename", timediff);
620 return result;
623 static int smb_time_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
625 int result;
626 struct timespec ts1,ts2;
627 double timediff;
629 clock_gettime_mono(&ts1);
630 result = SMB_VFS_NEXT_FSYNC(handle, fsp);
631 clock_gettime_mono(&ts2);
632 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
634 if (timediff > audit_timeout) {
635 smb_time_audit_log("fsync", timediff);
638 return result;
641 static int smb_time_audit_stat(vfs_handle_struct *handle,
642 struct smb_filename *fname)
644 int result;
645 struct timespec ts1,ts2;
646 double timediff;
648 clock_gettime_mono(&ts1);
649 result = SMB_VFS_NEXT_STAT(handle, fname);
650 clock_gettime_mono(&ts2);
651 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
653 if (timediff > audit_timeout) {
654 smb_time_audit_log("stat", timediff);
657 return result;
660 static int smb_time_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
661 SMB_STRUCT_STAT *sbuf)
663 int result;
664 struct timespec ts1,ts2;
665 double timediff;
667 clock_gettime_mono(&ts1);
668 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
669 clock_gettime_mono(&ts2);
670 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
672 if (timediff > audit_timeout) {
673 smb_time_audit_log("fstat", timediff);
676 return result;
679 static int smb_time_audit_lstat(vfs_handle_struct *handle,
680 struct smb_filename *path)
682 int result;
683 struct timespec ts1,ts2;
684 double timediff;
686 clock_gettime_mono(&ts1);
687 result = SMB_VFS_NEXT_LSTAT(handle, path);
688 clock_gettime_mono(&ts2);
689 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
691 if (timediff > audit_timeout) {
692 smb_time_audit_log("lstat", timediff);
695 return result;
698 static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
699 files_struct *fsp,
700 const SMB_STRUCT_STAT *sbuf)
702 int result;
703 struct timespec ts1,ts2;
704 double timediff;
706 clock_gettime_mono(&ts1);
707 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
708 clock_gettime_mono(&ts2);
709 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
711 if (timediff > audit_timeout) {
712 smb_time_audit_log("get_alloc_size", timediff);
715 return result;
718 static int smb_time_audit_unlink(vfs_handle_struct *handle,
719 const struct smb_filename *path)
721 int result;
722 struct timespec ts1,ts2;
723 double timediff;
725 clock_gettime_mono(&ts1);
726 result = SMB_VFS_NEXT_UNLINK(handle, path);
727 clock_gettime_mono(&ts2);
728 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
730 if (timediff > audit_timeout) {
731 smb_time_audit_log("unlink", timediff);
734 return result;
737 static int smb_time_audit_chmod(vfs_handle_struct *handle,
738 const char *path, mode_t mode)
740 int result;
741 struct timespec ts1,ts2;
742 double timediff;
744 clock_gettime_mono(&ts1);
745 result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
746 clock_gettime_mono(&ts2);
747 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
749 if (timediff > audit_timeout) {
750 smb_time_audit_log("chmod", timediff);
753 return result;
756 static int smb_time_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
757 mode_t mode)
759 int result;
760 struct timespec ts1,ts2;
761 double timediff;
763 clock_gettime_mono(&ts1);
764 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
765 clock_gettime_mono(&ts2);
766 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
768 if (timediff > audit_timeout) {
769 smb_time_audit_log("fchmod", timediff);
772 return result;
775 static int smb_time_audit_chown(vfs_handle_struct *handle,
776 const char *path, uid_t uid, gid_t gid)
778 int result;
779 struct timespec ts1,ts2;
780 double timediff;
782 clock_gettime_mono(&ts1);
783 result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
784 clock_gettime_mono(&ts2);
785 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
787 if (timediff > audit_timeout) {
788 smb_time_audit_log("chown", timediff);
791 return result;
794 static int smb_time_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
795 uid_t uid, gid_t gid)
797 int result;
798 struct timespec ts1,ts2;
799 double timediff;
801 clock_gettime_mono(&ts1);
802 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
803 clock_gettime_mono(&ts2);
804 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
806 if (timediff > audit_timeout) {
807 smb_time_audit_log("fchown", timediff);
810 return result;
813 static int smb_time_audit_lchown(vfs_handle_struct *handle,
814 const char *path, uid_t uid, gid_t gid)
816 int result;
817 struct timespec ts1,ts2;
818 double timediff;
820 clock_gettime_mono(&ts1);
821 result = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
822 clock_gettime_mono(&ts2);
823 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
825 if (timediff > audit_timeout) {
826 smb_time_audit_log("lchown", timediff);
829 return result;
832 static int smb_time_audit_chdir(vfs_handle_struct *handle, const char *path)
834 int result;
835 struct timespec ts1,ts2;
836 double timediff;
838 clock_gettime_mono(&ts1);
839 result = SMB_VFS_NEXT_CHDIR(handle, path);
840 clock_gettime_mono(&ts2);
841 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
843 if (timediff > audit_timeout) {
844 smb_time_audit_log("chdir", timediff);
847 return result;
850 static char *smb_time_audit_getwd(vfs_handle_struct *handle, char *path)
852 char *result;
853 struct timespec ts1,ts2;
854 double timediff;
856 clock_gettime_mono(&ts1);
857 result = SMB_VFS_NEXT_GETWD(handle, path);
858 clock_gettime_mono(&ts2);
859 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
861 if (timediff > audit_timeout) {
862 smb_time_audit_log("getwd", timediff);
865 return result;
868 static int smb_time_audit_ntimes(vfs_handle_struct *handle,
869 const struct smb_filename *path,
870 struct smb_file_time *ft)
872 int result;
873 struct timespec ts1,ts2;
874 double timediff;
876 clock_gettime_mono(&ts1);
877 result = SMB_VFS_NEXT_NTIMES(handle, path, ft);
878 clock_gettime_mono(&ts2);
879 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
881 if (timediff > audit_timeout) {
882 smb_time_audit_log("ntimes", timediff);
885 return result;
888 static int smb_time_audit_ftruncate(vfs_handle_struct *handle,
889 files_struct *fsp,
890 SMB_OFF_T len)
892 int result;
893 struct timespec ts1,ts2;
894 double timediff;
896 clock_gettime_mono(&ts1);
897 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
898 clock_gettime_mono(&ts2);
899 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
901 if (timediff > audit_timeout) {
902 smb_time_audit_log("ftruncate", timediff);
905 return result;
908 static int smb_time_audit_posix_fallocate(vfs_handle_struct *handle,
909 files_struct *fsp,
910 SMB_OFF_T offset,
911 SMB_OFF_T len)
913 int result;
914 struct timespec ts1,ts2;
915 double timediff;
917 clock_gettime_mono(&ts1);
918 result = SMB_VFS_NEXT_POSIX_FALLOCATE(handle, fsp, offset, len);
919 clock_gettime_mono(&ts2);
920 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
922 if (timediff > audit_timeout) {
923 smb_time_audit_log("posix_fallocate", timediff);
926 return result;
929 static bool smb_time_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
930 int op, SMB_OFF_T offset, SMB_OFF_T count,
931 int type)
933 bool result;
934 struct timespec ts1,ts2;
935 double timediff;
937 clock_gettime_mono(&ts1);
938 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
939 clock_gettime_mono(&ts2);
940 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
942 if (timediff > audit_timeout) {
943 smb_time_audit_log("lock", timediff);
946 return result;
949 static int smb_time_audit_kernel_flock(struct vfs_handle_struct *handle,
950 struct files_struct *fsp,
951 uint32 share_mode, uint32 access_mask)
953 int result;
954 struct timespec ts1,ts2;
955 double timediff;
957 clock_gettime_mono(&ts1);
958 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode,
959 access_mask);
960 clock_gettime_mono(&ts2);
961 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
963 if (timediff > audit_timeout) {
964 smb_time_audit_log("kernel_flock", timediff);
967 return result;
970 static int smb_time_audit_linux_setlease(vfs_handle_struct *handle,
971 files_struct *fsp,
972 int leasetype)
974 int result;
975 struct timespec ts1,ts2;
976 double timediff;
978 clock_gettime_mono(&ts1);
979 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
980 clock_gettime_mono(&ts2);
981 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
983 if (timediff > audit_timeout) {
984 smb_time_audit_log("linux_setlease", timediff);
987 return result;
990 static bool smb_time_audit_getlock(vfs_handle_struct *handle,
991 files_struct *fsp,
992 SMB_OFF_T *poffset, SMB_OFF_T *pcount,
993 int *ptype, pid_t *ppid)
995 bool result;
996 struct timespec ts1,ts2;
997 double timediff;
999 clock_gettime_mono(&ts1);
1000 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype,
1001 ppid);
1002 clock_gettime_mono(&ts2);
1003 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1005 if (timediff > audit_timeout) {
1006 smb_time_audit_log("getlock", timediff);
1009 return result;
1012 static int smb_time_audit_symlink(vfs_handle_struct *handle,
1013 const char *oldpath, const char *newpath)
1015 int result;
1016 struct timespec ts1,ts2;
1017 double timediff;
1019 clock_gettime_mono(&ts1);
1020 result = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
1021 clock_gettime_mono(&ts2);
1022 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1024 if (timediff > audit_timeout) {
1025 smb_time_audit_log("symlink", timediff);
1028 return result;
1031 static int smb_time_audit_readlink(vfs_handle_struct *handle,
1032 const char *path, char *buf, size_t bufsiz)
1034 int result;
1035 struct timespec ts1,ts2;
1036 double timediff;
1038 clock_gettime_mono(&ts1);
1039 result = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
1040 clock_gettime_mono(&ts2);
1041 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1043 if (timediff > audit_timeout) {
1044 smb_time_audit_log("readlink", timediff);
1047 return result;
1050 static int smb_time_audit_link(vfs_handle_struct *handle,
1051 const char *oldpath, const char *newpath)
1053 int result;
1054 struct timespec ts1,ts2;
1055 double timediff;
1057 clock_gettime_mono(&ts1);
1058 result = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
1059 clock_gettime_mono(&ts2);
1060 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1062 if (timediff > audit_timeout) {
1063 smb_time_audit_log("link", timediff);
1066 return result;
1069 static int smb_time_audit_mknod(vfs_handle_struct *handle,
1070 const char *pathname, mode_t mode,
1071 SMB_DEV_T dev)
1073 int result;
1074 struct timespec ts1,ts2;
1075 double timediff;
1077 clock_gettime_mono(&ts1);
1078 result = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
1079 clock_gettime_mono(&ts2);
1080 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1082 if (timediff > audit_timeout) {
1083 smb_time_audit_log("mknod", timediff);
1086 return result;
1089 static char *smb_time_audit_realpath(vfs_handle_struct *handle,
1090 const char *path)
1092 char *result;
1093 struct timespec ts1,ts2;
1094 double timediff;
1096 clock_gettime_mono(&ts1);
1097 result = SMB_VFS_NEXT_REALPATH(handle, path);
1098 clock_gettime_mono(&ts2);
1099 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1101 if (timediff > audit_timeout) {
1102 smb_time_audit_log("realpath", timediff);
1105 return result;
1108 static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
1109 struct sys_notify_context *ctx,
1110 struct notify_entry *e,
1111 void (*callback)(struct sys_notify_context *ctx,
1112 void *private_data,
1113 struct notify_event *ev),
1114 void *private_data, void *handle_p)
1116 NTSTATUS result;
1117 struct timespec ts1,ts2;
1118 double timediff;
1120 clock_gettime_mono(&ts1);
1121 result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
1122 private_data, handle_p);
1123 clock_gettime_mono(&ts2);
1124 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1126 if (timediff > audit_timeout) {
1127 smb_time_audit_log("notify_watch", timediff);
1130 return result;
1133 static int smb_time_audit_chflags(vfs_handle_struct *handle,
1134 const char *path, unsigned int flags)
1136 int result;
1137 struct timespec ts1,ts2;
1138 double timediff;
1140 clock_gettime_mono(&ts1);
1141 result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
1142 clock_gettime_mono(&ts2);
1143 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1145 if (timediff > audit_timeout) {
1146 smb_time_audit_log("chflags", timediff);
1149 return result;
1152 static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *handle,
1153 const SMB_STRUCT_STAT *sbuf)
1155 struct file_id id_zero;
1156 struct file_id result;
1157 struct timespec ts1,ts2;
1158 double timediff;
1160 ZERO_STRUCT(id_zero);
1162 clock_gettime_mono(&ts1);
1163 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1164 clock_gettime_mono(&ts2);
1165 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1167 if (timediff > audit_timeout) {
1168 smb_time_audit_log("file_id_create", timediff);
1171 return result;
1174 static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
1175 struct files_struct *fsp,
1176 const char *fname,
1177 TALLOC_CTX *mem_ctx,
1178 unsigned int *pnum_streams,
1179 struct stream_struct **pstreams)
1181 NTSTATUS result;
1182 struct timespec ts1,ts2;
1183 double timediff;
1185 clock_gettime_mono(&ts1);
1186 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
1187 pnum_streams, pstreams);
1188 clock_gettime_mono(&ts2);
1189 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1191 if (timediff > audit_timeout) {
1192 smb_time_audit_log("streaminfo", timediff);
1195 return result;
1198 static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
1199 const char *path,
1200 const char *name,
1201 TALLOC_CTX *mem_ctx,
1202 char **found_name)
1204 int result;
1205 struct timespec ts1,ts2;
1206 double timediff;
1208 clock_gettime_mono(&ts1);
1209 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1210 found_name);
1211 clock_gettime_mono(&ts2);
1212 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1214 if (timediff > audit_timeout) {
1215 smb_time_audit_log("get_real_filename", timediff);
1218 return result;
1221 static const char *smb_time_audit_connectpath(vfs_handle_struct *handle,
1222 const char *fname)
1224 const char *result;
1225 struct timespec ts1,ts2;
1226 double timediff;
1228 clock_gettime_mono(&ts1);
1229 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
1230 clock_gettime_mono(&ts2);
1231 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1233 if (timediff > audit_timeout) {
1234 smb_time_audit_log("connectpath", timediff);
1237 return result;
1240 static NTSTATUS smb_time_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1241 struct byte_range_lock *br_lck,
1242 struct lock_struct *plock,
1243 bool blocking_lock,
1244 struct blocking_lock_record *blr)
1246 NTSTATUS result;
1247 struct timespec ts1,ts2;
1248 double timediff;
1250 clock_gettime_mono(&ts1);
1251 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1252 blocking_lock, blr);
1253 clock_gettime_mono(&ts2);
1254 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1256 if (timediff > audit_timeout) {
1257 smb_time_audit_log("brl_lock_windows", timediff);
1260 return result;
1263 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1264 struct messaging_context *msg_ctx,
1265 struct byte_range_lock *br_lck,
1266 const struct lock_struct *plock)
1268 bool result;
1269 struct timespec ts1,ts2;
1270 double timediff;
1272 clock_gettime_mono(&ts1);
1273 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1274 plock);
1275 clock_gettime_mono(&ts2);
1276 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1278 if (timediff > audit_timeout) {
1279 smb_time_audit_log("brl_unlock_windows", timediff);
1282 return result;
1285 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1286 struct byte_range_lock *br_lck,
1287 struct lock_struct *plock,
1288 struct blocking_lock_record *blr)
1290 bool result;
1291 struct timespec ts1,ts2;
1292 double timediff;
1294 clock_gettime_mono(&ts1);
1295 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
1296 clock_gettime_mono(&ts2);
1297 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1299 if (timediff > audit_timeout) {
1300 smb_time_audit_log("brl_cancel_windows", timediff);
1303 return result;
1306 static bool smb_time_audit_strict_lock(struct vfs_handle_struct *handle,
1307 struct files_struct *fsp,
1308 struct lock_struct *plock)
1310 bool result;
1311 struct timespec ts1,ts2;
1312 double timediff;
1314 clock_gettime_mono(&ts1);
1315 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1316 clock_gettime_mono(&ts2);
1317 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1319 if (timediff > audit_timeout) {
1320 smb_time_audit_log("strict_lock", timediff);
1323 return result;
1326 static void smb_time_audit_strict_unlock(struct vfs_handle_struct *handle,
1327 struct files_struct *fsp,
1328 struct lock_struct *plock)
1330 struct timespec ts1,ts2;
1331 double timediff;
1333 clock_gettime_mono(&ts1);
1334 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
1335 clock_gettime_mono(&ts2);
1336 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1338 if (timediff > audit_timeout) {
1339 smb_time_audit_log("strict_unlock", timediff);
1342 return;
1345 static NTSTATUS smb_time_audit_translate_name(struct vfs_handle_struct *handle,
1346 const char *name,
1347 enum vfs_translate_direction direction,
1348 TALLOC_CTX *mem_ctx,
1349 char **mapped_name)
1351 NTSTATUS result;
1352 struct timespec ts1,ts2;
1353 double timediff;
1355 clock_gettime_mono(&ts1);
1356 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1357 mapped_name);
1358 clock_gettime_mono(&ts2);
1359 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1361 if (timediff > audit_timeout) {
1362 smb_time_audit_log("translate_name", timediff);
1365 return result;
1368 static NTSTATUS smb_time_audit_fget_nt_acl(vfs_handle_struct *handle,
1369 files_struct *fsp,
1370 uint32 security_info,
1371 struct security_descriptor **ppdesc)
1373 NTSTATUS result;
1374 struct timespec ts1,ts2;
1375 double timediff;
1377 clock_gettime_mono(&ts1);
1378 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
1379 clock_gettime_mono(&ts2);
1380 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1382 if (timediff > audit_timeout) {
1383 smb_time_audit_log("fget_nt_acl", timediff);
1386 return result;
1389 static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle,
1390 const char *name,
1391 uint32 security_info,
1392 struct security_descriptor **ppdesc)
1394 NTSTATUS result;
1395 struct timespec ts1,ts2;
1396 double timediff;
1398 clock_gettime_mono(&ts1);
1399 result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
1400 clock_gettime_mono(&ts2);
1401 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1403 if (timediff > audit_timeout) {
1404 smb_time_audit_log("get_nt_acl", timediff);
1407 return result;
1410 static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
1411 files_struct *fsp,
1412 uint32 security_info_sent,
1413 const struct security_descriptor *psd)
1415 NTSTATUS result;
1416 struct timespec ts1,ts2;
1417 double timediff;
1419 clock_gettime_mono(&ts1);
1420 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent,
1421 psd);
1422 clock_gettime_mono(&ts2);
1423 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1425 if (timediff > audit_timeout) {
1426 smb_time_audit_log("fset_nt_acl", timediff);
1429 return result;
1432 static int smb_time_audit_chmod_acl(vfs_handle_struct *handle,
1433 const char *path, mode_t mode)
1435 int result;
1436 struct timespec ts1,ts2;
1437 double timediff;
1439 clock_gettime_mono(&ts1);
1440 result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
1441 clock_gettime_mono(&ts2);
1442 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1444 if (timediff > audit_timeout) {
1445 smb_time_audit_log("chmod_acl", timediff);
1448 return result;
1451 static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
1452 files_struct *fsp, mode_t mode)
1454 int result;
1455 struct timespec ts1,ts2;
1456 double timediff;
1458 clock_gettime_mono(&ts1);
1459 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
1460 clock_gettime_mono(&ts2);
1461 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1463 if (timediff > audit_timeout) {
1464 smb_time_audit_log("fchmod_acl", timediff);
1467 return result;
1470 static int smb_time_audit_sys_acl_get_entry(vfs_handle_struct *handle,
1471 SMB_ACL_T theacl, int entry_id,
1472 SMB_ACL_ENTRY_T *entry_p)
1474 int result;
1475 struct timespec ts1,ts2;
1476 double timediff;
1478 clock_gettime_mono(&ts1);
1479 result = SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id,
1480 entry_p);
1481 clock_gettime_mono(&ts2);
1482 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1484 if (timediff > audit_timeout) {
1485 smb_time_audit_log("sys_acl_get_entry", timediff);
1488 return result;
1491 static int smb_time_audit_sys_acl_get_tag_type(vfs_handle_struct *handle,
1492 SMB_ACL_ENTRY_T entry_d,
1493 SMB_ACL_TAG_T *tag_type_p)
1495 int result;
1496 struct timespec ts1,ts2;
1497 double timediff;
1499 clock_gettime_mono(&ts1);
1500 result = SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d,
1501 tag_type_p);
1502 clock_gettime_mono(&ts2);
1503 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1505 if (timediff > audit_timeout) {
1506 smb_time_audit_log("sys_acl_get_tag_type", timediff);
1509 return result;
1512 static int smb_time_audit_sys_acl_get_permset(vfs_handle_struct *handle,
1513 SMB_ACL_ENTRY_T entry_d,
1514 SMB_ACL_PERMSET_T *permset_p)
1516 int result;
1517 struct timespec ts1,ts2;
1518 double timediff;
1520 clock_gettime_mono(&ts1);
1521 result = SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d,
1522 permset_p);
1523 clock_gettime_mono(&ts2);
1524 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1526 if (timediff > audit_timeout) {
1527 smb_time_audit_log("sys_acl_get_permset", timediff);
1530 return result;
1533 static void * smb_time_audit_sys_acl_get_qualifier(vfs_handle_struct *handle,
1534 SMB_ACL_ENTRY_T entry_d)
1536 void *result;
1537 struct timespec ts1,ts2;
1538 double timediff;
1540 clock_gettime_mono(&ts1);
1541 result = SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
1542 clock_gettime_mono(&ts2);
1543 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1545 if (timediff > audit_timeout) {
1546 smb_time_audit_log("sys_acl_get_qualifier", timediff);
1549 return result;
1552 static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
1553 const char *path_p,
1554 SMB_ACL_TYPE_T type)
1556 SMB_ACL_T result;
1557 struct timespec ts1,ts2;
1558 double timediff;
1560 clock_gettime_mono(&ts1);
1561 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
1562 clock_gettime_mono(&ts2);
1563 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1565 if (timediff > audit_timeout) {
1566 smb_time_audit_log("sys_acl_get_file", timediff);
1569 return result;
1572 static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
1573 files_struct *fsp)
1575 SMB_ACL_T result;
1576 struct timespec ts1,ts2;
1577 double timediff;
1579 clock_gettime_mono(&ts1);
1580 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
1581 clock_gettime_mono(&ts2);
1582 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1584 if (timediff > audit_timeout) {
1585 smb_time_audit_log("sys_acl_get_fd", timediff);
1588 return result;
1591 static int smb_time_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
1592 SMB_ACL_PERMSET_T permset)
1594 int result;
1595 struct timespec ts1,ts2;
1596 double timediff;
1598 clock_gettime_mono(&ts1);
1599 result = SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
1600 clock_gettime_mono(&ts2);
1601 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1603 if (timediff > audit_timeout) {
1604 smb_time_audit_log("sys_acl_clear_perms", timediff);
1607 return result;
1610 static int smb_time_audit_sys_acl_add_perm(vfs_handle_struct *handle,
1611 SMB_ACL_PERMSET_T permset,
1612 SMB_ACL_PERM_T perm)
1614 int result;
1615 struct timespec ts1,ts2;
1616 double timediff;
1618 clock_gettime_mono(&ts1);
1619 result = SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
1620 clock_gettime_mono(&ts2);
1621 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1623 if (timediff > audit_timeout) {
1624 smb_time_audit_log("sys_acl_add_perm", timediff);
1627 return result;
1630 static char * smb_time_audit_sys_acl_to_text(vfs_handle_struct *handle,
1631 SMB_ACL_T theacl,
1632 ssize_t *plen)
1634 char * result;
1635 struct timespec ts1,ts2;
1636 double timediff;
1638 clock_gettime_mono(&ts1);
1639 result = SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
1640 clock_gettime_mono(&ts2);
1641 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1643 if (timediff > audit_timeout) {
1644 smb_time_audit_log("sys_acl_to_text", timediff);
1647 return result;
1650 static SMB_ACL_T smb_time_audit_sys_acl_init(vfs_handle_struct *handle,
1651 int count)
1653 SMB_ACL_T result;
1654 struct timespec ts1,ts2;
1655 double timediff;
1657 clock_gettime_mono(&ts1);
1658 result = SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
1659 clock_gettime_mono(&ts2);
1660 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1662 if (timediff > audit_timeout) {
1663 smb_time_audit_log("sys_acl_init", timediff);
1666 return result;
1669 static int smb_time_audit_sys_acl_create_entry(vfs_handle_struct *handle,
1670 SMB_ACL_T *pacl,
1671 SMB_ACL_ENTRY_T *pentry)
1673 int result;
1674 struct timespec ts1,ts2;
1675 double timediff;
1677 clock_gettime_mono(&ts1);
1678 result = SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
1679 clock_gettime_mono(&ts2);
1680 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1682 if (timediff > audit_timeout) {
1683 smb_time_audit_log("sys_acl_create_entry", timediff);
1686 return result;
1689 static int smb_time_audit_sys_acl_set_tag_type(vfs_handle_struct *handle,
1690 SMB_ACL_ENTRY_T entry,
1691 SMB_ACL_TAG_T tagtype)
1693 int result;
1694 struct timespec ts1,ts2;
1695 double timediff;
1697 clock_gettime_mono(&ts1);
1698 result = SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry,
1699 tagtype);
1700 clock_gettime_mono(&ts2);
1701 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1703 if (timediff > audit_timeout) {
1704 smb_time_audit_log("sys_acl_set_tag_type", timediff);
1707 return result;
1710 static int smb_time_audit_sys_acl_set_qualifier(vfs_handle_struct *handle,
1711 SMB_ACL_ENTRY_T entry,
1712 void *qual)
1714 int result;
1715 struct timespec ts1,ts2;
1716 double timediff;
1718 clock_gettime_mono(&ts1);
1719 result = SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
1720 clock_gettime_mono(&ts2);
1721 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1723 if (timediff > audit_timeout) {
1724 smb_time_audit_log("sys_acl_set_qualifier", timediff);
1727 return result;
1730 static int smb_time_audit_sys_acl_set_permset(vfs_handle_struct *handle,
1731 SMB_ACL_ENTRY_T entry,
1732 SMB_ACL_PERMSET_T permset)
1734 int result;
1735 struct timespec ts1,ts2;
1736 double timediff;
1738 clock_gettime_mono(&ts1);
1739 result = SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
1740 clock_gettime_mono(&ts2);
1741 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1743 if (timediff > audit_timeout) {
1744 smb_time_audit_log("sys_acl_set_permset", timediff);
1747 return result;
1750 static int smb_time_audit_sys_acl_valid(vfs_handle_struct *handle,
1751 SMB_ACL_T theacl)
1753 int result;
1754 struct timespec ts1,ts2;
1755 double timediff;
1757 clock_gettime_mono(&ts1);
1758 result = SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
1759 clock_gettime_mono(&ts2);
1760 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1762 if (timediff > audit_timeout) {
1763 smb_time_audit_log("sys_acl_valid", timediff);
1766 return result;
1769 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
1770 const char *name,
1771 SMB_ACL_TYPE_T acltype,
1772 SMB_ACL_T theacl)
1774 int result;
1775 struct timespec ts1,ts2;
1776 double timediff;
1778 clock_gettime_mono(&ts1);
1779 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
1780 theacl);
1781 clock_gettime_mono(&ts2);
1782 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1784 if (timediff > audit_timeout) {
1785 smb_time_audit_log("sys_acl_set_file", timediff);
1788 return result;
1791 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
1792 files_struct *fsp,
1793 SMB_ACL_T theacl)
1795 int result;
1796 struct timespec ts1,ts2;
1797 double timediff;
1799 clock_gettime_mono(&ts1);
1800 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
1801 clock_gettime_mono(&ts2);
1802 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1804 if (timediff > audit_timeout) {
1805 smb_time_audit_log("sys_acl_set_fd", timediff);
1808 return result;
1811 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
1812 const char *path)
1814 int result;
1815 struct timespec ts1,ts2;
1816 double timediff;
1818 clock_gettime_mono(&ts1);
1819 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
1820 clock_gettime_mono(&ts2);
1821 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1823 if (timediff > audit_timeout) {
1824 smb_time_audit_log("sys_acl_delete_def_file", timediff);
1827 return result;
1830 static int smb_time_audit_sys_acl_get_perm(vfs_handle_struct *handle,
1831 SMB_ACL_PERMSET_T permset,
1832 SMB_ACL_PERM_T perm)
1834 int result;
1835 struct timespec ts1,ts2;
1836 double timediff;
1838 clock_gettime_mono(&ts1);
1839 result = SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
1840 clock_gettime_mono(&ts2);
1841 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1843 if (timediff > audit_timeout) {
1844 smb_time_audit_log("sys_acl_get_perm", timediff);
1847 return result;
1850 static int smb_time_audit_sys_acl_free_text(vfs_handle_struct *handle,
1851 char *text)
1853 int result;
1854 struct timespec ts1,ts2;
1855 double timediff;
1857 clock_gettime_mono(&ts1);
1858 result = SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
1859 clock_gettime_mono(&ts2);
1860 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1862 if (timediff > audit_timeout) {
1863 smb_time_audit_log("sys_acl_free_text", timediff);
1866 return result;
1869 static int smb_time_audit_sys_acl_free_acl(vfs_handle_struct *handle,
1870 SMB_ACL_T posix_acl)
1872 int result;
1873 struct timespec ts1,ts2;
1874 double timediff;
1876 clock_gettime_mono(&ts1);
1877 result = SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
1878 clock_gettime_mono(&ts2);
1879 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1881 if (timediff > audit_timeout) {
1882 smb_time_audit_log("sys_acl_free_acl", timediff);
1885 return result;
1888 static int smb_time_audit_sys_acl_free_qualifier(vfs_handle_struct *handle,
1889 void *qualifier,
1890 SMB_ACL_TAG_T tagtype)
1892 int result;
1893 struct timespec ts1,ts2;
1894 double timediff;
1896 clock_gettime_mono(&ts1);
1897 result = SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier,
1898 tagtype);
1899 clock_gettime_mono(&ts2);
1900 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1902 if (timediff > audit_timeout) {
1903 smb_time_audit_log("sys_acl_free_qualifier", timediff);
1906 return result;
1909 static ssize_t smb_time_audit_getxattr(struct vfs_handle_struct *handle,
1910 const char *path, const char *name,
1911 void *value, size_t size)
1913 ssize_t result;
1914 struct timespec ts1,ts2;
1915 double timediff;
1917 clock_gettime_mono(&ts1);
1918 result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
1919 clock_gettime_mono(&ts2);
1920 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1922 if (timediff > audit_timeout) {
1923 smb_time_audit_log("getxattr", timediff);
1926 return result;
1929 static ssize_t smb_time_audit_lgetxattr(struct vfs_handle_struct *handle,
1930 const char *path, const char *name,
1931 void *value, size_t size)
1933 ssize_t result;
1934 struct timespec ts1,ts2;
1935 double timediff;
1937 clock_gettime_mono(&ts1);
1938 result = SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
1939 clock_gettime_mono(&ts2);
1940 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1942 if (timediff > audit_timeout) {
1943 smb_time_audit_log("lgetxattr", timediff);
1946 return result;
1949 static ssize_t smb_time_audit_fgetxattr(struct vfs_handle_struct *handle,
1950 struct files_struct *fsp,
1951 const char *name, void *value,
1952 size_t size)
1954 ssize_t result;
1955 struct timespec ts1,ts2;
1956 double timediff;
1958 clock_gettime_mono(&ts1);
1959 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1960 clock_gettime_mono(&ts2);
1961 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1963 if (timediff > audit_timeout) {
1964 smb_time_audit_log("fgetxattr", timediff);
1967 return result;
1970 static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
1971 const char *path, char *list,
1972 size_t size)
1974 ssize_t result;
1975 struct timespec ts1,ts2;
1976 double timediff;
1978 clock_gettime_mono(&ts1);
1979 result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
1980 clock_gettime_mono(&ts2);
1981 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1983 if (timediff > audit_timeout) {
1984 smb_time_audit_log("listxattr", timediff);
1987 return result;
1990 static ssize_t smb_time_audit_llistxattr(struct vfs_handle_struct *handle,
1991 const char *path, char *list,
1992 size_t size)
1994 ssize_t result;
1995 struct timespec ts1,ts2;
1996 double timediff;
1998 clock_gettime_mono(&ts1);
1999 result = SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
2000 clock_gettime_mono(&ts2);
2001 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2003 if (timediff > audit_timeout) {
2004 smb_time_audit_log("llistxattr", timediff);
2007 return result;
2010 static ssize_t smb_time_audit_flistxattr(struct vfs_handle_struct *handle,
2011 struct files_struct *fsp, char *list,
2012 size_t size)
2014 ssize_t result;
2015 struct timespec ts1,ts2;
2016 double timediff;
2018 clock_gettime_mono(&ts1);
2019 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2020 clock_gettime_mono(&ts2);
2021 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2023 if (timediff > audit_timeout) {
2024 smb_time_audit_log("flistxattr", timediff);
2027 return result;
2030 static int smb_time_audit_removexattr(struct vfs_handle_struct *handle,
2031 const char *path, const char *name)
2033 int result;
2034 struct timespec ts1,ts2;
2035 double timediff;
2037 clock_gettime_mono(&ts1);
2038 result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
2039 clock_gettime_mono(&ts2);
2040 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2042 if (timediff > audit_timeout) {
2043 smb_time_audit_log("removexattr", timediff);
2046 return result;
2049 static int smb_time_audit_lremovexattr(struct vfs_handle_struct *handle,
2050 const char *path, const char *name)
2052 int result;
2053 struct timespec ts1,ts2;
2054 double timediff;
2056 clock_gettime_mono(&ts1);
2057 result = SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
2058 clock_gettime_mono(&ts2);
2059 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2061 if (timediff > audit_timeout) {
2062 smb_time_audit_log("lremovexattr", timediff);
2065 return result;
2068 static int smb_time_audit_fremovexattr(struct vfs_handle_struct *handle,
2069 struct files_struct *fsp,
2070 const char *name)
2072 int result;
2073 struct timespec ts1,ts2;
2074 double timediff;
2076 clock_gettime_mono(&ts1);
2077 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2078 clock_gettime_mono(&ts2);
2079 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2081 if (timediff > audit_timeout) {
2082 smb_time_audit_log("fremovexattr", timediff);
2085 return result;
2088 static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
2089 const char *path, const char *name,
2090 const void *value, size_t size,
2091 int flags)
2093 int result;
2094 struct timespec ts1,ts2;
2095 double timediff;
2097 clock_gettime_mono(&ts1);
2098 result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
2099 flags);
2100 clock_gettime_mono(&ts2);
2101 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2103 if (timediff > audit_timeout) {
2104 smb_time_audit_log("setxattr", timediff);
2107 return result;
2110 static int smb_time_audit_lsetxattr(struct vfs_handle_struct *handle,
2111 const char *path, const char *name,
2112 const void *value, size_t size,
2113 int flags)
2115 int result;
2116 struct timespec ts1,ts2;
2117 double timediff;
2119 clock_gettime_mono(&ts1);
2120 result = SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size,
2121 flags);
2122 clock_gettime_mono(&ts2);
2123 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2125 if (timediff > audit_timeout) {
2126 smb_time_audit_log("lsetxattr", timediff);
2129 return result;
2132 static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle,
2133 struct files_struct *fsp, const char *name,
2134 const void *value, size_t size, int flags)
2136 int result;
2137 struct timespec ts1,ts2;
2138 double timediff;
2140 clock_gettime_mono(&ts1);
2141 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2142 clock_gettime_mono(&ts2);
2143 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2145 if (timediff > audit_timeout) {
2146 smb_time_audit_log("fsetxattr", timediff);
2149 return result;
2152 static int smb_time_audit_aio_read(struct vfs_handle_struct *handle,
2153 struct files_struct *fsp,
2154 SMB_STRUCT_AIOCB *aiocb)
2156 int result;
2157 struct timespec ts1,ts2;
2158 double timediff;
2160 clock_gettime_mono(&ts1);
2161 result = SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
2162 clock_gettime_mono(&ts2);
2163 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2165 if (timediff > audit_timeout) {
2166 smb_time_audit_log("aio_read", timediff);
2169 return result;
2172 static int smb_time_audit_aio_write(struct vfs_handle_struct *handle,
2173 struct files_struct *fsp,
2174 SMB_STRUCT_AIOCB *aiocb)
2176 int result;
2177 struct timespec ts1,ts2;
2178 double timediff;
2180 clock_gettime_mono(&ts1);
2181 result = SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
2182 clock_gettime_mono(&ts2);
2183 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2185 if (timediff > audit_timeout) {
2186 smb_time_audit_log("aio_write", timediff);
2189 return result;
2192 static ssize_t smb_time_audit_aio_return(struct vfs_handle_struct *handle,
2193 struct files_struct *fsp,
2194 SMB_STRUCT_AIOCB *aiocb)
2196 int result;
2197 struct timespec ts1,ts2;
2198 double timediff;
2200 clock_gettime_mono(&ts1);
2201 result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
2202 clock_gettime_mono(&ts2);
2203 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2205 if (timediff > audit_timeout) {
2206 smb_time_audit_log("aio_return", timediff);
2209 return result;
2212 static int smb_time_audit_aio_cancel(struct vfs_handle_struct *handle,
2213 struct files_struct *fsp,
2214 SMB_STRUCT_AIOCB *aiocb)
2216 int result;
2217 struct timespec ts1,ts2;
2218 double timediff;
2220 clock_gettime_mono(&ts1);
2221 result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
2222 clock_gettime_mono(&ts2);
2223 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2225 if (timediff > audit_timeout) {
2226 smb_time_audit_log("aio_cancel", timediff);
2229 return result;
2232 static int smb_time_audit_aio_error(struct vfs_handle_struct *handle,
2233 struct files_struct *fsp,
2234 SMB_STRUCT_AIOCB *aiocb)
2236 int result;
2237 struct timespec ts1,ts2;
2238 double timediff;
2240 clock_gettime_mono(&ts1);
2241 result = SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
2242 clock_gettime_mono(&ts2);
2243 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2245 if (timediff > audit_timeout) {
2246 smb_time_audit_log("aio_error", timediff);
2249 return result;
2252 static int smb_time_audit_aio_fsync(struct vfs_handle_struct *handle,
2253 struct files_struct *fsp, int op,
2254 SMB_STRUCT_AIOCB *aiocb)
2256 int result;
2257 struct timespec ts1,ts2;
2258 double timediff;
2260 clock_gettime_mono(&ts1);
2261 result = SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
2262 clock_gettime_mono(&ts2);
2263 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2265 if (timediff > audit_timeout) {
2266 smb_time_audit_log("aio_fsync", timediff);
2269 return result;
2272 static int smb_time_audit_aio_suspend(struct vfs_handle_struct *handle,
2273 struct files_struct *fsp,
2274 const SMB_STRUCT_AIOCB * const aiocb[],
2275 int n, const struct timespec *ts)
2277 int result;
2278 struct timespec ts1,ts2;
2279 double timediff;
2281 clock_gettime_mono(&ts1);
2282 result = SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
2283 clock_gettime_mono(&ts2);
2284 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2286 if (timediff > audit_timeout) {
2287 smb_time_audit_log("aio_suspend", timediff);
2290 return result;
2293 static bool smb_time_audit_aio_force(struct vfs_handle_struct *handle,
2294 struct files_struct *fsp)
2296 bool result;
2297 struct timespec ts1,ts2;
2298 double timediff;
2300 clock_gettime_mono(&ts1);
2301 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2302 clock_gettime_mono(&ts2);
2303 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2305 if (timediff > audit_timeout) {
2306 smb_time_audit_log("aio_force", timediff);
2309 return result;
2314 /* VFS operations */
2316 static struct vfs_fn_pointers vfs_time_audit_fns = {
2317 .connect_fn = smb_time_audit_connect,
2318 .disconnect = smb_time_audit_disconnect,
2319 .disk_free = smb_time_audit_disk_free,
2320 .get_quota = smb_time_audit_get_quota,
2321 .set_quota = smb_time_audit_set_quota,
2322 .get_shadow_copy_data = smb_time_audit_get_shadow_copy_data,
2323 .statvfs = smb_time_audit_statvfs,
2324 .fs_capabilities = smb_time_audit_fs_capabilities,
2325 .opendir = smb_time_audit_opendir,
2326 .readdir = smb_time_audit_readdir,
2327 .seekdir = smb_time_audit_seekdir,
2328 .telldir = smb_time_audit_telldir,
2329 .rewind_dir = smb_time_audit_rewinddir,
2330 .mkdir = smb_time_audit_mkdir,
2331 .rmdir = smb_time_audit_rmdir,
2332 .closedir = smb_time_audit_closedir,
2333 .init_search_op = smb_time_audit_init_search_op,
2334 .open = smb_time_audit_open,
2335 .create_file = smb_time_audit_create_file,
2336 .close_fn = smb_time_audit_close,
2337 .vfs_read = smb_time_audit_read,
2338 .pread = smb_time_audit_pread,
2339 .write = smb_time_audit_write,
2340 .pwrite = smb_time_audit_pwrite,
2341 .lseek = smb_time_audit_lseek,
2342 .sendfile = smb_time_audit_sendfile,
2343 .recvfile = smb_time_audit_recvfile,
2344 .rename = smb_time_audit_rename,
2345 .fsync = smb_time_audit_fsync,
2346 .stat = smb_time_audit_stat,
2347 .fstat = smb_time_audit_fstat,
2348 .lstat = smb_time_audit_lstat,
2349 .get_alloc_size = smb_time_audit_get_alloc_size,
2350 .unlink = smb_time_audit_unlink,
2351 .chmod = smb_time_audit_chmod,
2352 .fchmod = smb_time_audit_fchmod,
2353 .chown = smb_time_audit_chown,
2354 .fchown = smb_time_audit_fchown,
2355 .lchown = smb_time_audit_lchown,
2356 .chdir = smb_time_audit_chdir,
2357 .getwd = smb_time_audit_getwd,
2358 .ntimes = smb_time_audit_ntimes,
2359 .ftruncate = smb_time_audit_ftruncate,
2360 .posix_fallocate = smb_time_audit_posix_fallocate,
2361 .lock = smb_time_audit_lock,
2362 .kernel_flock = smb_time_audit_kernel_flock,
2363 .linux_setlease = smb_time_audit_linux_setlease,
2364 .getlock = smb_time_audit_getlock,
2365 .symlink = smb_time_audit_symlink,
2366 .vfs_readlink = smb_time_audit_readlink,
2367 .link = smb_time_audit_link,
2368 .mknod = smb_time_audit_mknod,
2369 .realpath = smb_time_audit_realpath,
2370 .notify_watch = smb_time_audit_notify_watch,
2371 .chflags = smb_time_audit_chflags,
2372 .file_id_create = smb_time_audit_file_id_create,
2373 .streaminfo = smb_time_audit_streaminfo,
2374 .get_real_filename = smb_time_audit_get_real_filename,
2375 .connectpath = smb_time_audit_connectpath,
2376 .brl_lock_windows = smb_time_audit_brl_lock_windows,
2377 .brl_unlock_windows = smb_time_audit_brl_unlock_windows,
2378 .brl_cancel_windows = smb_time_audit_brl_cancel_windows,
2379 .strict_lock = smb_time_audit_strict_lock,
2380 .strict_unlock = smb_time_audit_strict_unlock,
2381 .translate_name = smb_time_audit_translate_name,
2382 .fget_nt_acl = smb_time_audit_fget_nt_acl,
2383 .get_nt_acl = smb_time_audit_get_nt_acl,
2384 .fset_nt_acl = smb_time_audit_fset_nt_acl,
2385 .chmod_acl = smb_time_audit_chmod_acl,
2386 .fchmod_acl = smb_time_audit_fchmod_acl,
2387 .sys_acl_get_entry = smb_time_audit_sys_acl_get_entry,
2388 .sys_acl_get_tag_type = smb_time_audit_sys_acl_get_tag_type,
2389 .sys_acl_get_permset = smb_time_audit_sys_acl_get_permset,
2390 .sys_acl_get_qualifier = smb_time_audit_sys_acl_get_qualifier,
2391 .sys_acl_get_file = smb_time_audit_sys_acl_get_file,
2392 .sys_acl_get_fd = smb_time_audit_sys_acl_get_fd,
2393 .sys_acl_clear_perms = smb_time_audit_sys_acl_clear_perms,
2394 .sys_acl_add_perm = smb_time_audit_sys_acl_add_perm,
2395 .sys_acl_to_text = smb_time_audit_sys_acl_to_text,
2396 .sys_acl_init = smb_time_audit_sys_acl_init,
2397 .sys_acl_create_entry = smb_time_audit_sys_acl_create_entry,
2398 .sys_acl_set_tag_type = smb_time_audit_sys_acl_set_tag_type,
2399 .sys_acl_set_qualifier = smb_time_audit_sys_acl_set_qualifier,
2400 .sys_acl_set_permset = smb_time_audit_sys_acl_set_permset,
2401 .sys_acl_valid = smb_time_audit_sys_acl_valid,
2402 .sys_acl_set_file = smb_time_audit_sys_acl_set_file,
2403 .sys_acl_set_fd = smb_time_audit_sys_acl_set_fd,
2404 .sys_acl_delete_def_file = smb_time_audit_sys_acl_delete_def_file,
2405 .sys_acl_get_perm = smb_time_audit_sys_acl_get_perm,
2406 .sys_acl_free_text = smb_time_audit_sys_acl_free_text,
2407 .sys_acl_free_acl = smb_time_audit_sys_acl_free_acl,
2408 .sys_acl_free_qualifier = smb_time_audit_sys_acl_free_qualifier,
2409 .getxattr = smb_time_audit_getxattr,
2410 .lgetxattr = smb_time_audit_lgetxattr,
2411 .fgetxattr = smb_time_audit_fgetxattr,
2412 .listxattr = smb_time_audit_listxattr,
2413 .llistxattr = smb_time_audit_llistxattr,
2414 .flistxattr = smb_time_audit_flistxattr,
2415 .removexattr = smb_time_audit_removexattr,
2416 .lremovexattr = smb_time_audit_lremovexattr,
2417 .fremovexattr = smb_time_audit_fremovexattr,
2418 .setxattr = smb_time_audit_setxattr,
2419 .lsetxattr = smb_time_audit_lsetxattr,
2420 .fsetxattr = smb_time_audit_fsetxattr,
2421 .aio_read = smb_time_audit_aio_read,
2422 .aio_write = smb_time_audit_aio_write,
2423 .aio_return_fn = smb_time_audit_aio_return,
2424 .aio_cancel = smb_time_audit_aio_cancel,
2425 .aio_error_fn = smb_time_audit_aio_error,
2426 .aio_fsync = smb_time_audit_aio_fsync,
2427 .aio_suspend = smb_time_audit_aio_suspend,
2428 .aio_force = smb_time_audit_aio_force,
2432 NTSTATUS vfs_time_audit_init(void);
2433 NTSTATUS vfs_time_audit_init(void)
2435 audit_timeout = (double)lp_parm_int(-1, "time_audit", "timeout",
2436 10000) / 1000.0;
2437 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "time_audit",
2438 &vfs_time_audit_fns);