VERSION: Bump version up to 3.6.0rc1.
[Samba.git] / source3 / modules / vfs_time_audit.c
blob37fe1c6e35b635da1acf9119f9acf0902c34f1b2
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 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 SMB_STRUCT_DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
207 const char *fname,
208 const char *mask, uint32 attr)
210 SMB_STRUCT_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 SMB_STRUCT_DIR *smb_time_audit_fdopendir(vfs_handle_struct *handle,
227 files_struct *fsp,
228 const char *mask, uint32 attr)
230 SMB_STRUCT_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 SMB_STRUCT_DIRENT *smb_time_audit_readdir(vfs_handle_struct *handle,
247 SMB_STRUCT_DIR *dirp,
248 SMB_STRUCT_STAT *sbuf)
250 SMB_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 SMB_STRUCT_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 SMB_STRUCT_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 SMB_STRUCT_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 SMB_STRUCT_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 SMB_STRUCT_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, SMB_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 SMB_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 SMB_OFF_T smb_time_audit_lseek(vfs_handle_struct *handle,
564 files_struct *fsp,
565 SMB_OFF_T offset, int whence)
567 ssize_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, SMB_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 SMB_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 int 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, char *path)
874 char *result;
875 struct timespec ts1,ts2;
876 double timediff;
878 clock_gettime_mono(&ts1);
879 result = SMB_VFS_NEXT_GETWD(handle, path);
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 SMB_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 SMB_OFF_T offset,
934 SMB_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, SMB_OFF_T offset, SMB_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 SMB_OFF_T *poffset, SMB_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 struct notify_entry *e,
1134 void (*callback)(struct sys_notify_context *ctx,
1135 void *private_data,
1136 struct notify_event *ev),
1137 void *private_data, void *handle_p)
1139 NTSTATUS result;
1140 struct timespec ts1,ts2;
1141 double timediff;
1143 clock_gettime_mono(&ts1);
1144 result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback,
1145 private_data, handle_p);
1146 clock_gettime_mono(&ts2);
1147 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1149 if (timediff > audit_timeout) {
1150 smb_time_audit_log("notify_watch", timediff);
1153 return result;
1156 static int smb_time_audit_chflags(vfs_handle_struct *handle,
1157 const char *path, unsigned int flags)
1159 int result;
1160 struct timespec ts1,ts2;
1161 double timediff;
1163 clock_gettime_mono(&ts1);
1164 result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
1165 clock_gettime_mono(&ts2);
1166 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1168 if (timediff > audit_timeout) {
1169 smb_time_audit_log("chflags", timediff);
1172 return result;
1175 static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *handle,
1176 const SMB_STRUCT_STAT *sbuf)
1178 struct file_id id_zero;
1179 struct file_id result;
1180 struct timespec ts1,ts2;
1181 double timediff;
1183 ZERO_STRUCT(id_zero);
1185 clock_gettime_mono(&ts1);
1186 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1187 clock_gettime_mono(&ts2);
1188 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1190 if (timediff > audit_timeout) {
1191 smb_time_audit_log("file_id_create", timediff);
1194 return result;
1197 static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
1198 struct files_struct *fsp,
1199 const char *fname,
1200 TALLOC_CTX *mem_ctx,
1201 unsigned int *pnum_streams,
1202 struct stream_struct **pstreams)
1204 NTSTATUS result;
1205 struct timespec ts1,ts2;
1206 double timediff;
1208 clock_gettime_mono(&ts1);
1209 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
1210 pnum_streams, pstreams);
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("streaminfo", timediff);
1218 return result;
1221 static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
1222 const char *path,
1223 const char *name,
1224 TALLOC_CTX *mem_ctx,
1225 char **found_name)
1227 int result;
1228 struct timespec ts1,ts2;
1229 double timediff;
1231 clock_gettime_mono(&ts1);
1232 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1233 found_name);
1234 clock_gettime_mono(&ts2);
1235 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1237 if (timediff > audit_timeout) {
1238 smb_time_audit_log("get_real_filename", timediff);
1241 return result;
1244 static const char *smb_time_audit_connectpath(vfs_handle_struct *handle,
1245 const char *fname)
1247 const char *result;
1248 struct timespec ts1,ts2;
1249 double timediff;
1251 clock_gettime_mono(&ts1);
1252 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
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("connectpath", timediff);
1260 return result;
1263 static NTSTATUS smb_time_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1264 struct byte_range_lock *br_lck,
1265 struct lock_struct *plock,
1266 bool blocking_lock,
1267 struct blocking_lock_record *blr)
1269 NTSTATUS result;
1270 struct timespec ts1,ts2;
1271 double timediff;
1273 clock_gettime_mono(&ts1);
1274 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1275 blocking_lock, blr);
1276 clock_gettime_mono(&ts2);
1277 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1279 if (timediff > audit_timeout) {
1280 smb_time_audit_log("brl_lock_windows", timediff);
1283 return result;
1286 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1287 struct messaging_context *msg_ctx,
1288 struct byte_range_lock *br_lck,
1289 const struct lock_struct *plock)
1291 bool result;
1292 struct timespec ts1,ts2;
1293 double timediff;
1295 clock_gettime_mono(&ts1);
1296 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1297 plock);
1298 clock_gettime_mono(&ts2);
1299 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1301 if (timediff > audit_timeout) {
1302 smb_time_audit_log("brl_unlock_windows", timediff);
1305 return result;
1308 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1309 struct byte_range_lock *br_lck,
1310 struct lock_struct *plock,
1311 struct blocking_lock_record *blr)
1313 bool result;
1314 struct timespec ts1,ts2;
1315 double timediff;
1317 clock_gettime_mono(&ts1);
1318 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
1319 clock_gettime_mono(&ts2);
1320 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1322 if (timediff > audit_timeout) {
1323 smb_time_audit_log("brl_cancel_windows", timediff);
1326 return result;
1329 static bool smb_time_audit_strict_lock(struct vfs_handle_struct *handle,
1330 struct files_struct *fsp,
1331 struct lock_struct *plock)
1333 bool result;
1334 struct timespec ts1,ts2;
1335 double timediff;
1337 clock_gettime_mono(&ts1);
1338 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1339 clock_gettime_mono(&ts2);
1340 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1342 if (timediff > audit_timeout) {
1343 smb_time_audit_log("strict_lock", timediff);
1346 return result;
1349 static void smb_time_audit_strict_unlock(struct vfs_handle_struct *handle,
1350 struct files_struct *fsp,
1351 struct lock_struct *plock)
1353 struct timespec ts1,ts2;
1354 double timediff;
1356 clock_gettime_mono(&ts1);
1357 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
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("strict_unlock", timediff);
1365 return;
1368 static NTSTATUS smb_time_audit_translate_name(struct vfs_handle_struct *handle,
1369 const char *name,
1370 enum vfs_translate_direction direction,
1371 TALLOC_CTX *mem_ctx,
1372 char **mapped_name)
1374 NTSTATUS result;
1375 struct timespec ts1,ts2;
1376 double timediff;
1378 clock_gettime_mono(&ts1);
1379 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1380 mapped_name);
1381 clock_gettime_mono(&ts2);
1382 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1384 if (timediff > audit_timeout) {
1385 smb_time_audit_log("translate_name", timediff);
1388 return result;
1391 static NTSTATUS smb_time_audit_fget_nt_acl(vfs_handle_struct *handle,
1392 files_struct *fsp,
1393 uint32 security_info,
1394 struct security_descriptor **ppdesc)
1396 NTSTATUS result;
1397 struct timespec ts1,ts2;
1398 double timediff;
1400 clock_gettime_mono(&ts1);
1401 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
1402 clock_gettime_mono(&ts2);
1403 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1405 if (timediff > audit_timeout) {
1406 smb_time_audit_log("fget_nt_acl", timediff);
1409 return result;
1412 static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle,
1413 const char *name,
1414 uint32 security_info,
1415 struct security_descriptor **ppdesc)
1417 NTSTATUS result;
1418 struct timespec ts1,ts2;
1419 double timediff;
1421 clock_gettime_mono(&ts1);
1422 result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
1423 clock_gettime_mono(&ts2);
1424 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1426 if (timediff > audit_timeout) {
1427 smb_time_audit_log("get_nt_acl", timediff);
1430 return result;
1433 static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
1434 files_struct *fsp,
1435 uint32 security_info_sent,
1436 const struct security_descriptor *psd)
1438 NTSTATUS result;
1439 struct timespec ts1,ts2;
1440 double timediff;
1442 clock_gettime_mono(&ts1);
1443 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent,
1444 psd);
1445 clock_gettime_mono(&ts2);
1446 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1448 if (timediff > audit_timeout) {
1449 smb_time_audit_log("fset_nt_acl", timediff);
1452 return result;
1455 static int smb_time_audit_chmod_acl(vfs_handle_struct *handle,
1456 const char *path, mode_t mode)
1458 int result;
1459 struct timespec ts1,ts2;
1460 double timediff;
1462 clock_gettime_mono(&ts1);
1463 result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
1464 clock_gettime_mono(&ts2);
1465 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1467 if (timediff > audit_timeout) {
1468 smb_time_audit_log("chmod_acl", timediff);
1471 return result;
1474 static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
1475 files_struct *fsp, mode_t mode)
1477 int result;
1478 struct timespec ts1,ts2;
1479 double timediff;
1481 clock_gettime_mono(&ts1);
1482 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
1483 clock_gettime_mono(&ts2);
1484 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1486 if (timediff > audit_timeout) {
1487 smb_time_audit_log("fchmod_acl", timediff);
1490 return result;
1493 static int smb_time_audit_sys_acl_get_entry(vfs_handle_struct *handle,
1494 SMB_ACL_T theacl, int entry_id,
1495 SMB_ACL_ENTRY_T *entry_p)
1497 int result;
1498 struct timespec ts1,ts2;
1499 double timediff;
1501 clock_gettime_mono(&ts1);
1502 result = SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id,
1503 entry_p);
1504 clock_gettime_mono(&ts2);
1505 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1507 if (timediff > audit_timeout) {
1508 smb_time_audit_log("sys_acl_get_entry", timediff);
1511 return result;
1514 static int smb_time_audit_sys_acl_get_tag_type(vfs_handle_struct *handle,
1515 SMB_ACL_ENTRY_T entry_d,
1516 SMB_ACL_TAG_T *tag_type_p)
1518 int result;
1519 struct timespec ts1,ts2;
1520 double timediff;
1522 clock_gettime_mono(&ts1);
1523 result = SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d,
1524 tag_type_p);
1525 clock_gettime_mono(&ts2);
1526 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1528 if (timediff > audit_timeout) {
1529 smb_time_audit_log("sys_acl_get_tag_type", timediff);
1532 return result;
1535 static int smb_time_audit_sys_acl_get_permset(vfs_handle_struct *handle,
1536 SMB_ACL_ENTRY_T entry_d,
1537 SMB_ACL_PERMSET_T *permset_p)
1539 int result;
1540 struct timespec ts1,ts2;
1541 double timediff;
1543 clock_gettime_mono(&ts1);
1544 result = SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d,
1545 permset_p);
1546 clock_gettime_mono(&ts2);
1547 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1549 if (timediff > audit_timeout) {
1550 smb_time_audit_log("sys_acl_get_permset", timediff);
1553 return result;
1556 static void * smb_time_audit_sys_acl_get_qualifier(vfs_handle_struct *handle,
1557 SMB_ACL_ENTRY_T entry_d)
1559 void *result;
1560 struct timespec ts1,ts2;
1561 double timediff;
1563 clock_gettime_mono(&ts1);
1564 result = SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
1565 clock_gettime_mono(&ts2);
1566 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1568 if (timediff > audit_timeout) {
1569 smb_time_audit_log("sys_acl_get_qualifier", timediff);
1572 return result;
1575 static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
1576 const char *path_p,
1577 SMB_ACL_TYPE_T type)
1579 SMB_ACL_T result;
1580 struct timespec ts1,ts2;
1581 double timediff;
1583 clock_gettime_mono(&ts1);
1584 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
1585 clock_gettime_mono(&ts2);
1586 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1588 if (timediff > audit_timeout) {
1589 smb_time_audit_log("sys_acl_get_file", timediff);
1592 return result;
1595 static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
1596 files_struct *fsp)
1598 SMB_ACL_T result;
1599 struct timespec ts1,ts2;
1600 double timediff;
1602 clock_gettime_mono(&ts1);
1603 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
1604 clock_gettime_mono(&ts2);
1605 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1607 if (timediff > audit_timeout) {
1608 smb_time_audit_log("sys_acl_get_fd", timediff);
1611 return result;
1614 static int smb_time_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
1615 SMB_ACL_PERMSET_T permset)
1617 int result;
1618 struct timespec ts1,ts2;
1619 double timediff;
1621 clock_gettime_mono(&ts1);
1622 result = SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
1623 clock_gettime_mono(&ts2);
1624 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1626 if (timediff > audit_timeout) {
1627 smb_time_audit_log("sys_acl_clear_perms", timediff);
1630 return result;
1633 static int smb_time_audit_sys_acl_add_perm(vfs_handle_struct *handle,
1634 SMB_ACL_PERMSET_T permset,
1635 SMB_ACL_PERM_T perm)
1637 int result;
1638 struct timespec ts1,ts2;
1639 double timediff;
1641 clock_gettime_mono(&ts1);
1642 result = SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
1643 clock_gettime_mono(&ts2);
1644 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1646 if (timediff > audit_timeout) {
1647 smb_time_audit_log("sys_acl_add_perm", timediff);
1650 return result;
1653 static char * smb_time_audit_sys_acl_to_text(vfs_handle_struct *handle,
1654 SMB_ACL_T theacl,
1655 ssize_t *plen)
1657 char * result;
1658 struct timespec ts1,ts2;
1659 double timediff;
1661 clock_gettime_mono(&ts1);
1662 result = SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
1663 clock_gettime_mono(&ts2);
1664 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1666 if (timediff > audit_timeout) {
1667 smb_time_audit_log("sys_acl_to_text", timediff);
1670 return result;
1673 static SMB_ACL_T smb_time_audit_sys_acl_init(vfs_handle_struct *handle,
1674 int count)
1676 SMB_ACL_T result;
1677 struct timespec ts1,ts2;
1678 double timediff;
1680 clock_gettime_mono(&ts1);
1681 result = SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
1682 clock_gettime_mono(&ts2);
1683 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1685 if (timediff > audit_timeout) {
1686 smb_time_audit_log("sys_acl_init", timediff);
1689 return result;
1692 static int smb_time_audit_sys_acl_create_entry(vfs_handle_struct *handle,
1693 SMB_ACL_T *pacl,
1694 SMB_ACL_ENTRY_T *pentry)
1696 int result;
1697 struct timespec ts1,ts2;
1698 double timediff;
1700 clock_gettime_mono(&ts1);
1701 result = SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
1702 clock_gettime_mono(&ts2);
1703 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1705 if (timediff > audit_timeout) {
1706 smb_time_audit_log("sys_acl_create_entry", timediff);
1709 return result;
1712 static int smb_time_audit_sys_acl_set_tag_type(vfs_handle_struct *handle,
1713 SMB_ACL_ENTRY_T entry,
1714 SMB_ACL_TAG_T tagtype)
1716 int result;
1717 struct timespec ts1,ts2;
1718 double timediff;
1720 clock_gettime_mono(&ts1);
1721 result = SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry,
1722 tagtype);
1723 clock_gettime_mono(&ts2);
1724 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1726 if (timediff > audit_timeout) {
1727 smb_time_audit_log("sys_acl_set_tag_type", timediff);
1730 return result;
1733 static int smb_time_audit_sys_acl_set_qualifier(vfs_handle_struct *handle,
1734 SMB_ACL_ENTRY_T entry,
1735 void *qual)
1737 int result;
1738 struct timespec ts1,ts2;
1739 double timediff;
1741 clock_gettime_mono(&ts1);
1742 result = SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
1743 clock_gettime_mono(&ts2);
1744 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1746 if (timediff > audit_timeout) {
1747 smb_time_audit_log("sys_acl_set_qualifier", timediff);
1750 return result;
1753 static int smb_time_audit_sys_acl_set_permset(vfs_handle_struct *handle,
1754 SMB_ACL_ENTRY_T entry,
1755 SMB_ACL_PERMSET_T permset)
1757 int result;
1758 struct timespec ts1,ts2;
1759 double timediff;
1761 clock_gettime_mono(&ts1);
1762 result = SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
1763 clock_gettime_mono(&ts2);
1764 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1766 if (timediff > audit_timeout) {
1767 smb_time_audit_log("sys_acl_set_permset", timediff);
1770 return result;
1773 static int smb_time_audit_sys_acl_valid(vfs_handle_struct *handle,
1774 SMB_ACL_T theacl)
1776 int result;
1777 struct timespec ts1,ts2;
1778 double timediff;
1780 clock_gettime_mono(&ts1);
1781 result = SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
1782 clock_gettime_mono(&ts2);
1783 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1785 if (timediff > audit_timeout) {
1786 smb_time_audit_log("sys_acl_valid", timediff);
1789 return result;
1792 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
1793 const char *name,
1794 SMB_ACL_TYPE_T acltype,
1795 SMB_ACL_T theacl)
1797 int result;
1798 struct timespec ts1,ts2;
1799 double timediff;
1801 clock_gettime_mono(&ts1);
1802 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
1803 theacl);
1804 clock_gettime_mono(&ts2);
1805 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1807 if (timediff > audit_timeout) {
1808 smb_time_audit_log("sys_acl_set_file", timediff);
1811 return result;
1814 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
1815 files_struct *fsp,
1816 SMB_ACL_T theacl)
1818 int result;
1819 struct timespec ts1,ts2;
1820 double timediff;
1822 clock_gettime_mono(&ts1);
1823 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
1824 clock_gettime_mono(&ts2);
1825 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1827 if (timediff > audit_timeout) {
1828 smb_time_audit_log("sys_acl_set_fd", timediff);
1831 return result;
1834 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
1835 const char *path)
1837 int result;
1838 struct timespec ts1,ts2;
1839 double timediff;
1841 clock_gettime_mono(&ts1);
1842 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
1843 clock_gettime_mono(&ts2);
1844 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1846 if (timediff > audit_timeout) {
1847 smb_time_audit_log("sys_acl_delete_def_file", timediff);
1850 return result;
1853 static int smb_time_audit_sys_acl_get_perm(vfs_handle_struct *handle,
1854 SMB_ACL_PERMSET_T permset,
1855 SMB_ACL_PERM_T perm)
1857 int result;
1858 struct timespec ts1,ts2;
1859 double timediff;
1861 clock_gettime_mono(&ts1);
1862 result = SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
1863 clock_gettime_mono(&ts2);
1864 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1866 if (timediff > audit_timeout) {
1867 smb_time_audit_log("sys_acl_get_perm", timediff);
1870 return result;
1873 static int smb_time_audit_sys_acl_free_text(vfs_handle_struct *handle,
1874 char *text)
1876 int result;
1877 struct timespec ts1,ts2;
1878 double timediff;
1880 clock_gettime_mono(&ts1);
1881 result = SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
1882 clock_gettime_mono(&ts2);
1883 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1885 if (timediff > audit_timeout) {
1886 smb_time_audit_log("sys_acl_free_text", timediff);
1889 return result;
1892 static int smb_time_audit_sys_acl_free_acl(vfs_handle_struct *handle,
1893 SMB_ACL_T posix_acl)
1895 int result;
1896 struct timespec ts1,ts2;
1897 double timediff;
1899 clock_gettime_mono(&ts1);
1900 result = SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
1901 clock_gettime_mono(&ts2);
1902 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1904 if (timediff > audit_timeout) {
1905 smb_time_audit_log("sys_acl_free_acl", timediff);
1908 return result;
1911 static int smb_time_audit_sys_acl_free_qualifier(vfs_handle_struct *handle,
1912 void *qualifier,
1913 SMB_ACL_TAG_T tagtype)
1915 int result;
1916 struct timespec ts1,ts2;
1917 double timediff;
1919 clock_gettime_mono(&ts1);
1920 result = SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier,
1921 tagtype);
1922 clock_gettime_mono(&ts2);
1923 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1925 if (timediff > audit_timeout) {
1926 smb_time_audit_log("sys_acl_free_qualifier", timediff);
1929 return result;
1932 static ssize_t smb_time_audit_getxattr(struct vfs_handle_struct *handle,
1933 const char *path, const char *name,
1934 void *value, size_t size)
1936 ssize_t result;
1937 struct timespec ts1,ts2;
1938 double timediff;
1940 clock_gettime_mono(&ts1);
1941 result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
1942 clock_gettime_mono(&ts2);
1943 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1945 if (timediff > audit_timeout) {
1946 smb_time_audit_log("getxattr", timediff);
1949 return result;
1952 static ssize_t smb_time_audit_lgetxattr(struct vfs_handle_struct *handle,
1953 const char *path, const char *name,
1954 void *value, size_t size)
1956 ssize_t result;
1957 struct timespec ts1,ts2;
1958 double timediff;
1960 clock_gettime_mono(&ts1);
1961 result = SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
1962 clock_gettime_mono(&ts2);
1963 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1965 if (timediff > audit_timeout) {
1966 smb_time_audit_log("lgetxattr", timediff);
1969 return result;
1972 static ssize_t smb_time_audit_fgetxattr(struct vfs_handle_struct *handle,
1973 struct files_struct *fsp,
1974 const char *name, void *value,
1975 size_t size)
1977 ssize_t result;
1978 struct timespec ts1,ts2;
1979 double timediff;
1981 clock_gettime_mono(&ts1);
1982 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
1983 clock_gettime_mono(&ts2);
1984 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1986 if (timediff > audit_timeout) {
1987 smb_time_audit_log("fgetxattr", timediff);
1990 return result;
1993 static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
1994 const char *path, char *list,
1995 size_t size)
1997 ssize_t result;
1998 struct timespec ts1,ts2;
1999 double timediff;
2001 clock_gettime_mono(&ts1);
2002 result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
2003 clock_gettime_mono(&ts2);
2004 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2006 if (timediff > audit_timeout) {
2007 smb_time_audit_log("listxattr", timediff);
2010 return result;
2013 static ssize_t smb_time_audit_llistxattr(struct vfs_handle_struct *handle,
2014 const char *path, char *list,
2015 size_t size)
2017 ssize_t result;
2018 struct timespec ts1,ts2;
2019 double timediff;
2021 clock_gettime_mono(&ts1);
2022 result = SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
2023 clock_gettime_mono(&ts2);
2024 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2026 if (timediff > audit_timeout) {
2027 smb_time_audit_log("llistxattr", timediff);
2030 return result;
2033 static ssize_t smb_time_audit_flistxattr(struct vfs_handle_struct *handle,
2034 struct files_struct *fsp, char *list,
2035 size_t size)
2037 ssize_t result;
2038 struct timespec ts1,ts2;
2039 double timediff;
2041 clock_gettime_mono(&ts1);
2042 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2043 clock_gettime_mono(&ts2);
2044 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2046 if (timediff > audit_timeout) {
2047 smb_time_audit_log("flistxattr", timediff);
2050 return result;
2053 static int smb_time_audit_removexattr(struct vfs_handle_struct *handle,
2054 const char *path, const char *name)
2056 int result;
2057 struct timespec ts1,ts2;
2058 double timediff;
2060 clock_gettime_mono(&ts1);
2061 result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
2062 clock_gettime_mono(&ts2);
2063 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2065 if (timediff > audit_timeout) {
2066 smb_time_audit_log("removexattr", timediff);
2069 return result;
2072 static int smb_time_audit_lremovexattr(struct vfs_handle_struct *handle,
2073 const char *path, const char *name)
2075 int result;
2076 struct timespec ts1,ts2;
2077 double timediff;
2079 clock_gettime_mono(&ts1);
2080 result = SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
2081 clock_gettime_mono(&ts2);
2082 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2084 if (timediff > audit_timeout) {
2085 smb_time_audit_log("lremovexattr", timediff);
2088 return result;
2091 static int smb_time_audit_fremovexattr(struct vfs_handle_struct *handle,
2092 struct files_struct *fsp,
2093 const char *name)
2095 int result;
2096 struct timespec ts1,ts2;
2097 double timediff;
2099 clock_gettime_mono(&ts1);
2100 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2101 clock_gettime_mono(&ts2);
2102 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2104 if (timediff > audit_timeout) {
2105 smb_time_audit_log("fremovexattr", timediff);
2108 return result;
2111 static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
2112 const char *path, const char *name,
2113 const void *value, size_t size,
2114 int flags)
2116 int result;
2117 struct timespec ts1,ts2;
2118 double timediff;
2120 clock_gettime_mono(&ts1);
2121 result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
2122 flags);
2123 clock_gettime_mono(&ts2);
2124 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2126 if (timediff > audit_timeout) {
2127 smb_time_audit_log("setxattr", timediff);
2130 return result;
2133 static int smb_time_audit_lsetxattr(struct vfs_handle_struct *handle,
2134 const char *path, const char *name,
2135 const void *value, size_t size,
2136 int flags)
2138 int result;
2139 struct timespec ts1,ts2;
2140 double timediff;
2142 clock_gettime_mono(&ts1);
2143 result = SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size,
2144 flags);
2145 clock_gettime_mono(&ts2);
2146 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2148 if (timediff > audit_timeout) {
2149 smb_time_audit_log("lsetxattr", timediff);
2152 return result;
2155 static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle,
2156 struct files_struct *fsp, const char *name,
2157 const void *value, size_t size, int flags)
2159 int result;
2160 struct timespec ts1,ts2;
2161 double timediff;
2163 clock_gettime_mono(&ts1);
2164 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2165 clock_gettime_mono(&ts2);
2166 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2168 if (timediff > audit_timeout) {
2169 smb_time_audit_log("fsetxattr", timediff);
2172 return result;
2175 static int smb_time_audit_aio_read(struct vfs_handle_struct *handle,
2176 struct files_struct *fsp,
2177 SMB_STRUCT_AIOCB *aiocb)
2179 int result;
2180 struct timespec ts1,ts2;
2181 double timediff;
2183 clock_gettime_mono(&ts1);
2184 result = SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
2185 clock_gettime_mono(&ts2);
2186 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2188 if (timediff > audit_timeout) {
2189 smb_time_audit_log("aio_read", timediff);
2192 return result;
2195 static int smb_time_audit_aio_write(struct vfs_handle_struct *handle,
2196 struct files_struct *fsp,
2197 SMB_STRUCT_AIOCB *aiocb)
2199 int result;
2200 struct timespec ts1,ts2;
2201 double timediff;
2203 clock_gettime_mono(&ts1);
2204 result = SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
2205 clock_gettime_mono(&ts2);
2206 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2208 if (timediff > audit_timeout) {
2209 smb_time_audit_log("aio_write", timediff);
2212 return result;
2215 static ssize_t smb_time_audit_aio_return(struct vfs_handle_struct *handle,
2216 struct files_struct *fsp,
2217 SMB_STRUCT_AIOCB *aiocb)
2219 int result;
2220 struct timespec ts1,ts2;
2221 double timediff;
2223 clock_gettime_mono(&ts1);
2224 result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
2225 clock_gettime_mono(&ts2);
2226 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2228 if (timediff > audit_timeout) {
2229 smb_time_audit_log("aio_return", timediff);
2232 return result;
2235 static int smb_time_audit_aio_cancel(struct vfs_handle_struct *handle,
2236 struct files_struct *fsp,
2237 SMB_STRUCT_AIOCB *aiocb)
2239 int result;
2240 struct timespec ts1,ts2;
2241 double timediff;
2243 clock_gettime_mono(&ts1);
2244 result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
2245 clock_gettime_mono(&ts2);
2246 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2248 if (timediff > audit_timeout) {
2249 smb_time_audit_log("aio_cancel", timediff);
2252 return result;
2255 static int smb_time_audit_aio_error(struct vfs_handle_struct *handle,
2256 struct files_struct *fsp,
2257 SMB_STRUCT_AIOCB *aiocb)
2259 int result;
2260 struct timespec ts1,ts2;
2261 double timediff;
2263 clock_gettime_mono(&ts1);
2264 result = SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
2265 clock_gettime_mono(&ts2);
2266 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2268 if (timediff > audit_timeout) {
2269 smb_time_audit_log("aio_error", timediff);
2272 return result;
2275 static int smb_time_audit_aio_fsync(struct vfs_handle_struct *handle,
2276 struct files_struct *fsp, int op,
2277 SMB_STRUCT_AIOCB *aiocb)
2279 int result;
2280 struct timespec ts1,ts2;
2281 double timediff;
2283 clock_gettime_mono(&ts1);
2284 result = SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
2285 clock_gettime_mono(&ts2);
2286 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2288 if (timediff > audit_timeout) {
2289 smb_time_audit_log("aio_fsync", timediff);
2292 return result;
2295 static int smb_time_audit_aio_suspend(struct vfs_handle_struct *handle,
2296 struct files_struct *fsp,
2297 const SMB_STRUCT_AIOCB * const aiocb[],
2298 int n, const struct timespec *ts)
2300 int result;
2301 struct timespec ts1,ts2;
2302 double timediff;
2304 clock_gettime_mono(&ts1);
2305 result = SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
2306 clock_gettime_mono(&ts2);
2307 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2309 if (timediff > audit_timeout) {
2310 smb_time_audit_log("aio_suspend", timediff);
2313 return result;
2316 static bool smb_time_audit_aio_force(struct vfs_handle_struct *handle,
2317 struct files_struct *fsp)
2319 bool result;
2320 struct timespec ts1,ts2;
2321 double timediff;
2323 clock_gettime_mono(&ts1);
2324 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2325 clock_gettime_mono(&ts2);
2326 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2328 if (timediff > audit_timeout) {
2329 smb_time_audit_log("aio_force", timediff);
2332 return result;
2337 /* VFS operations */
2339 static struct vfs_fn_pointers vfs_time_audit_fns = {
2340 .connect_fn = smb_time_audit_connect,
2341 .disconnect = smb_time_audit_disconnect,
2342 .disk_free = smb_time_audit_disk_free,
2343 .get_quota = smb_time_audit_get_quota,
2344 .set_quota = smb_time_audit_set_quota,
2345 .get_shadow_copy_data = smb_time_audit_get_shadow_copy_data,
2346 .statvfs = smb_time_audit_statvfs,
2347 .fs_capabilities = smb_time_audit_fs_capabilities,
2348 .opendir = smb_time_audit_opendir,
2349 .fdopendir = smb_time_audit_fdopendir,
2350 .readdir = smb_time_audit_readdir,
2351 .seekdir = smb_time_audit_seekdir,
2352 .telldir = smb_time_audit_telldir,
2353 .rewind_dir = smb_time_audit_rewinddir,
2354 .mkdir = smb_time_audit_mkdir,
2355 .rmdir = smb_time_audit_rmdir,
2356 .closedir = smb_time_audit_closedir,
2357 .init_search_op = smb_time_audit_init_search_op,
2358 .open_fn = smb_time_audit_open,
2359 .create_file = smb_time_audit_create_file,
2360 .close_fn = smb_time_audit_close,
2361 .vfs_read = smb_time_audit_read,
2362 .pread = smb_time_audit_pread,
2363 .write = smb_time_audit_write,
2364 .pwrite = smb_time_audit_pwrite,
2365 .lseek = smb_time_audit_lseek,
2366 .sendfile = smb_time_audit_sendfile,
2367 .recvfile = smb_time_audit_recvfile,
2368 .rename = smb_time_audit_rename,
2369 .fsync = smb_time_audit_fsync,
2370 .stat = smb_time_audit_stat,
2371 .fstat = smb_time_audit_fstat,
2372 .lstat = smb_time_audit_lstat,
2373 .get_alloc_size = smb_time_audit_get_alloc_size,
2374 .unlink = smb_time_audit_unlink,
2375 .chmod = smb_time_audit_chmod,
2376 .fchmod = smb_time_audit_fchmod,
2377 .chown = smb_time_audit_chown,
2378 .fchown = smb_time_audit_fchown,
2379 .lchown = smb_time_audit_lchown,
2380 .chdir = smb_time_audit_chdir,
2381 .getwd = smb_time_audit_getwd,
2382 .ntimes = smb_time_audit_ntimes,
2383 .ftruncate = smb_time_audit_ftruncate,
2384 .fallocate = smb_time_audit_fallocate,
2385 .lock = smb_time_audit_lock,
2386 .kernel_flock = smb_time_audit_kernel_flock,
2387 .linux_setlease = smb_time_audit_linux_setlease,
2388 .getlock = smb_time_audit_getlock,
2389 .symlink = smb_time_audit_symlink,
2390 .vfs_readlink = smb_time_audit_readlink,
2391 .link = smb_time_audit_link,
2392 .mknod = smb_time_audit_mknod,
2393 .realpath = smb_time_audit_realpath,
2394 .notify_watch = smb_time_audit_notify_watch,
2395 .chflags = smb_time_audit_chflags,
2396 .file_id_create = smb_time_audit_file_id_create,
2397 .streaminfo = smb_time_audit_streaminfo,
2398 .get_real_filename = smb_time_audit_get_real_filename,
2399 .connectpath = smb_time_audit_connectpath,
2400 .brl_lock_windows = smb_time_audit_brl_lock_windows,
2401 .brl_unlock_windows = smb_time_audit_brl_unlock_windows,
2402 .brl_cancel_windows = smb_time_audit_brl_cancel_windows,
2403 .strict_lock = smb_time_audit_strict_lock,
2404 .strict_unlock = smb_time_audit_strict_unlock,
2405 .translate_name = smb_time_audit_translate_name,
2406 .fget_nt_acl = smb_time_audit_fget_nt_acl,
2407 .get_nt_acl = smb_time_audit_get_nt_acl,
2408 .fset_nt_acl = smb_time_audit_fset_nt_acl,
2409 .chmod_acl = smb_time_audit_chmod_acl,
2410 .fchmod_acl = smb_time_audit_fchmod_acl,
2411 .sys_acl_get_entry = smb_time_audit_sys_acl_get_entry,
2412 .sys_acl_get_tag_type = smb_time_audit_sys_acl_get_tag_type,
2413 .sys_acl_get_permset = smb_time_audit_sys_acl_get_permset,
2414 .sys_acl_get_qualifier = smb_time_audit_sys_acl_get_qualifier,
2415 .sys_acl_get_file = smb_time_audit_sys_acl_get_file,
2416 .sys_acl_get_fd = smb_time_audit_sys_acl_get_fd,
2417 .sys_acl_clear_perms = smb_time_audit_sys_acl_clear_perms,
2418 .sys_acl_add_perm = smb_time_audit_sys_acl_add_perm,
2419 .sys_acl_to_text = smb_time_audit_sys_acl_to_text,
2420 .sys_acl_init = smb_time_audit_sys_acl_init,
2421 .sys_acl_create_entry = smb_time_audit_sys_acl_create_entry,
2422 .sys_acl_set_tag_type = smb_time_audit_sys_acl_set_tag_type,
2423 .sys_acl_set_qualifier = smb_time_audit_sys_acl_set_qualifier,
2424 .sys_acl_set_permset = smb_time_audit_sys_acl_set_permset,
2425 .sys_acl_valid = smb_time_audit_sys_acl_valid,
2426 .sys_acl_set_file = smb_time_audit_sys_acl_set_file,
2427 .sys_acl_set_fd = smb_time_audit_sys_acl_set_fd,
2428 .sys_acl_delete_def_file = smb_time_audit_sys_acl_delete_def_file,
2429 .sys_acl_get_perm = smb_time_audit_sys_acl_get_perm,
2430 .sys_acl_free_text = smb_time_audit_sys_acl_free_text,
2431 .sys_acl_free_acl = smb_time_audit_sys_acl_free_acl,
2432 .sys_acl_free_qualifier = smb_time_audit_sys_acl_free_qualifier,
2433 .getxattr = smb_time_audit_getxattr,
2434 .lgetxattr = smb_time_audit_lgetxattr,
2435 .fgetxattr = smb_time_audit_fgetxattr,
2436 .listxattr = smb_time_audit_listxattr,
2437 .llistxattr = smb_time_audit_llistxattr,
2438 .flistxattr = smb_time_audit_flistxattr,
2439 .removexattr = smb_time_audit_removexattr,
2440 .lremovexattr = smb_time_audit_lremovexattr,
2441 .fremovexattr = smb_time_audit_fremovexattr,
2442 .setxattr = smb_time_audit_setxattr,
2443 .lsetxattr = smb_time_audit_lsetxattr,
2444 .fsetxattr = smb_time_audit_fsetxattr,
2445 .aio_read = smb_time_audit_aio_read,
2446 .aio_write = smb_time_audit_aio_write,
2447 .aio_return_fn = smb_time_audit_aio_return,
2448 .aio_cancel = smb_time_audit_aio_cancel,
2449 .aio_error_fn = smb_time_audit_aio_error,
2450 .aio_fsync = smb_time_audit_aio_fsync,
2451 .aio_suspend = smb_time_audit_aio_suspend,
2452 .aio_force = smb_time_audit_aio_force,
2456 NTSTATUS vfs_time_audit_init(void);
2457 NTSTATUS vfs_time_audit_init(void)
2459 audit_timeout = (double)lp_parm_int(-1, "time_audit", "timeout",
2460 10000) / 1000.0;
2461 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "time_audit",
2462 &vfs_time_audit_fns);