s4-dsdb: allow modification of some deleted object if the show-deleted control is...
[Samba/bb.git] / source3 / modules / vfs_time_audit.c
bloba5ca407673ad258201051aaf74e056914f79874b
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"
29 #include "smbd/smbd.h"
30 #include "ntioctl.h"
32 #undef DBGC_CLASS
33 #define DBGC_CLASS DBGC_VFS
35 static double audit_timeout;
37 static void smb_time_audit_log(const char *syscallname, double elapsed)
39 DEBUG(0, ("WARNING: System call \"%s\" took unexpectedly long "
40 "(%.2f seconds) -- Validate that file and storage "
41 "subsystems are operating normally\n", syscallname,
42 elapsed));
45 static int smb_time_audit_connect(vfs_handle_struct *handle,
46 const char *svc, const char *user)
48 int result;
49 struct timespec ts1,ts2;
50 double timediff;
52 if (!handle) {
53 return -1;
56 clock_gettime_mono(&ts1);
57 result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
58 clock_gettime_mono(&ts2);
59 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
60 if (timediff > audit_timeout) {
61 smb_time_audit_log("connect", timediff);
63 return result;
66 static void smb_time_audit_disconnect(vfs_handle_struct *handle)
68 struct timespec ts1,ts2;
69 double timediff;
71 clock_gettime_mono(&ts1);
72 SMB_VFS_NEXT_DISCONNECT(handle);
73 clock_gettime_mono(&ts2);
74 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
76 if (timediff > audit_timeout) {
77 smb_time_audit_log("disconnect", timediff);
80 return;
83 static uint64_t smb_time_audit_disk_free(vfs_handle_struct *handle,
84 const char *path,
85 bool small_query, uint64_t *bsize,
86 uint64_t *dfree, uint64_t *dsize)
88 uint64_t result;
89 struct timespec ts1,ts2;
90 double timediff;
92 clock_gettime_mono(&ts1);
93 result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
94 dfree, dsize);
95 clock_gettime_mono(&ts2);
96 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
98 /* Don't have a reasonable notion of failure here */
99 if (timediff > audit_timeout) {
100 smb_time_audit_log("disk_free", timediff);
103 return result;
106 static int smb_time_audit_get_quota(struct vfs_handle_struct *handle,
107 enum SMB_QUOTA_TYPE qtype, unid_t id,
108 SMB_DISK_QUOTA *qt)
110 int result;
111 struct timespec ts1,ts2;
112 double timediff;
114 clock_gettime_mono(&ts1);
115 result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
116 clock_gettime_mono(&ts2);
117 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
119 if (timediff > audit_timeout) {
120 smb_time_audit_log("get_quota", timediff);
122 return result;
125 static int smb_time_audit_set_quota(struct vfs_handle_struct *handle,
126 enum SMB_QUOTA_TYPE qtype, unid_t id,
127 SMB_DISK_QUOTA *qt)
129 int result;
130 struct timespec ts1,ts2;
131 double timediff;
133 clock_gettime_mono(&ts1);
134 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
135 clock_gettime_mono(&ts2);
136 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
138 if (timediff > audit_timeout) {
139 smb_time_audit_log("set_quota", timediff);
142 return result;
145 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
146 struct files_struct *fsp,
147 struct shadow_copy_data *shadow_copy_data,
148 bool labels)
150 int result;
151 struct timespec ts1,ts2;
152 double timediff;
154 clock_gettime_mono(&ts1);
155 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp,
156 shadow_copy_data, labels);
157 clock_gettime_mono(&ts2);
158 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
160 if (timediff > audit_timeout) {
161 smb_time_audit_log("get_shadow_copy_data", timediff);
164 return result;
167 static int smb_time_audit_statvfs(struct vfs_handle_struct *handle,
168 const char *path,
169 struct vfs_statvfs_struct *statbuf)
171 int result;
172 struct timespec ts1,ts2;
173 double timediff;
175 clock_gettime_mono(&ts1);
176 result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
177 clock_gettime_mono(&ts2);
178 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
180 if (timediff > audit_timeout) {
181 smb_time_audit_log("statvfs", timediff);
184 return result;
187 static uint32_t smb_time_audit_fs_capabilities(struct vfs_handle_struct *handle,
188 enum timestamp_set_resolution *p_ts_res)
190 uint32_t result;
191 struct timespec ts1,ts2;
192 double timediff;
194 clock_gettime_mono(&ts1);
195 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
196 clock_gettime_mono(&ts2);
197 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
199 if (timediff > audit_timeout) {
200 smb_time_audit_log("fs_capabilities", timediff);
203 return result;
206 static DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
207 const char *fname,
208 const char *mask, uint32 attr)
210 DIR *result;
211 struct timespec ts1,ts2;
212 double timediff;
214 clock_gettime_mono(&ts1);
215 result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
216 clock_gettime_mono(&ts2);
217 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
219 if (timediff > audit_timeout) {
220 smb_time_audit_log("opendir", timediff);
223 return result;
226 static DIR *smb_time_audit_fdopendir(vfs_handle_struct *handle,
227 files_struct *fsp,
228 const char *mask, uint32 attr)
230 DIR *result;
231 struct timespec ts1,ts2;
232 double timediff;
234 clock_gettime_mono(&ts1);
235 result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
236 clock_gettime_mono(&ts2);
237 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
239 if (timediff > audit_timeout) {
240 smb_time_audit_log("fdopendir", timediff);
243 return result;
246 static struct dirent *smb_time_audit_readdir(vfs_handle_struct *handle,
247 DIR *dirp,
248 SMB_STRUCT_STAT *sbuf)
250 struct dirent *result;
251 struct timespec ts1,ts2;
252 double timediff;
254 clock_gettime_mono(&ts1);
255 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
256 clock_gettime_mono(&ts2);
257 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
259 if (timediff > audit_timeout) {
260 smb_time_audit_log("readdir", timediff);
263 return result;
266 static void smb_time_audit_seekdir(vfs_handle_struct *handle,
267 DIR *dirp, long offset)
269 struct timespec ts1,ts2;
270 double timediff;
272 clock_gettime_mono(&ts1);
273 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
274 clock_gettime_mono(&ts2);
275 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
277 if (timediff > audit_timeout) {
278 smb_time_audit_log("seekdir", timediff);
281 return;
284 static long smb_time_audit_telldir(vfs_handle_struct *handle,
285 DIR *dirp)
287 long result;
288 struct timespec ts1,ts2;
289 double timediff;
291 clock_gettime_mono(&ts1);
292 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
293 clock_gettime_mono(&ts2);
294 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
296 if (timediff > audit_timeout) {
297 smb_time_audit_log("telldir", timediff);
300 return result;
303 static void smb_time_audit_rewinddir(vfs_handle_struct *handle,
304 DIR *dirp)
306 struct timespec ts1,ts2;
307 double timediff;
309 clock_gettime_mono(&ts1);
310 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
311 clock_gettime_mono(&ts2);
312 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
314 if (timediff > audit_timeout) {
315 smb_time_audit_log("rewinddir", timediff);
318 return;
321 static int smb_time_audit_mkdir(vfs_handle_struct *handle,
322 const char *path, mode_t mode)
324 int result;
325 struct timespec ts1,ts2;
326 double timediff;
328 clock_gettime_mono(&ts1);
329 result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
330 clock_gettime_mono(&ts2);
331 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
333 if (timediff > audit_timeout) {
334 smb_time_audit_log("mkdir", timediff);
337 return result;
340 static int smb_time_audit_rmdir(vfs_handle_struct *handle,
341 const char *path)
343 int result;
344 struct timespec ts1,ts2;
345 double timediff;
347 clock_gettime_mono(&ts1);
348 result = SMB_VFS_NEXT_RMDIR(handle, path);
349 clock_gettime_mono(&ts2);
350 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
352 if (timediff > audit_timeout) {
353 smb_time_audit_log("rmdir", timediff);
356 return result;
359 static int smb_time_audit_closedir(vfs_handle_struct *handle,
360 DIR *dirp)
362 int result;
363 struct timespec ts1,ts2;
364 double timediff;
366 clock_gettime_mono(&ts1);
367 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
368 clock_gettime_mono(&ts2);
369 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
371 if (timediff > audit_timeout) {
372 smb_time_audit_log("closedir", timediff);
375 return result;
378 static void smb_time_audit_init_search_op(vfs_handle_struct *handle,
379 DIR *dirp)
381 struct timespec ts1,ts2;
382 double timediff;
384 clock_gettime_mono(&ts1);
385 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
386 clock_gettime_mono(&ts2);
387 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
389 if (timediff > audit_timeout) {
390 smb_time_audit_log("init_search_op", timediff);
392 return;
395 static int smb_time_audit_open(vfs_handle_struct *handle,
396 struct smb_filename *fname,
397 files_struct *fsp,
398 int flags, mode_t mode)
400 int result;
401 struct timespec ts1,ts2;
402 double timediff;
404 clock_gettime_mono(&ts1);
405 result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
406 clock_gettime_mono(&ts2);
407 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
409 if (timediff > audit_timeout) {
410 smb_time_audit_log("open", timediff);
413 return result;
416 static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
417 struct smb_request *req,
418 uint16_t root_dir_fid,
419 struct smb_filename *fname,
420 uint32_t access_mask,
421 uint32_t share_access,
422 uint32_t create_disposition,
423 uint32_t create_options,
424 uint32_t file_attributes,
425 uint32_t oplock_request,
426 uint64_t allocation_size,
427 uint32_t private_flags,
428 struct security_descriptor *sd,
429 struct ea_list *ea_list,
430 files_struct **result_fsp,
431 int *pinfo)
433 NTSTATUS result;
434 struct timespec ts1,ts2;
435 double timediff;
437 clock_gettime_mono(&ts1);
438 result = SMB_VFS_NEXT_CREATE_FILE(
439 handle, /* handle */
440 req, /* req */
441 root_dir_fid, /* root_dir_fid */
442 fname, /* fname */
443 access_mask, /* access_mask */
444 share_access, /* share_access */
445 create_disposition, /* create_disposition*/
446 create_options, /* create_options */
447 file_attributes, /* file_attributes */
448 oplock_request, /* oplock_request */
449 allocation_size, /* allocation_size */
450 private_flags,
451 sd, /* sd */
452 ea_list, /* ea_list */
453 result_fsp, /* result */
454 pinfo);
455 clock_gettime_mono(&ts2);
456 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
458 if (timediff > audit_timeout) {
459 smb_time_audit_log("create_file", timediff);
462 return result;
465 static int smb_time_audit_close(vfs_handle_struct *handle, files_struct *fsp)
467 int result;
468 struct timespec ts1,ts2;
469 double timediff;
471 clock_gettime_mono(&ts1);
472 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
473 clock_gettime_mono(&ts2);
474 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
476 if (timediff > audit_timeout) {
477 smb_time_audit_log("close", timediff);
480 return result;
483 static ssize_t smb_time_audit_read(vfs_handle_struct *handle,
484 files_struct *fsp, void *data, size_t n)
486 ssize_t result;
487 struct timespec ts1,ts2;
488 double timediff;
490 clock_gettime_mono(&ts1);
491 result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
492 clock_gettime_mono(&ts2);
493 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
495 if (timediff > audit_timeout) {
496 smb_time_audit_log("read", timediff);
499 return result;
502 static ssize_t smb_time_audit_pread(vfs_handle_struct *handle,
503 files_struct *fsp,
504 void *data, size_t n, off_t offset)
506 ssize_t result;
507 struct timespec ts1,ts2;
508 double timediff;
510 clock_gettime_mono(&ts1);
511 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
512 clock_gettime_mono(&ts2);
513 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
515 if (timediff > audit_timeout) {
516 smb_time_audit_log("pread", timediff);
519 return result;
522 static ssize_t smb_time_audit_write(vfs_handle_struct *handle,
523 files_struct *fsp,
524 const void *data, size_t n)
526 ssize_t result;
527 struct timespec ts1,ts2;
528 double timediff;
530 clock_gettime_mono(&ts1);
531 result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
532 clock_gettime_mono(&ts2);
533 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
535 if (timediff > audit_timeout) {
536 smb_time_audit_log("write", timediff);
539 return result;
542 static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle,
543 files_struct *fsp,
544 const void *data, size_t n,
545 off_t offset)
547 ssize_t result;
548 struct timespec ts1,ts2;
549 double timediff;
551 clock_gettime_mono(&ts1);
552 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
553 clock_gettime_mono(&ts2);
554 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
556 if (timediff > audit_timeout) {
557 smb_time_audit_log("pwrite", timediff);
560 return result;
563 static off_t smb_time_audit_lseek(vfs_handle_struct *handle,
564 files_struct *fsp,
565 off_t offset, int whence)
567 off_t result;
568 struct timespec ts1,ts2;
569 double timediff;
571 clock_gettime_mono(&ts1);
572 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
573 clock_gettime_mono(&ts2);
574 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
576 if (timediff > audit_timeout) {
577 smb_time_audit_log("lseek", timediff);
580 return result;
583 static ssize_t smb_time_audit_sendfile(vfs_handle_struct *handle, int tofd,
584 files_struct *fromfsp,
585 const DATA_BLOB *hdr, off_t offset,
586 size_t n)
588 ssize_t result;
589 struct timespec ts1,ts2;
590 double timediff;
592 clock_gettime_mono(&ts1);
593 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
594 clock_gettime_mono(&ts2);
595 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
597 if (timediff > audit_timeout) {
598 smb_time_audit_log("sendfile", timediff);
601 return result;
604 static ssize_t smb_time_audit_recvfile(vfs_handle_struct *handle, int fromfd,
605 files_struct *tofsp,
606 off_t offset,
607 size_t n)
609 ssize_t result;
610 struct timespec ts1,ts2;
611 double timediff;
613 clock_gettime_mono(&ts1);
614 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
615 clock_gettime_mono(&ts2);
616 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
618 if (timediff > audit_timeout) {
619 smb_time_audit_log("recvfile", timediff);
622 return result;
625 static int smb_time_audit_rename(vfs_handle_struct *handle,
626 const struct smb_filename *oldname,
627 const struct smb_filename *newname)
629 int result;
630 struct timespec ts1,ts2;
631 double timediff;
633 clock_gettime_mono(&ts1);
634 result = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
635 clock_gettime_mono(&ts2);
636 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
638 if (timediff > audit_timeout) {
639 smb_time_audit_log("rename", timediff);
642 return result;
645 static int smb_time_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
647 int result;
648 struct timespec ts1,ts2;
649 double timediff;
651 clock_gettime_mono(&ts1);
652 result = SMB_VFS_NEXT_FSYNC(handle, fsp);
653 clock_gettime_mono(&ts2);
654 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
656 if (timediff > audit_timeout) {
657 smb_time_audit_log("fsync", timediff);
660 return result;
663 static int smb_time_audit_stat(vfs_handle_struct *handle,
664 struct smb_filename *fname)
666 int result;
667 struct timespec ts1,ts2;
668 double timediff;
670 clock_gettime_mono(&ts1);
671 result = SMB_VFS_NEXT_STAT(handle, fname);
672 clock_gettime_mono(&ts2);
673 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
675 if (timediff > audit_timeout) {
676 smb_time_audit_log("stat", timediff);
679 return result;
682 static int smb_time_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
683 SMB_STRUCT_STAT *sbuf)
685 int result;
686 struct timespec ts1,ts2;
687 double timediff;
689 clock_gettime_mono(&ts1);
690 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
691 clock_gettime_mono(&ts2);
692 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
694 if (timediff > audit_timeout) {
695 smb_time_audit_log("fstat", timediff);
698 return result;
701 static int smb_time_audit_lstat(vfs_handle_struct *handle,
702 struct smb_filename *path)
704 int result;
705 struct timespec ts1,ts2;
706 double timediff;
708 clock_gettime_mono(&ts1);
709 result = SMB_VFS_NEXT_LSTAT(handle, path);
710 clock_gettime_mono(&ts2);
711 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
713 if (timediff > audit_timeout) {
714 smb_time_audit_log("lstat", timediff);
717 return result;
720 static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
721 files_struct *fsp,
722 const SMB_STRUCT_STAT *sbuf)
724 uint64_t result;
725 struct timespec ts1,ts2;
726 double timediff;
728 clock_gettime_mono(&ts1);
729 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
730 clock_gettime_mono(&ts2);
731 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
733 if (timediff > audit_timeout) {
734 smb_time_audit_log("get_alloc_size", timediff);
737 return result;
740 static int smb_time_audit_unlink(vfs_handle_struct *handle,
741 const struct smb_filename *path)
743 int result;
744 struct timespec ts1,ts2;
745 double timediff;
747 clock_gettime_mono(&ts1);
748 result = SMB_VFS_NEXT_UNLINK(handle, path);
749 clock_gettime_mono(&ts2);
750 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
752 if (timediff > audit_timeout) {
753 smb_time_audit_log("unlink", timediff);
756 return result;
759 static int smb_time_audit_chmod(vfs_handle_struct *handle,
760 const char *path, mode_t mode)
762 int result;
763 struct timespec ts1,ts2;
764 double timediff;
766 clock_gettime_mono(&ts1);
767 result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
768 clock_gettime_mono(&ts2);
769 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
771 if (timediff > audit_timeout) {
772 smb_time_audit_log("chmod", timediff);
775 return result;
778 static int smb_time_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
779 mode_t mode)
781 int result;
782 struct timespec ts1,ts2;
783 double timediff;
785 clock_gettime_mono(&ts1);
786 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
787 clock_gettime_mono(&ts2);
788 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
790 if (timediff > audit_timeout) {
791 smb_time_audit_log("fchmod", timediff);
794 return result;
797 static int smb_time_audit_chown(vfs_handle_struct *handle,
798 const char *path, uid_t uid, gid_t gid)
800 int result;
801 struct timespec ts1,ts2;
802 double timediff;
804 clock_gettime_mono(&ts1);
805 result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
806 clock_gettime_mono(&ts2);
807 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
809 if (timediff > audit_timeout) {
810 smb_time_audit_log("chown", timediff);
813 return result;
816 static int smb_time_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
817 uid_t uid, gid_t gid)
819 int result;
820 struct timespec ts1,ts2;
821 double timediff;
823 clock_gettime_mono(&ts1);
824 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
825 clock_gettime_mono(&ts2);
826 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
828 if (timediff > audit_timeout) {
829 smb_time_audit_log("fchown", timediff);
832 return result;
835 static int smb_time_audit_lchown(vfs_handle_struct *handle,
836 const char *path, uid_t uid, gid_t gid)
838 int result;
839 struct timespec ts1,ts2;
840 double timediff;
842 clock_gettime_mono(&ts1);
843 result = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
844 clock_gettime_mono(&ts2);
845 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
847 if (timediff > audit_timeout) {
848 smb_time_audit_log("lchown", timediff);
851 return result;
854 static int smb_time_audit_chdir(vfs_handle_struct *handle, const char *path)
856 int result;
857 struct timespec ts1,ts2;
858 double timediff;
860 clock_gettime_mono(&ts1);
861 result = SMB_VFS_NEXT_CHDIR(handle, path);
862 clock_gettime_mono(&ts2);
863 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
865 if (timediff > audit_timeout) {
866 smb_time_audit_log("chdir", timediff);
869 return result;
872 static char *smb_time_audit_getwd(vfs_handle_struct *handle)
874 char *result;
875 struct timespec ts1,ts2;
876 double timediff;
878 clock_gettime_mono(&ts1);
879 result = SMB_VFS_NEXT_GETWD(handle);
880 clock_gettime_mono(&ts2);
881 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
883 if (timediff > audit_timeout) {
884 smb_time_audit_log("getwd", timediff);
887 return result;
890 static int smb_time_audit_ntimes(vfs_handle_struct *handle,
891 const struct smb_filename *path,
892 struct smb_file_time *ft)
894 int result;
895 struct timespec ts1,ts2;
896 double timediff;
898 clock_gettime_mono(&ts1);
899 result = SMB_VFS_NEXT_NTIMES(handle, path, ft);
900 clock_gettime_mono(&ts2);
901 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
903 if (timediff > audit_timeout) {
904 smb_time_audit_log("ntimes", timediff);
907 return result;
910 static int smb_time_audit_ftruncate(vfs_handle_struct *handle,
911 files_struct *fsp,
912 off_t len)
914 int result;
915 struct timespec ts1,ts2;
916 double timediff;
918 clock_gettime_mono(&ts1);
919 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
920 clock_gettime_mono(&ts2);
921 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
923 if (timediff > audit_timeout) {
924 smb_time_audit_log("ftruncate", timediff);
927 return result;
930 static int smb_time_audit_fallocate(vfs_handle_struct *handle,
931 files_struct *fsp,
932 enum vfs_fallocate_mode mode,
933 off_t offset,
934 off_t len)
936 int result;
937 struct timespec ts1,ts2;
938 double timediff;
940 clock_gettime_mono(&ts1);
941 result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
942 clock_gettime_mono(&ts2);
943 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
945 if (timediff > audit_timeout) {
946 smb_time_audit_log("fallocate", timediff);
949 return result;
952 static bool smb_time_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
953 int op, off_t offset, off_t count,
954 int type)
956 bool result;
957 struct timespec ts1,ts2;
958 double timediff;
960 clock_gettime_mono(&ts1);
961 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
962 clock_gettime_mono(&ts2);
963 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
965 if (timediff > audit_timeout) {
966 smb_time_audit_log("lock", timediff);
969 return result;
972 static int smb_time_audit_kernel_flock(struct vfs_handle_struct *handle,
973 struct files_struct *fsp,
974 uint32 share_mode, uint32 access_mask)
976 int result;
977 struct timespec ts1,ts2;
978 double timediff;
980 clock_gettime_mono(&ts1);
981 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode,
982 access_mask);
983 clock_gettime_mono(&ts2);
984 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
986 if (timediff > audit_timeout) {
987 smb_time_audit_log("kernel_flock", timediff);
990 return result;
993 static int smb_time_audit_linux_setlease(vfs_handle_struct *handle,
994 files_struct *fsp,
995 int leasetype)
997 int result;
998 struct timespec ts1,ts2;
999 double timediff;
1001 clock_gettime_mono(&ts1);
1002 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
1003 clock_gettime_mono(&ts2);
1004 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1006 if (timediff > audit_timeout) {
1007 smb_time_audit_log("linux_setlease", timediff);
1010 return result;
1013 static bool smb_time_audit_getlock(vfs_handle_struct *handle,
1014 files_struct *fsp,
1015 off_t *poffset, off_t *pcount,
1016 int *ptype, pid_t *ppid)
1018 bool result;
1019 struct timespec ts1,ts2;
1020 double timediff;
1022 clock_gettime_mono(&ts1);
1023 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype,
1024 ppid);
1025 clock_gettime_mono(&ts2);
1026 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1028 if (timediff > audit_timeout) {
1029 smb_time_audit_log("getlock", timediff);
1032 return result;
1035 static int smb_time_audit_symlink(vfs_handle_struct *handle,
1036 const char *oldpath, const char *newpath)
1038 int result;
1039 struct timespec ts1,ts2;
1040 double timediff;
1042 clock_gettime_mono(&ts1);
1043 result = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
1044 clock_gettime_mono(&ts2);
1045 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1047 if (timediff > audit_timeout) {
1048 smb_time_audit_log("symlink", timediff);
1051 return result;
1054 static int smb_time_audit_readlink(vfs_handle_struct *handle,
1055 const char *path, char *buf, size_t bufsiz)
1057 int result;
1058 struct timespec ts1,ts2;
1059 double timediff;
1061 clock_gettime_mono(&ts1);
1062 result = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
1063 clock_gettime_mono(&ts2);
1064 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1066 if (timediff > audit_timeout) {
1067 smb_time_audit_log("readlink", timediff);
1070 return result;
1073 static int smb_time_audit_link(vfs_handle_struct *handle,
1074 const char *oldpath, const char *newpath)
1076 int result;
1077 struct timespec ts1,ts2;
1078 double timediff;
1080 clock_gettime_mono(&ts1);
1081 result = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
1082 clock_gettime_mono(&ts2);
1083 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1085 if (timediff > audit_timeout) {
1086 smb_time_audit_log("link", timediff);
1089 return result;
1092 static int smb_time_audit_mknod(vfs_handle_struct *handle,
1093 const char *pathname, mode_t mode,
1094 SMB_DEV_T dev)
1096 int result;
1097 struct timespec ts1,ts2;
1098 double timediff;
1100 clock_gettime_mono(&ts1);
1101 result = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
1102 clock_gettime_mono(&ts2);
1103 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1105 if (timediff > audit_timeout) {
1106 smb_time_audit_log("mknod", timediff);
1109 return result;
1112 static char *smb_time_audit_realpath(vfs_handle_struct *handle,
1113 const char *path)
1115 char *result;
1116 struct timespec ts1,ts2;
1117 double timediff;
1119 clock_gettime_mono(&ts1);
1120 result = SMB_VFS_NEXT_REALPATH(handle, path);
1121 clock_gettime_mono(&ts2);
1122 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1124 if (timediff > audit_timeout) {
1125 smb_time_audit_log("realpath", timediff);
1128 return result;
1131 static NTSTATUS smb_time_audit_notify_watch(struct vfs_handle_struct *handle,
1132 struct sys_notify_context *ctx,
1133 const char *path,
1134 uint32_t *filter,
1135 uint32_t *subdir_filter,
1136 void (*callback)(struct sys_notify_context *ctx,
1137 void *private_data,
1138 struct notify_event *ev),
1139 void *private_data, void *handle_p)
1141 NTSTATUS result;
1142 struct timespec ts1,ts2;
1143 double timediff;
1145 clock_gettime_mono(&ts1);
1146 result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
1147 filter, subdir_filter, callback,
1148 private_data, handle_p);
1149 clock_gettime_mono(&ts2);
1150 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1152 if (timediff > audit_timeout) {
1153 smb_time_audit_log("notify_watch", timediff);
1156 return result;
1159 static int smb_time_audit_chflags(vfs_handle_struct *handle,
1160 const char *path, unsigned int flags)
1162 int result;
1163 struct timespec ts1,ts2;
1164 double timediff;
1166 clock_gettime_mono(&ts1);
1167 result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
1168 clock_gettime_mono(&ts2);
1169 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1171 if (timediff > audit_timeout) {
1172 smb_time_audit_log("chflags", timediff);
1175 return result;
1178 static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *handle,
1179 const SMB_STRUCT_STAT *sbuf)
1181 struct file_id id_zero;
1182 struct file_id result;
1183 struct timespec ts1,ts2;
1184 double timediff;
1186 ZERO_STRUCT(id_zero);
1188 clock_gettime_mono(&ts1);
1189 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1190 clock_gettime_mono(&ts2);
1191 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1193 if (timediff > audit_timeout) {
1194 smb_time_audit_log("file_id_create", timediff);
1197 return result;
1200 static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
1201 struct files_struct *fsp,
1202 const char *fname,
1203 TALLOC_CTX *mem_ctx,
1204 unsigned int *pnum_streams,
1205 struct stream_struct **pstreams)
1207 NTSTATUS result;
1208 struct timespec ts1,ts2;
1209 double timediff;
1211 clock_gettime_mono(&ts1);
1212 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
1213 pnum_streams, pstreams);
1214 clock_gettime_mono(&ts2);
1215 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1217 if (timediff > audit_timeout) {
1218 smb_time_audit_log("streaminfo", timediff);
1221 return result;
1224 static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
1225 const char *path,
1226 const char *name,
1227 TALLOC_CTX *mem_ctx,
1228 char **found_name)
1230 int result;
1231 struct timespec ts1,ts2;
1232 double timediff;
1234 clock_gettime_mono(&ts1);
1235 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1236 found_name);
1237 clock_gettime_mono(&ts2);
1238 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1240 if (timediff > audit_timeout) {
1241 smb_time_audit_log("get_real_filename", timediff);
1244 return result;
1247 static const char *smb_time_audit_connectpath(vfs_handle_struct *handle,
1248 const char *fname)
1250 const char *result;
1251 struct timespec ts1,ts2;
1252 double timediff;
1254 clock_gettime_mono(&ts1);
1255 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
1256 clock_gettime_mono(&ts2);
1257 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1259 if (timediff > audit_timeout) {
1260 smb_time_audit_log("connectpath", timediff);
1263 return result;
1266 static NTSTATUS smb_time_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1267 struct byte_range_lock *br_lck,
1268 struct lock_struct *plock,
1269 bool blocking_lock,
1270 struct blocking_lock_record *blr)
1272 NTSTATUS result;
1273 struct timespec ts1,ts2;
1274 double timediff;
1276 clock_gettime_mono(&ts1);
1277 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1278 blocking_lock, blr);
1279 clock_gettime_mono(&ts2);
1280 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1282 if (timediff > audit_timeout) {
1283 smb_time_audit_log("brl_lock_windows", timediff);
1286 return result;
1289 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1290 struct messaging_context *msg_ctx,
1291 struct byte_range_lock *br_lck,
1292 const struct lock_struct *plock)
1294 bool result;
1295 struct timespec ts1,ts2;
1296 double timediff;
1298 clock_gettime_mono(&ts1);
1299 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1300 plock);
1301 clock_gettime_mono(&ts2);
1302 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1304 if (timediff > audit_timeout) {
1305 smb_time_audit_log("brl_unlock_windows", timediff);
1308 return result;
1311 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1312 struct byte_range_lock *br_lck,
1313 struct lock_struct *plock,
1314 struct blocking_lock_record *blr)
1316 bool result;
1317 struct timespec ts1,ts2;
1318 double timediff;
1320 clock_gettime_mono(&ts1);
1321 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
1322 clock_gettime_mono(&ts2);
1323 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1325 if (timediff > audit_timeout) {
1326 smb_time_audit_log("brl_cancel_windows", timediff);
1329 return result;
1332 static bool smb_time_audit_strict_lock(struct vfs_handle_struct *handle,
1333 struct files_struct *fsp,
1334 struct lock_struct *plock)
1336 bool result;
1337 struct timespec ts1,ts2;
1338 double timediff;
1340 clock_gettime_mono(&ts1);
1341 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1342 clock_gettime_mono(&ts2);
1343 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1345 if (timediff > audit_timeout) {
1346 smb_time_audit_log("strict_lock", timediff);
1349 return result;
1352 static void smb_time_audit_strict_unlock(struct vfs_handle_struct *handle,
1353 struct files_struct *fsp,
1354 struct lock_struct *plock)
1356 struct timespec ts1,ts2;
1357 double timediff;
1359 clock_gettime_mono(&ts1);
1360 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
1361 clock_gettime_mono(&ts2);
1362 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1364 if (timediff > audit_timeout) {
1365 smb_time_audit_log("strict_unlock", timediff);
1368 return;
1371 static NTSTATUS smb_time_audit_translate_name(struct vfs_handle_struct *handle,
1372 const char *name,
1373 enum vfs_translate_direction direction,
1374 TALLOC_CTX *mem_ctx,
1375 char **mapped_name)
1377 NTSTATUS result;
1378 struct timespec ts1,ts2;
1379 double timediff;
1381 clock_gettime_mono(&ts1);
1382 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1383 mapped_name);
1384 clock_gettime_mono(&ts2);
1385 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1387 if (timediff > audit_timeout) {
1388 smb_time_audit_log("translate_name", timediff);
1391 return result;
1394 static NTSTATUS smb_time_audit_fget_nt_acl(vfs_handle_struct *handle,
1395 files_struct *fsp,
1396 uint32 security_info,
1397 struct security_descriptor **ppdesc)
1399 NTSTATUS result;
1400 struct timespec ts1,ts2;
1401 double timediff;
1403 clock_gettime_mono(&ts1);
1404 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
1405 clock_gettime_mono(&ts2);
1406 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1408 if (timediff > audit_timeout) {
1409 smb_time_audit_log("fget_nt_acl", timediff);
1412 return result;
1415 static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle,
1416 const char *name,
1417 uint32 security_info,
1418 struct security_descriptor **ppdesc)
1420 NTSTATUS result;
1421 struct timespec ts1,ts2;
1422 double timediff;
1424 clock_gettime_mono(&ts1);
1425 result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
1426 clock_gettime_mono(&ts2);
1427 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1429 if (timediff > audit_timeout) {
1430 smb_time_audit_log("get_nt_acl", timediff);
1433 return result;
1436 static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
1437 files_struct *fsp,
1438 uint32 security_info_sent,
1439 const struct security_descriptor *psd)
1441 NTSTATUS result;
1442 struct timespec ts1,ts2;
1443 double timediff;
1445 clock_gettime_mono(&ts1);
1446 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent,
1447 psd);
1448 clock_gettime_mono(&ts2);
1449 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1451 if (timediff > audit_timeout) {
1452 smb_time_audit_log("fset_nt_acl", timediff);
1455 return result;
1458 static int smb_time_audit_chmod_acl(vfs_handle_struct *handle,
1459 const char *path, mode_t mode)
1461 int result;
1462 struct timespec ts1,ts2;
1463 double timediff;
1465 clock_gettime_mono(&ts1);
1466 result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
1467 clock_gettime_mono(&ts2);
1468 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1470 if (timediff > audit_timeout) {
1471 smb_time_audit_log("chmod_acl", timediff);
1474 return result;
1477 static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
1478 files_struct *fsp, mode_t mode)
1480 int result;
1481 struct timespec ts1,ts2;
1482 double timediff;
1484 clock_gettime_mono(&ts1);
1485 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
1486 clock_gettime_mono(&ts2);
1487 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1489 if (timediff > audit_timeout) {
1490 smb_time_audit_log("fchmod_acl", timediff);
1493 return result;
1496 static int smb_time_audit_sys_acl_get_entry(vfs_handle_struct *handle,
1497 SMB_ACL_T theacl, int entry_id,
1498 SMB_ACL_ENTRY_T *entry_p)
1500 int result;
1501 struct timespec ts1,ts2;
1502 double timediff;
1504 clock_gettime_mono(&ts1);
1505 result = SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id,
1506 entry_p);
1507 clock_gettime_mono(&ts2);
1508 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1510 if (timediff > audit_timeout) {
1511 smb_time_audit_log("sys_acl_get_entry", timediff);
1514 return result;
1517 static int smb_time_audit_sys_acl_get_tag_type(vfs_handle_struct *handle,
1518 SMB_ACL_ENTRY_T entry_d,
1519 SMB_ACL_TAG_T *tag_type_p)
1521 int result;
1522 struct timespec ts1,ts2;
1523 double timediff;
1525 clock_gettime_mono(&ts1);
1526 result = SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d,
1527 tag_type_p);
1528 clock_gettime_mono(&ts2);
1529 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1531 if (timediff > audit_timeout) {
1532 smb_time_audit_log("sys_acl_get_tag_type", timediff);
1535 return result;
1538 static int smb_time_audit_sys_acl_get_permset(vfs_handle_struct *handle,
1539 SMB_ACL_ENTRY_T entry_d,
1540 SMB_ACL_PERMSET_T *permset_p)
1542 int result;
1543 struct timespec ts1,ts2;
1544 double timediff;
1546 clock_gettime_mono(&ts1);
1547 result = SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d,
1548 permset_p);
1549 clock_gettime_mono(&ts2);
1550 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1552 if (timediff > audit_timeout) {
1553 smb_time_audit_log("sys_acl_get_permset", timediff);
1556 return result;
1559 static void * smb_time_audit_sys_acl_get_qualifier(vfs_handle_struct *handle,
1560 SMB_ACL_ENTRY_T entry_d)
1562 void *result;
1563 struct timespec ts1,ts2;
1564 double timediff;
1566 clock_gettime_mono(&ts1);
1567 result = SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
1568 clock_gettime_mono(&ts2);
1569 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1571 if (timediff > audit_timeout) {
1572 smb_time_audit_log("sys_acl_get_qualifier", timediff);
1575 return result;
1578 static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
1579 const char *path_p,
1580 SMB_ACL_TYPE_T type)
1582 SMB_ACL_T result;
1583 struct timespec ts1,ts2;
1584 double timediff;
1586 clock_gettime_mono(&ts1);
1587 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
1588 clock_gettime_mono(&ts2);
1589 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1591 if (timediff > audit_timeout) {
1592 smb_time_audit_log("sys_acl_get_file", timediff);
1595 return result;
1598 static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
1599 files_struct *fsp)
1601 SMB_ACL_T result;
1602 struct timespec ts1,ts2;
1603 double timediff;
1605 clock_gettime_mono(&ts1);
1606 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
1607 clock_gettime_mono(&ts2);
1608 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1610 if (timediff > audit_timeout) {
1611 smb_time_audit_log("sys_acl_get_fd", timediff);
1614 return result;
1617 static int smb_time_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
1618 SMB_ACL_PERMSET_T permset)
1620 int result;
1621 struct timespec ts1,ts2;
1622 double timediff;
1624 clock_gettime_mono(&ts1);
1625 result = SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
1626 clock_gettime_mono(&ts2);
1627 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1629 if (timediff > audit_timeout) {
1630 smb_time_audit_log("sys_acl_clear_perms", timediff);
1633 return result;
1636 static int smb_time_audit_sys_acl_add_perm(vfs_handle_struct *handle,
1637 SMB_ACL_PERMSET_T permset,
1638 SMB_ACL_PERM_T perm)
1640 int result;
1641 struct timespec ts1,ts2;
1642 double timediff;
1644 clock_gettime_mono(&ts1);
1645 result = SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
1646 clock_gettime_mono(&ts2);
1647 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1649 if (timediff > audit_timeout) {
1650 smb_time_audit_log("sys_acl_add_perm", timediff);
1653 return result;
1656 static char * smb_time_audit_sys_acl_to_text(vfs_handle_struct *handle,
1657 SMB_ACL_T theacl,
1658 ssize_t *plen)
1660 char * result;
1661 struct timespec ts1,ts2;
1662 double timediff;
1664 clock_gettime_mono(&ts1);
1665 result = SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
1666 clock_gettime_mono(&ts2);
1667 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1669 if (timediff > audit_timeout) {
1670 smb_time_audit_log("sys_acl_to_text", timediff);
1673 return result;
1676 static SMB_ACL_T smb_time_audit_sys_acl_init(vfs_handle_struct *handle,
1677 int count)
1679 SMB_ACL_T result;
1680 struct timespec ts1,ts2;
1681 double timediff;
1683 clock_gettime_mono(&ts1);
1684 result = SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
1685 clock_gettime_mono(&ts2);
1686 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1688 if (timediff > audit_timeout) {
1689 smb_time_audit_log("sys_acl_init", timediff);
1692 return result;
1695 static int smb_time_audit_sys_acl_create_entry(vfs_handle_struct *handle,
1696 SMB_ACL_T *pacl,
1697 SMB_ACL_ENTRY_T *pentry)
1699 int result;
1700 struct timespec ts1,ts2;
1701 double timediff;
1703 clock_gettime_mono(&ts1);
1704 result = SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
1705 clock_gettime_mono(&ts2);
1706 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1708 if (timediff > audit_timeout) {
1709 smb_time_audit_log("sys_acl_create_entry", timediff);
1712 return result;
1715 static int smb_time_audit_sys_acl_set_tag_type(vfs_handle_struct *handle,
1716 SMB_ACL_ENTRY_T entry,
1717 SMB_ACL_TAG_T tagtype)
1719 int result;
1720 struct timespec ts1,ts2;
1721 double timediff;
1723 clock_gettime_mono(&ts1);
1724 result = SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry,
1725 tagtype);
1726 clock_gettime_mono(&ts2);
1727 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1729 if (timediff > audit_timeout) {
1730 smb_time_audit_log("sys_acl_set_tag_type", timediff);
1733 return result;
1736 static int smb_time_audit_sys_acl_set_qualifier(vfs_handle_struct *handle,
1737 SMB_ACL_ENTRY_T entry,
1738 void *qual)
1740 int result;
1741 struct timespec ts1,ts2;
1742 double timediff;
1744 clock_gettime_mono(&ts1);
1745 result = SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
1746 clock_gettime_mono(&ts2);
1747 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1749 if (timediff > audit_timeout) {
1750 smb_time_audit_log("sys_acl_set_qualifier", timediff);
1753 return result;
1756 static int smb_time_audit_sys_acl_set_permset(vfs_handle_struct *handle,
1757 SMB_ACL_ENTRY_T entry,
1758 SMB_ACL_PERMSET_T permset)
1760 int result;
1761 struct timespec ts1,ts2;
1762 double timediff;
1764 clock_gettime_mono(&ts1);
1765 result = SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
1766 clock_gettime_mono(&ts2);
1767 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1769 if (timediff > audit_timeout) {
1770 smb_time_audit_log("sys_acl_set_permset", timediff);
1773 return result;
1776 static int smb_time_audit_sys_acl_valid(vfs_handle_struct *handle,
1777 SMB_ACL_T theacl)
1779 int result;
1780 struct timespec ts1,ts2;
1781 double timediff;
1783 clock_gettime_mono(&ts1);
1784 result = SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
1785 clock_gettime_mono(&ts2);
1786 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1788 if (timediff > audit_timeout) {
1789 smb_time_audit_log("sys_acl_valid", timediff);
1792 return result;
1795 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
1796 const char *name,
1797 SMB_ACL_TYPE_T acltype,
1798 SMB_ACL_T theacl)
1800 int result;
1801 struct timespec ts1,ts2;
1802 double timediff;
1804 clock_gettime_mono(&ts1);
1805 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
1806 theacl);
1807 clock_gettime_mono(&ts2);
1808 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1810 if (timediff > audit_timeout) {
1811 smb_time_audit_log("sys_acl_set_file", timediff);
1814 return result;
1817 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
1818 files_struct *fsp,
1819 SMB_ACL_T theacl)
1821 int result;
1822 struct timespec ts1,ts2;
1823 double timediff;
1825 clock_gettime_mono(&ts1);
1826 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
1827 clock_gettime_mono(&ts2);
1828 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1830 if (timediff > audit_timeout) {
1831 smb_time_audit_log("sys_acl_set_fd", timediff);
1834 return result;
1837 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
1838 const char *path)
1840 int result;
1841 struct timespec ts1,ts2;
1842 double timediff;
1844 clock_gettime_mono(&ts1);
1845 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
1846 clock_gettime_mono(&ts2);
1847 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1849 if (timediff > audit_timeout) {
1850 smb_time_audit_log("sys_acl_delete_def_file", timediff);
1853 return result;
1856 static int smb_time_audit_sys_acl_get_perm(vfs_handle_struct *handle,
1857 SMB_ACL_PERMSET_T permset,
1858 SMB_ACL_PERM_T perm)
1860 int result;
1861 struct timespec ts1,ts2;
1862 double timediff;
1864 clock_gettime_mono(&ts1);
1865 result = SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
1866 clock_gettime_mono(&ts2);
1867 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1869 if (timediff > audit_timeout) {
1870 smb_time_audit_log("sys_acl_get_perm", timediff);
1873 return result;
1876 static int smb_time_audit_sys_acl_free_text(vfs_handle_struct *handle,
1877 char *text)
1879 int result;
1880 struct timespec ts1,ts2;
1881 double timediff;
1883 clock_gettime_mono(&ts1);
1884 result = SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
1885 clock_gettime_mono(&ts2);
1886 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1888 if (timediff > audit_timeout) {
1889 smb_time_audit_log("sys_acl_free_text", timediff);
1892 return result;
1895 static int smb_time_audit_sys_acl_free_acl(vfs_handle_struct *handle,
1896 SMB_ACL_T posix_acl)
1898 int result;
1899 struct timespec ts1,ts2;
1900 double timediff;
1902 clock_gettime_mono(&ts1);
1903 result = SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
1904 clock_gettime_mono(&ts2);
1905 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1907 if (timediff > audit_timeout) {
1908 smb_time_audit_log("sys_acl_free_acl", timediff);
1911 return result;
1914 static int smb_time_audit_sys_acl_free_qualifier(vfs_handle_struct *handle,
1915 void *qualifier,
1916 SMB_ACL_TAG_T tagtype)
1918 int result;
1919 struct timespec ts1,ts2;
1920 double timediff;
1922 clock_gettime_mono(&ts1);
1923 result = SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier,
1924 tagtype);
1925 clock_gettime_mono(&ts2);
1926 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1928 if (timediff > audit_timeout) {
1929 smb_time_audit_log("sys_acl_free_qualifier", timediff);
1932 return result;
1935 static ssize_t smb_time_audit_getxattr(struct vfs_handle_struct *handle,
1936 const char *path, const char *name,
1937 void *value, size_t size)
1939 ssize_t result;
1940 struct timespec ts1,ts2;
1941 double timediff;
1943 clock_gettime_mono(&ts1);
1944 result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
1945 clock_gettime_mono(&ts2);
1946 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1948 if (timediff > audit_timeout) {
1949 smb_time_audit_log("getxattr", timediff);
1952 return result;
1955 static ssize_t smb_time_audit_fgetxattr(struct vfs_handle_struct *handle,
1956 struct files_struct *fsp,
1957 const char *name, void *value,
1958 size_t size)
1960 ssize_t result;
1961 struct timespec ts1,ts2;
1962 double timediff;
1964 clock_gettime_mono(&ts1);
1965 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1966 clock_gettime_mono(&ts2);
1967 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1969 if (timediff > audit_timeout) {
1970 smb_time_audit_log("fgetxattr", timediff);
1973 return result;
1976 static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
1977 const char *path, char *list,
1978 size_t size)
1980 ssize_t result;
1981 struct timespec ts1,ts2;
1982 double timediff;
1984 clock_gettime_mono(&ts1);
1985 result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
1986 clock_gettime_mono(&ts2);
1987 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1989 if (timediff > audit_timeout) {
1990 smb_time_audit_log("listxattr", timediff);
1993 return result;
1996 static ssize_t smb_time_audit_flistxattr(struct vfs_handle_struct *handle,
1997 struct files_struct *fsp, char *list,
1998 size_t size)
2000 ssize_t result;
2001 struct timespec ts1,ts2;
2002 double timediff;
2004 clock_gettime_mono(&ts1);
2005 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2006 clock_gettime_mono(&ts2);
2007 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2009 if (timediff > audit_timeout) {
2010 smb_time_audit_log("flistxattr", timediff);
2013 return result;
2016 static int smb_time_audit_removexattr(struct vfs_handle_struct *handle,
2017 const char *path, const char *name)
2019 int result;
2020 struct timespec ts1,ts2;
2021 double timediff;
2023 clock_gettime_mono(&ts1);
2024 result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
2025 clock_gettime_mono(&ts2);
2026 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2028 if (timediff > audit_timeout) {
2029 smb_time_audit_log("removexattr", timediff);
2032 return result;
2035 static int smb_time_audit_fremovexattr(struct vfs_handle_struct *handle,
2036 struct files_struct *fsp,
2037 const char *name)
2039 int result;
2040 struct timespec ts1,ts2;
2041 double timediff;
2043 clock_gettime_mono(&ts1);
2044 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2045 clock_gettime_mono(&ts2);
2046 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2048 if (timediff > audit_timeout) {
2049 smb_time_audit_log("fremovexattr", timediff);
2052 return result;
2055 static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
2056 const char *path, const char *name,
2057 const void *value, size_t size,
2058 int flags)
2060 int result;
2061 struct timespec ts1,ts2;
2062 double timediff;
2064 clock_gettime_mono(&ts1);
2065 result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
2066 flags);
2067 clock_gettime_mono(&ts2);
2068 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2070 if (timediff > audit_timeout) {
2071 smb_time_audit_log("setxattr", timediff);
2074 return result;
2077 static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle,
2078 struct files_struct *fsp, const char *name,
2079 const void *value, size_t size, int flags)
2081 int result;
2082 struct timespec ts1,ts2;
2083 double timediff;
2085 clock_gettime_mono(&ts1);
2086 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2087 clock_gettime_mono(&ts2);
2088 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2090 if (timediff > audit_timeout) {
2091 smb_time_audit_log("fsetxattr", timediff);
2094 return result;
2097 static int smb_time_audit_aio_read(struct vfs_handle_struct *handle,
2098 struct files_struct *fsp,
2099 SMB_STRUCT_AIOCB *aiocb)
2101 int result;
2102 struct timespec ts1,ts2;
2103 double timediff;
2105 clock_gettime_mono(&ts1);
2106 result = SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
2107 clock_gettime_mono(&ts2);
2108 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2110 if (timediff > audit_timeout) {
2111 smb_time_audit_log("aio_read", timediff);
2114 return result;
2117 static int smb_time_audit_aio_write(struct vfs_handle_struct *handle,
2118 struct files_struct *fsp,
2119 SMB_STRUCT_AIOCB *aiocb)
2121 int result;
2122 struct timespec ts1,ts2;
2123 double timediff;
2125 clock_gettime_mono(&ts1);
2126 result = SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
2127 clock_gettime_mono(&ts2);
2128 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2130 if (timediff > audit_timeout) {
2131 smb_time_audit_log("aio_write", timediff);
2134 return result;
2137 static ssize_t smb_time_audit_aio_return(struct vfs_handle_struct *handle,
2138 struct files_struct *fsp,
2139 SMB_STRUCT_AIOCB *aiocb)
2141 ssize_t result;
2142 struct timespec ts1,ts2;
2143 double timediff;
2145 clock_gettime_mono(&ts1);
2146 result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
2147 clock_gettime_mono(&ts2);
2148 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2150 if (timediff > audit_timeout) {
2151 smb_time_audit_log("aio_return", timediff);
2154 return result;
2157 static int smb_time_audit_aio_cancel(struct vfs_handle_struct *handle,
2158 struct files_struct *fsp,
2159 SMB_STRUCT_AIOCB *aiocb)
2161 int result;
2162 struct timespec ts1,ts2;
2163 double timediff;
2165 clock_gettime_mono(&ts1);
2166 result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
2167 clock_gettime_mono(&ts2);
2168 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2170 if (timediff > audit_timeout) {
2171 smb_time_audit_log("aio_cancel", timediff);
2174 return result;
2177 static int smb_time_audit_aio_error(struct vfs_handle_struct *handle,
2178 struct files_struct *fsp,
2179 SMB_STRUCT_AIOCB *aiocb)
2181 int result;
2182 struct timespec ts1,ts2;
2183 double timediff;
2185 clock_gettime_mono(&ts1);
2186 result = SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
2187 clock_gettime_mono(&ts2);
2188 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2190 if (timediff > audit_timeout) {
2191 smb_time_audit_log("aio_error", timediff);
2194 return result;
2197 static int smb_time_audit_aio_fsync(struct vfs_handle_struct *handle,
2198 struct files_struct *fsp, int op,
2199 SMB_STRUCT_AIOCB *aiocb)
2201 int result;
2202 struct timespec ts1,ts2;
2203 double timediff;
2205 clock_gettime_mono(&ts1);
2206 result = SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
2207 clock_gettime_mono(&ts2);
2208 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2210 if (timediff > audit_timeout) {
2211 smb_time_audit_log("aio_fsync", timediff);
2214 return result;
2217 static int smb_time_audit_aio_suspend(struct vfs_handle_struct *handle,
2218 struct files_struct *fsp,
2219 const SMB_STRUCT_AIOCB * const aiocb[],
2220 int n, const struct timespec *ts)
2222 int result;
2223 struct timespec ts1,ts2;
2224 double timediff;
2226 clock_gettime_mono(&ts1);
2227 result = SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
2228 clock_gettime_mono(&ts2);
2229 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2231 if (timediff > audit_timeout) {
2232 smb_time_audit_log("aio_suspend", timediff);
2235 return result;
2238 static bool smb_time_audit_aio_force(struct vfs_handle_struct *handle,
2239 struct files_struct *fsp)
2241 bool result;
2242 struct timespec ts1,ts2;
2243 double timediff;
2245 clock_gettime_mono(&ts1);
2246 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2247 clock_gettime_mono(&ts2);
2248 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2250 if (timediff > audit_timeout) {
2251 smb_time_audit_log("aio_force", timediff);
2254 return result;
2259 /* VFS operations */
2261 static struct vfs_fn_pointers vfs_time_audit_fns = {
2262 .connect_fn = smb_time_audit_connect,
2263 .disconnect_fn = smb_time_audit_disconnect,
2264 .disk_free_fn = smb_time_audit_disk_free,
2265 .get_quota_fn = smb_time_audit_get_quota,
2266 .set_quota_fn = smb_time_audit_set_quota,
2267 .get_shadow_copy_data_fn = smb_time_audit_get_shadow_copy_data,
2268 .statvfs_fn = smb_time_audit_statvfs,
2269 .fs_capabilities_fn = smb_time_audit_fs_capabilities,
2270 .opendir_fn = smb_time_audit_opendir,
2271 .fdopendir_fn = smb_time_audit_fdopendir,
2272 .readdir_fn = smb_time_audit_readdir,
2273 .seekdir_fn = smb_time_audit_seekdir,
2274 .telldir_fn = smb_time_audit_telldir,
2275 .rewind_dir_fn = smb_time_audit_rewinddir,
2276 .mkdir_fn = smb_time_audit_mkdir,
2277 .rmdir_fn = smb_time_audit_rmdir,
2278 .closedir_fn = smb_time_audit_closedir,
2279 .init_search_op_fn = smb_time_audit_init_search_op,
2280 .open_fn = smb_time_audit_open,
2281 .create_file_fn = smb_time_audit_create_file,
2282 .close_fn = smb_time_audit_close,
2283 .read_fn = smb_time_audit_read,
2284 .pread_fn = smb_time_audit_pread,
2285 .write_fn = smb_time_audit_write,
2286 .pwrite_fn = smb_time_audit_pwrite,
2287 .lseek_fn = smb_time_audit_lseek,
2288 .sendfile_fn = smb_time_audit_sendfile,
2289 .recvfile_fn = smb_time_audit_recvfile,
2290 .rename_fn = smb_time_audit_rename,
2291 .fsync_fn = smb_time_audit_fsync,
2292 .stat_fn = smb_time_audit_stat,
2293 .fstat_fn = smb_time_audit_fstat,
2294 .lstat_fn = smb_time_audit_lstat,
2295 .get_alloc_size_fn = smb_time_audit_get_alloc_size,
2296 .unlink_fn = smb_time_audit_unlink,
2297 .chmod_fn = smb_time_audit_chmod,
2298 .fchmod_fn = smb_time_audit_fchmod,
2299 .chown_fn = smb_time_audit_chown,
2300 .fchown_fn = smb_time_audit_fchown,
2301 .lchown_fn = smb_time_audit_lchown,
2302 .chdir_fn = smb_time_audit_chdir,
2303 .getwd_fn = smb_time_audit_getwd,
2304 .ntimes_fn = smb_time_audit_ntimes,
2305 .ftruncate_fn = smb_time_audit_ftruncate,
2306 .fallocate_fn = smb_time_audit_fallocate,
2307 .lock_fn = smb_time_audit_lock,
2308 .kernel_flock_fn = smb_time_audit_kernel_flock,
2309 .linux_setlease_fn = smb_time_audit_linux_setlease,
2310 .getlock_fn = smb_time_audit_getlock,
2311 .symlink_fn = smb_time_audit_symlink,
2312 .readlink_fn = smb_time_audit_readlink,
2313 .link_fn = smb_time_audit_link,
2314 .mknod_fn = smb_time_audit_mknod,
2315 .realpath_fn = smb_time_audit_realpath,
2316 .notify_watch_fn = smb_time_audit_notify_watch,
2317 .chflags_fn = smb_time_audit_chflags,
2318 .file_id_create_fn = smb_time_audit_file_id_create,
2319 .streaminfo_fn = smb_time_audit_streaminfo,
2320 .get_real_filename_fn = smb_time_audit_get_real_filename,
2321 .connectpath_fn = smb_time_audit_connectpath,
2322 .brl_lock_windows_fn = smb_time_audit_brl_lock_windows,
2323 .brl_unlock_windows_fn = smb_time_audit_brl_unlock_windows,
2324 .brl_cancel_windows_fn = smb_time_audit_brl_cancel_windows,
2325 .strict_lock_fn = smb_time_audit_strict_lock,
2326 .strict_unlock_fn = smb_time_audit_strict_unlock,
2327 .translate_name_fn = smb_time_audit_translate_name,
2328 .fget_nt_acl_fn = smb_time_audit_fget_nt_acl,
2329 .get_nt_acl_fn = smb_time_audit_get_nt_acl,
2330 .fset_nt_acl_fn = smb_time_audit_fset_nt_acl,
2331 .chmod_acl_fn = smb_time_audit_chmod_acl,
2332 .fchmod_acl_fn = smb_time_audit_fchmod_acl,
2333 .sys_acl_get_entry_fn = smb_time_audit_sys_acl_get_entry,
2334 .sys_acl_get_tag_type_fn = smb_time_audit_sys_acl_get_tag_type,
2335 .sys_acl_get_permset_fn = smb_time_audit_sys_acl_get_permset,
2336 .sys_acl_get_qualifier_fn = smb_time_audit_sys_acl_get_qualifier,
2337 .sys_acl_get_file_fn = smb_time_audit_sys_acl_get_file,
2338 .sys_acl_get_fd_fn = smb_time_audit_sys_acl_get_fd,
2339 .sys_acl_clear_perms_fn = smb_time_audit_sys_acl_clear_perms,
2340 .sys_acl_add_perm_fn = smb_time_audit_sys_acl_add_perm,
2341 .sys_acl_to_text_fn = smb_time_audit_sys_acl_to_text,
2342 .sys_acl_init_fn = smb_time_audit_sys_acl_init,
2343 .sys_acl_create_entry_fn = smb_time_audit_sys_acl_create_entry,
2344 .sys_acl_set_tag_type_fn = smb_time_audit_sys_acl_set_tag_type,
2345 .sys_acl_set_qualifier_fn = smb_time_audit_sys_acl_set_qualifier,
2346 .sys_acl_set_permset_fn = smb_time_audit_sys_acl_set_permset,
2347 .sys_acl_valid_fn = smb_time_audit_sys_acl_valid,
2348 .sys_acl_set_file_fn = smb_time_audit_sys_acl_set_file,
2349 .sys_acl_set_fd_fn = smb_time_audit_sys_acl_set_fd,
2350 .sys_acl_delete_def_file_fn = smb_time_audit_sys_acl_delete_def_file,
2351 .sys_acl_get_perm_fn = smb_time_audit_sys_acl_get_perm,
2352 .sys_acl_free_text_fn = smb_time_audit_sys_acl_free_text,
2353 .sys_acl_free_acl_fn = smb_time_audit_sys_acl_free_acl,
2354 .sys_acl_free_qualifier_fn = smb_time_audit_sys_acl_free_qualifier,
2355 .getxattr_fn = smb_time_audit_getxattr,
2356 .fgetxattr_fn = smb_time_audit_fgetxattr,
2357 .listxattr_fn = smb_time_audit_listxattr,
2358 .flistxattr_fn = smb_time_audit_flistxattr,
2359 .removexattr_fn = smb_time_audit_removexattr,
2360 .fremovexattr_fn = smb_time_audit_fremovexattr,
2361 .setxattr_fn = smb_time_audit_setxattr,
2362 .fsetxattr_fn = smb_time_audit_fsetxattr,
2363 .aio_read_fn = smb_time_audit_aio_read,
2364 .aio_write_fn = smb_time_audit_aio_write,
2365 .aio_return_fn = smb_time_audit_aio_return,
2366 .aio_cancel_fn = smb_time_audit_aio_cancel,
2367 .aio_error_fn = smb_time_audit_aio_error,
2368 .aio_fsync_fn = smb_time_audit_aio_fsync,
2369 .aio_suspend_fn = smb_time_audit_aio_suspend,
2370 .aio_force_fn = smb_time_audit_aio_force,
2374 NTSTATUS vfs_time_audit_init(void);
2375 NTSTATUS vfs_time_audit_init(void)
2377 audit_timeout = (double)lp_parm_int(-1, "time_audit", "timeout",
2378 10000) / 1000.0;
2379 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "time_audit",
2380 &vfs_time_audit_fns);