2 * Time auditing VFS module for samba. Log time taken for VFS call to syslog
5 * Copyright (C) Abhidnya Chirmule <achirmul@in.ibm.com> 2009
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 * This module implements logging for time taken for all Samba VFS operations.
24 * vfs objects = time_audit
29 #include "smbd/smbd.h"
31 #include "lib/util/tevent_unix.h"
32 #include "lib/util/tevent_ntstatus.h"
35 #define DBGC_CLASS DBGC_VFS
37 static double audit_timeout
;
39 static void smb_time_audit_log_msg(const char *syscallname
, double elapsed
,
42 DEBUG(0, ("WARNING: VFS call \"%s\" took unexpectedly long "
43 "(%.2f seconds) %s%s-- Validate that file and storage "
44 "subsystems are operating normally\n", syscallname
,
45 elapsed
, (msg
!= NULL
) ? msg
: "",
46 (msg
!= NULL
) ? " " : ""));
49 static void smb_time_audit_log(const char *syscallname
, double elapsed
)
51 smb_time_audit_log_msg(syscallname
, elapsed
, NULL
);
54 static void smb_time_audit_log_fsp(const char *syscallname
, double elapsed
,
55 const struct files_struct
*fsp
)
57 char *base_name
= NULL
;
58 char *connectpath
= NULL
;
62 smb_time_audit_log(syscallname
, elapsed
);
66 connectpath
= fsp
->conn
->connectpath
;
68 base_name
= fsp
->fsp_name
->base_name
;
70 if (connectpath
!= NULL
&& base_name
!= NULL
) {
71 msg
= talloc_asprintf(talloc_tos(), "filename = \"%s/%s\"",
72 connectpath
, base_name
);
73 } else if (connectpath
!= NULL
&& base_name
== NULL
) {
74 msg
= talloc_asprintf(talloc_tos(), "connectpath = \"%s\", "
77 } else if (connectpath
== NULL
&& base_name
!= NULL
) {
78 msg
= talloc_asprintf(talloc_tos(), "connectpath = <NULL>, "
81 } else { /* connectpath == NULL && base_name == NULL */
82 msg
= talloc_asprintf(talloc_tos(), "connectpath = <NULL>, "
83 "base_name = <NULL>");
85 smb_time_audit_log_msg(syscallname
, elapsed
, msg
);
89 static void smb_time_audit_log_fname(const char *syscallname
, double elapsed
,
95 if (getcwd(cwd
, sizeof(cwd
)) == NULL
) {
96 snprintf(cwd
, sizeof(cwd
), "<getcwd() error %d>", errno
);
99 msg
= talloc_asprintf(talloc_tos(),
100 "cwd = \"%s\", filename = \"%s\"",
103 msg
= talloc_asprintf(talloc_tos(),
104 "cwd = \"%s\", filename = <NULL>",
107 smb_time_audit_log_msg(syscallname
, elapsed
, msg
);
111 static void smb_time_audit_log_smb_fname(const char *syscallname
, double elapsed
,
112 const struct smb_filename
*smb_fname
)
114 if (smb_fname
!= NULL
) {
115 smb_time_audit_log_fname(syscallname
, elapsed
,
116 smb_fname
->base_name
);
118 smb_time_audit_log_fname(syscallname
, elapsed
,
119 "smb_fname = <NULL>");
123 static int smb_time_audit_connect(vfs_handle_struct
*handle
,
124 const char *svc
, const char *user
)
127 struct timespec ts1
,ts2
;
134 clock_gettime_mono(&ts1
);
135 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
136 clock_gettime_mono(&ts2
);
137 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
138 if (timediff
> audit_timeout
) {
139 smb_time_audit_log_msg("connect", timediff
, user
);
144 static void smb_time_audit_disconnect(vfs_handle_struct
*handle
)
146 struct timespec ts1
,ts2
;
149 clock_gettime_mono(&ts1
);
150 SMB_VFS_NEXT_DISCONNECT(handle
);
151 clock_gettime_mono(&ts2
);
152 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
154 if (timediff
> audit_timeout
) {
155 smb_time_audit_log("disconnect", timediff
);
159 static uint64_t smb_time_audit_disk_free(vfs_handle_struct
*handle
,
161 bool small_query
, uint64_t *bsize
,
162 uint64_t *dfree
, uint64_t *dsize
)
165 struct timespec ts1
,ts2
;
168 clock_gettime_mono(&ts1
);
169 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
171 clock_gettime_mono(&ts2
);
172 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
174 /* Don't have a reasonable notion of failure here */
175 if (timediff
> audit_timeout
) {
176 smb_time_audit_log_fname("disk_free", timediff
, path
);
182 static int smb_time_audit_get_quota(struct vfs_handle_struct
*handle
,
183 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
187 struct timespec ts1
,ts2
;
190 clock_gettime_mono(&ts1
);
191 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
192 clock_gettime_mono(&ts2
);
193 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
195 if (timediff
> audit_timeout
) {
196 smb_time_audit_log("get_quota", timediff
);
201 static int smb_time_audit_set_quota(struct vfs_handle_struct
*handle
,
202 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
206 struct timespec ts1
,ts2
;
209 clock_gettime_mono(&ts1
);
210 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
211 clock_gettime_mono(&ts2
);
212 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
214 if (timediff
> audit_timeout
) {
215 smb_time_audit_log("set_quota", timediff
);
221 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
222 struct files_struct
*fsp
,
223 struct shadow_copy_data
*shadow_copy_data
,
227 struct timespec ts1
,ts2
;
230 clock_gettime_mono(&ts1
);
231 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
,
232 shadow_copy_data
, labels
);
233 clock_gettime_mono(&ts2
);
234 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
236 if (timediff
> audit_timeout
) {
237 smb_time_audit_log_fsp("get_shadow_copy_data", timediff
, fsp
);
243 static int smb_time_audit_statvfs(struct vfs_handle_struct
*handle
,
245 struct vfs_statvfs_struct
*statbuf
)
248 struct timespec ts1
,ts2
;
251 clock_gettime_mono(&ts1
);
252 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
253 clock_gettime_mono(&ts2
);
254 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
256 if (timediff
> audit_timeout
) {
257 smb_time_audit_log_fname("statvfs", timediff
, path
);
263 static uint32_t smb_time_audit_fs_capabilities(struct vfs_handle_struct
*handle
,
264 enum timestamp_set_resolution
*p_ts_res
)
267 struct timespec ts1
,ts2
;
270 clock_gettime_mono(&ts1
);
271 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
272 clock_gettime_mono(&ts2
);
273 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
275 if (timediff
> audit_timeout
) {
276 smb_time_audit_log("fs_capabilities", timediff
);
282 static DIR *smb_time_audit_opendir(vfs_handle_struct
*handle
,
284 const char *mask
, uint32 attr
)
287 struct timespec ts1
,ts2
;
290 clock_gettime_mono(&ts1
);
291 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
292 clock_gettime_mono(&ts2
);
293 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
295 if (timediff
> audit_timeout
) {
296 smb_time_audit_log_fname("opendir", timediff
, fname
);
302 static DIR *smb_time_audit_fdopendir(vfs_handle_struct
*handle
,
304 const char *mask
, uint32 attr
)
307 struct timespec ts1
,ts2
;
310 clock_gettime_mono(&ts1
);
311 result
= SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
312 clock_gettime_mono(&ts2
);
313 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
315 if (timediff
> audit_timeout
) {
316 smb_time_audit_log_fsp("fdopendir", timediff
, fsp
);
322 static struct dirent
*smb_time_audit_readdir(vfs_handle_struct
*handle
,
324 SMB_STRUCT_STAT
*sbuf
)
326 struct dirent
*result
;
327 struct timespec ts1
,ts2
;
330 clock_gettime_mono(&ts1
);
331 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
332 clock_gettime_mono(&ts2
);
333 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
335 if (timediff
> audit_timeout
) {
336 smb_time_audit_log("readdir", timediff
);
342 static void smb_time_audit_seekdir(vfs_handle_struct
*handle
,
343 DIR *dirp
, long offset
)
345 struct timespec ts1
,ts2
;
348 clock_gettime_mono(&ts1
);
349 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
350 clock_gettime_mono(&ts2
);
351 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
353 if (timediff
> audit_timeout
) {
354 smb_time_audit_log("seekdir", timediff
);
359 static long smb_time_audit_telldir(vfs_handle_struct
*handle
,
363 struct timespec ts1
,ts2
;
366 clock_gettime_mono(&ts1
);
367 result
= SMB_VFS_NEXT_TELLDIR(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("telldir", timediff
);
378 static void smb_time_audit_rewinddir(vfs_handle_struct
*handle
,
381 struct timespec ts1
,ts2
;
384 clock_gettime_mono(&ts1
);
385 SMB_VFS_NEXT_REWINDDIR(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("rewinddir", timediff
);
395 static int smb_time_audit_mkdir(vfs_handle_struct
*handle
,
396 const char *path
, mode_t mode
)
399 struct timespec ts1
,ts2
;
402 clock_gettime_mono(&ts1
);
403 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
404 clock_gettime_mono(&ts2
);
405 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
407 if (timediff
> audit_timeout
) {
408 smb_time_audit_log_fname("mkdir", timediff
, path
);
414 static int smb_time_audit_rmdir(vfs_handle_struct
*handle
,
418 struct timespec ts1
,ts2
;
421 clock_gettime_mono(&ts1
);
422 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
423 clock_gettime_mono(&ts2
);
424 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
426 if (timediff
> audit_timeout
) {
427 smb_time_audit_log_fname("rmdir", timediff
, path
);
433 static int smb_time_audit_closedir(vfs_handle_struct
*handle
,
437 struct timespec ts1
,ts2
;
440 clock_gettime_mono(&ts1
);
441 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
442 clock_gettime_mono(&ts2
);
443 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
445 if (timediff
> audit_timeout
) {
446 smb_time_audit_log("closedir", timediff
);
452 static void smb_time_audit_init_search_op(vfs_handle_struct
*handle
,
455 struct timespec ts1
,ts2
;
458 clock_gettime_mono(&ts1
);
459 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
460 clock_gettime_mono(&ts2
);
461 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
463 if (timediff
> audit_timeout
) {
464 smb_time_audit_log("init_search_op", timediff
);
468 static int smb_time_audit_open(vfs_handle_struct
*handle
,
469 struct smb_filename
*fname
,
471 int flags
, mode_t mode
)
474 struct timespec ts1
,ts2
;
477 clock_gettime_mono(&ts1
);
478 result
= SMB_VFS_NEXT_OPEN(handle
, fname
, fsp
, flags
, mode
);
479 clock_gettime_mono(&ts2
);
480 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
482 if (timediff
> audit_timeout
) {
483 smb_time_audit_log_fsp("open", timediff
, fsp
);
489 static NTSTATUS
smb_time_audit_create_file(vfs_handle_struct
*handle
,
490 struct smb_request
*req
,
491 uint16_t root_dir_fid
,
492 struct smb_filename
*fname
,
493 uint32_t access_mask
,
494 uint32_t share_access
,
495 uint32_t create_disposition
,
496 uint32_t create_options
,
497 uint32_t file_attributes
,
498 uint32_t oplock_request
,
499 struct smb2_lease
*lease
,
500 uint64_t allocation_size
,
501 uint32_t private_flags
,
502 struct security_descriptor
*sd
,
503 struct ea_list
*ea_list
,
504 files_struct
**result_fsp
,
506 const struct smb2_create_blobs
*in_context_blobs
,
507 struct smb2_create_blobs
*out_context_blobs
)
510 struct timespec ts1
,ts2
;
513 clock_gettime_mono(&ts1
);
514 result
= SMB_VFS_NEXT_CREATE_FILE(
517 root_dir_fid
, /* root_dir_fid */
519 access_mask
, /* access_mask */
520 share_access
, /* share_access */
521 create_disposition
, /* create_disposition*/
522 create_options
, /* create_options */
523 file_attributes
, /* file_attributes */
524 oplock_request
, /* oplock_request */
526 allocation_size
, /* allocation_size */
529 ea_list
, /* ea_list */
530 result_fsp
, /* result */
532 in_context_blobs
, out_context_blobs
); /* create context */
533 clock_gettime_mono(&ts2
);
534 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
536 if (timediff
> audit_timeout
) {
538 * can't use result_fsp this time, may have
539 * invalid content causing smbd crash
541 smb_time_audit_log_smb_fname("create_file", timediff
,
548 static int smb_time_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
551 struct timespec ts1
,ts2
;
554 clock_gettime_mono(&ts1
);
555 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
556 clock_gettime_mono(&ts2
);
557 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
559 if (timediff
> audit_timeout
) {
560 smb_time_audit_log_fsp("close", timediff
, fsp
);
566 static ssize_t
smb_time_audit_read(vfs_handle_struct
*handle
,
567 files_struct
*fsp
, void *data
, size_t n
)
570 struct timespec ts1
,ts2
;
573 clock_gettime_mono(&ts1
);
574 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
575 clock_gettime_mono(&ts2
);
576 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
578 if (timediff
> audit_timeout
) {
579 smb_time_audit_log_fsp("read", timediff
, fsp
);
585 static ssize_t
smb_time_audit_pread(vfs_handle_struct
*handle
,
587 void *data
, size_t n
, off_t offset
)
590 struct timespec ts1
,ts2
;
593 clock_gettime_mono(&ts1
);
594 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
595 clock_gettime_mono(&ts2
);
596 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
598 if (timediff
> audit_timeout
) {
599 smb_time_audit_log_fsp("pread", timediff
, fsp
);
605 struct smb_time_audit_pread_state
{
606 struct files_struct
*fsp
;
612 static void smb_time_audit_pread_done(struct tevent_req
*subreq
);
614 static struct tevent_req
*smb_time_audit_pread_send(
615 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
616 struct tevent_context
*ev
, struct files_struct
*fsp
,
617 void *data
, size_t n
, off_t offset
)
619 struct tevent_req
*req
, *subreq
;
620 struct smb_time_audit_pread_state
*state
;
622 req
= tevent_req_create(mem_ctx
, &state
,
623 struct smb_time_audit_pread_state
);
627 clock_gettime_mono(&state
->ts1
);
630 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
632 if (tevent_req_nomem(subreq
, req
)) {
633 return tevent_req_post(req
, ev
);
635 tevent_req_set_callback(subreq
, smb_time_audit_pread_done
, req
);
639 static void smb_time_audit_pread_done(struct tevent_req
*subreq
)
641 struct tevent_req
*req
= tevent_req_callback_data(
642 subreq
, struct tevent_req
);
643 struct smb_time_audit_pread_state
*state
= tevent_req_data(
644 req
, struct smb_time_audit_pread_state
);
646 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
648 tevent_req_done(req
);
651 static ssize_t
smb_time_audit_pread_recv(struct tevent_req
*req
, int *err
)
653 struct smb_time_audit_pread_state
*state
= tevent_req_data(
654 req
, struct smb_time_audit_pread_state
);
658 clock_gettime_mono(&ts2
);
659 timediff
= nsec_time_diff(&ts2
,&state
->ts1
)*1.0e-9;
661 if (timediff
> audit_timeout
) {
662 smb_time_audit_log_fsp("pread", timediff
, state
->fsp
);
665 if (tevent_req_is_unix_error(req
, err
)) {
672 static ssize_t
smb_time_audit_write(vfs_handle_struct
*handle
,
674 const void *data
, size_t n
)
677 struct timespec ts1
,ts2
;
680 clock_gettime_mono(&ts1
);
681 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
682 clock_gettime_mono(&ts2
);
683 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
685 if (timediff
> audit_timeout
) {
686 smb_time_audit_log_fsp("write", timediff
, fsp
);
692 static ssize_t
smb_time_audit_pwrite(vfs_handle_struct
*handle
,
694 const void *data
, size_t n
,
698 struct timespec ts1
,ts2
;
701 clock_gettime_mono(&ts1
);
702 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
703 clock_gettime_mono(&ts2
);
704 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
706 if (timediff
> audit_timeout
) {
707 smb_time_audit_log_fsp("pwrite", timediff
, fsp
);
713 struct smb_time_audit_pwrite_state
{
714 struct files_struct
*fsp
;
720 static void smb_time_audit_pwrite_done(struct tevent_req
*subreq
);
722 static struct tevent_req
*smb_time_audit_pwrite_send(
723 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
724 struct tevent_context
*ev
, struct files_struct
*fsp
,
725 const void *data
, size_t n
, off_t offset
)
727 struct tevent_req
*req
, *subreq
;
728 struct smb_time_audit_pwrite_state
*state
;
730 req
= tevent_req_create(mem_ctx
, &state
,
731 struct smb_time_audit_pwrite_state
);
735 clock_gettime_mono(&state
->ts1
);
738 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
740 if (tevent_req_nomem(subreq
, req
)) {
741 return tevent_req_post(req
, ev
);
743 tevent_req_set_callback(subreq
, smb_time_audit_pwrite_done
, req
);
747 static void smb_time_audit_pwrite_done(struct tevent_req
*subreq
)
749 struct tevent_req
*req
= tevent_req_callback_data(
750 subreq
, struct tevent_req
);
751 struct smb_time_audit_pwrite_state
*state
= tevent_req_data(
752 req
, struct smb_time_audit_pwrite_state
);
754 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
756 tevent_req_done(req
);
759 static ssize_t
smb_time_audit_pwrite_recv(struct tevent_req
*req
, int *err
)
761 struct smb_time_audit_pwrite_state
*state
= tevent_req_data(
762 req
, struct smb_time_audit_pwrite_state
);
766 clock_gettime_mono(&ts2
);
767 timediff
= nsec_time_diff(&ts2
,&state
->ts1
)*1.0e-9;
769 if (timediff
> audit_timeout
) {
770 smb_time_audit_log_fsp("pwrite", timediff
, state
->fsp
);
773 if (tevent_req_is_unix_error(req
, err
)) {
780 static off_t
smb_time_audit_lseek(vfs_handle_struct
*handle
,
782 off_t offset
, int whence
)
785 struct timespec ts1
,ts2
;
788 clock_gettime_mono(&ts1
);
789 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
790 clock_gettime_mono(&ts2
);
791 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
793 if (timediff
> audit_timeout
) {
794 smb_time_audit_log_fsp("lseek", timediff
, fsp
);
800 static ssize_t
smb_time_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
801 files_struct
*fromfsp
,
802 const DATA_BLOB
*hdr
, off_t offset
,
806 struct timespec ts1
,ts2
;
809 clock_gettime_mono(&ts1
);
810 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
811 clock_gettime_mono(&ts2
);
812 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
814 if (timediff
> audit_timeout
) {
815 smb_time_audit_log_fsp("sendfile", timediff
, fromfsp
);
821 static ssize_t
smb_time_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
827 struct timespec ts1
,ts2
;
830 clock_gettime_mono(&ts1
);
831 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
832 clock_gettime_mono(&ts2
);
833 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
835 if (timediff
> audit_timeout
) {
836 smb_time_audit_log_fsp("recvfile", timediff
, tofsp
);
842 static int smb_time_audit_rename(vfs_handle_struct
*handle
,
843 const struct smb_filename
*oldname
,
844 const struct smb_filename
*newname
)
847 struct timespec ts1
,ts2
;
850 clock_gettime_mono(&ts1
);
851 result
= SMB_VFS_NEXT_RENAME(handle
, oldname
, newname
);
852 clock_gettime_mono(&ts2
);
853 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
855 if (timediff
> audit_timeout
) {
856 smb_time_audit_log_smb_fname("rename", timediff
, newname
);
862 static int smb_time_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
865 struct timespec ts1
,ts2
;
868 clock_gettime_mono(&ts1
);
869 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
870 clock_gettime_mono(&ts2
);
871 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
873 if (timediff
> audit_timeout
) {
874 smb_time_audit_log_fsp("fsync", timediff
, fsp
);
880 struct smb_time_audit_fsync_state
{
881 struct files_struct
*fsp
;
887 static void smb_time_audit_fsync_done(struct tevent_req
*subreq
);
889 static struct tevent_req
*smb_time_audit_fsync_send(
890 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
891 struct tevent_context
*ev
, struct files_struct
*fsp
)
893 struct tevent_req
*req
, *subreq
;
894 struct smb_time_audit_fsync_state
*state
;
896 req
= tevent_req_create(mem_ctx
, &state
,
897 struct smb_time_audit_fsync_state
);
901 clock_gettime_mono(&state
->ts1
);
904 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
905 if (tevent_req_nomem(subreq
, req
)) {
906 return tevent_req_post(req
, ev
);
908 tevent_req_set_callback(subreq
, smb_time_audit_fsync_done
, req
);
912 static void smb_time_audit_fsync_done(struct tevent_req
*subreq
)
914 struct tevent_req
*req
= tevent_req_callback_data(
915 subreq
, struct tevent_req
);
916 struct smb_time_audit_fsync_state
*state
= tevent_req_data(
917 req
, struct smb_time_audit_fsync_state
);
919 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
921 tevent_req_done(req
);
924 static int smb_time_audit_fsync_recv(struct tevent_req
*req
, int *err
)
926 struct smb_time_audit_fsync_state
*state
= tevent_req_data(
927 req
, struct smb_time_audit_fsync_state
);
931 clock_gettime_mono(&ts2
);
932 timediff
= nsec_time_diff(&ts2
,&state
->ts1
)*1.0e-9;
934 if (timediff
> audit_timeout
) {
935 smb_time_audit_log_fsp("fsync", timediff
, state
->fsp
);
938 if (tevent_req_is_unix_error(req
, err
)) {
945 static int smb_time_audit_stat(vfs_handle_struct
*handle
,
946 struct smb_filename
*fname
)
949 struct timespec ts1
,ts2
;
952 clock_gettime_mono(&ts1
);
953 result
= SMB_VFS_NEXT_STAT(handle
, fname
);
954 clock_gettime_mono(&ts2
);
955 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
957 if (timediff
> audit_timeout
) {
958 smb_time_audit_log_smb_fname("stat", timediff
, fname
);
964 static int smb_time_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
965 SMB_STRUCT_STAT
*sbuf
)
968 struct timespec ts1
,ts2
;
971 clock_gettime_mono(&ts1
);
972 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
973 clock_gettime_mono(&ts2
);
974 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
976 if (timediff
> audit_timeout
) {
977 smb_time_audit_log_fsp("fstat", timediff
, fsp
);
983 static int smb_time_audit_lstat(vfs_handle_struct
*handle
,
984 struct smb_filename
*path
)
987 struct timespec ts1
,ts2
;
990 clock_gettime_mono(&ts1
);
991 result
= SMB_VFS_NEXT_LSTAT(handle
, path
);
992 clock_gettime_mono(&ts2
);
993 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
995 if (timediff
> audit_timeout
) {
996 smb_time_audit_log_smb_fname("lstat", timediff
, path
);
1002 static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct
*handle
,
1004 const SMB_STRUCT_STAT
*sbuf
)
1007 struct timespec ts1
,ts2
;
1010 clock_gettime_mono(&ts1
);
1011 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1012 clock_gettime_mono(&ts2
);
1013 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1015 if (timediff
> audit_timeout
) {
1016 smb_time_audit_log_fsp("get_alloc_size", timediff
, fsp
);
1022 static int smb_time_audit_unlink(vfs_handle_struct
*handle
,
1023 const struct smb_filename
*path
)
1026 struct timespec ts1
,ts2
;
1029 clock_gettime_mono(&ts1
);
1030 result
= SMB_VFS_NEXT_UNLINK(handle
, path
);
1031 clock_gettime_mono(&ts2
);
1032 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1034 if (timediff
> audit_timeout
) {
1035 smb_time_audit_log_smb_fname("unlink", timediff
, path
);
1041 static int smb_time_audit_chmod(vfs_handle_struct
*handle
,
1042 const char *path
, mode_t mode
)
1045 struct timespec ts1
,ts2
;
1048 clock_gettime_mono(&ts1
);
1049 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1050 clock_gettime_mono(&ts2
);
1051 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1053 if (timediff
> audit_timeout
) {
1054 smb_time_audit_log_fname("chmod", timediff
, path
);
1060 static int smb_time_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1064 struct timespec ts1
,ts2
;
1067 clock_gettime_mono(&ts1
);
1068 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1069 clock_gettime_mono(&ts2
);
1070 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1072 if (timediff
> audit_timeout
) {
1073 smb_time_audit_log_fsp("fchmod", timediff
, fsp
);
1079 static int smb_time_audit_chown(vfs_handle_struct
*handle
,
1080 const char *path
, uid_t uid
, gid_t gid
)
1083 struct timespec ts1
,ts2
;
1086 clock_gettime_mono(&ts1
);
1087 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1088 clock_gettime_mono(&ts2
);
1089 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1091 if (timediff
> audit_timeout
) {
1092 smb_time_audit_log_fname("chown", timediff
, path
);
1098 static int smb_time_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1099 uid_t uid
, gid_t gid
)
1102 struct timespec ts1
,ts2
;
1105 clock_gettime_mono(&ts1
);
1106 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1107 clock_gettime_mono(&ts2
);
1108 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1110 if (timediff
> audit_timeout
) {
1111 smb_time_audit_log_fsp("fchown", timediff
, fsp
);
1117 static int smb_time_audit_lchown(vfs_handle_struct
*handle
,
1118 const char *path
, uid_t uid
, gid_t gid
)
1121 struct timespec ts1
,ts2
;
1124 clock_gettime_mono(&ts1
);
1125 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1126 clock_gettime_mono(&ts2
);
1127 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1129 if (timediff
> audit_timeout
) {
1130 smb_time_audit_log_fname("lchown", timediff
, path
);
1136 static int smb_time_audit_chdir(vfs_handle_struct
*handle
, const char *path
)
1139 struct timespec ts1
,ts2
;
1142 clock_gettime_mono(&ts1
);
1143 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
1144 clock_gettime_mono(&ts2
);
1145 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1147 if (timediff
> audit_timeout
) {
1148 smb_time_audit_log_fname("chdir", timediff
, path
);
1154 static char *smb_time_audit_getwd(vfs_handle_struct
*handle
)
1157 struct timespec ts1
,ts2
;
1160 clock_gettime_mono(&ts1
);
1161 result
= SMB_VFS_NEXT_GETWD(handle
);
1162 clock_gettime_mono(&ts2
);
1163 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1165 if (timediff
> audit_timeout
) {
1166 smb_time_audit_log("getwd", timediff
);
1172 static int smb_time_audit_ntimes(vfs_handle_struct
*handle
,
1173 const struct smb_filename
*path
,
1174 struct smb_file_time
*ft
)
1177 struct timespec ts1
,ts2
;
1180 clock_gettime_mono(&ts1
);
1181 result
= SMB_VFS_NEXT_NTIMES(handle
, path
, ft
);
1182 clock_gettime_mono(&ts2
);
1183 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1185 if (timediff
> audit_timeout
) {
1186 smb_time_audit_log_smb_fname("ntimes", timediff
, path
);
1192 static int smb_time_audit_ftruncate(vfs_handle_struct
*handle
,
1197 struct timespec ts1
,ts2
;
1200 clock_gettime_mono(&ts1
);
1201 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1202 clock_gettime_mono(&ts2
);
1203 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1205 if (timediff
> audit_timeout
) {
1206 smb_time_audit_log_fsp("ftruncate", timediff
, fsp
);
1212 static int smb_time_audit_fallocate(vfs_handle_struct
*handle
,
1214 enum vfs_fallocate_mode mode
,
1219 int saved_errno
= 0;
1220 struct timespec ts1
,ts2
;
1223 clock_gettime_mono(&ts1
);
1224 result
= SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1226 saved_errno
= errno
;
1228 clock_gettime_mono(&ts2
);
1229 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1231 if (timediff
> audit_timeout
) {
1232 smb_time_audit_log_fsp("fallocate", timediff
, fsp
);
1235 errno
= saved_errno
;
1240 static bool smb_time_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1241 int op
, off_t offset
, off_t count
,
1245 struct timespec ts1
,ts2
;
1248 clock_gettime_mono(&ts1
);
1249 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1250 clock_gettime_mono(&ts2
);
1251 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1253 if (timediff
> audit_timeout
) {
1254 smb_time_audit_log_fsp("lock", timediff
, fsp
);
1260 static int smb_time_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1261 struct files_struct
*fsp
,
1262 uint32 share_mode
, uint32 access_mask
)
1265 struct timespec ts1
,ts2
;
1268 clock_gettime_mono(&ts1
);
1269 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
,
1271 clock_gettime_mono(&ts2
);
1272 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1274 if (timediff
> audit_timeout
) {
1275 smb_time_audit_log_fsp("kernel_flock", timediff
, fsp
);
1281 static int smb_time_audit_linux_setlease(vfs_handle_struct
*handle
,
1286 struct timespec ts1
,ts2
;
1289 clock_gettime_mono(&ts1
);
1290 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1291 clock_gettime_mono(&ts2
);
1292 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1294 if (timediff
> audit_timeout
) {
1295 smb_time_audit_log_fsp("linux_setlease", timediff
, fsp
);
1301 static bool smb_time_audit_getlock(vfs_handle_struct
*handle
,
1303 off_t
*poffset
, off_t
*pcount
,
1304 int *ptype
, pid_t
*ppid
)
1307 struct timespec ts1
,ts2
;
1310 clock_gettime_mono(&ts1
);
1311 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
,
1313 clock_gettime_mono(&ts2
);
1314 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1316 if (timediff
> audit_timeout
) {
1317 smb_time_audit_log_fsp("getlock", timediff
, fsp
);
1323 static int smb_time_audit_symlink(vfs_handle_struct
*handle
,
1324 const char *oldpath
, const char *newpath
)
1327 struct timespec ts1
,ts2
;
1330 clock_gettime_mono(&ts1
);
1331 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1332 clock_gettime_mono(&ts2
);
1333 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1335 if (timediff
> audit_timeout
) {
1336 smb_time_audit_log_fname("symlink", timediff
, newpath
);
1342 static int smb_time_audit_readlink(vfs_handle_struct
*handle
,
1343 const char *path
, char *buf
, size_t bufsiz
)
1346 struct timespec ts1
,ts2
;
1349 clock_gettime_mono(&ts1
);
1350 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1351 clock_gettime_mono(&ts2
);
1352 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1354 if (timediff
> audit_timeout
) {
1355 smb_time_audit_log_fname("readlink", timediff
, path
);
1361 static int smb_time_audit_link(vfs_handle_struct
*handle
,
1362 const char *oldpath
, const char *newpath
)
1365 struct timespec ts1
,ts2
;
1368 clock_gettime_mono(&ts1
);
1369 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
1370 clock_gettime_mono(&ts2
);
1371 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1373 if (timediff
> audit_timeout
) {
1374 smb_time_audit_log_fname("link", timediff
, newpath
);
1380 static int smb_time_audit_mknod(vfs_handle_struct
*handle
,
1381 const char *pathname
, mode_t mode
,
1385 struct timespec ts1
,ts2
;
1388 clock_gettime_mono(&ts1
);
1389 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1390 clock_gettime_mono(&ts2
);
1391 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1393 if (timediff
> audit_timeout
) {
1394 smb_time_audit_log_fname("mknod", timediff
, pathname
);
1400 static char *smb_time_audit_realpath(vfs_handle_struct
*handle
,
1404 struct timespec ts1
,ts2
;
1407 clock_gettime_mono(&ts1
);
1408 result
= SMB_VFS_NEXT_REALPATH(handle
, path
);
1409 clock_gettime_mono(&ts2
);
1410 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1412 if (timediff
> audit_timeout
) {
1413 smb_time_audit_log_fname("realpath", timediff
, path
);
1419 static NTSTATUS
smb_time_audit_notify_watch(struct vfs_handle_struct
*handle
,
1420 struct sys_notify_context
*ctx
,
1423 uint32_t *subdir_filter
,
1424 void (*callback
)(struct sys_notify_context
*ctx
,
1426 struct notify_event
*ev
),
1427 void *private_data
, void *handle_p
)
1430 struct timespec ts1
,ts2
;
1433 clock_gettime_mono(&ts1
);
1434 result
= SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
1435 filter
, subdir_filter
, callback
,
1436 private_data
, handle_p
);
1437 clock_gettime_mono(&ts2
);
1438 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1440 if (timediff
> audit_timeout
) {
1441 smb_time_audit_log_fname("notify_watch", timediff
, path
);
1447 static int smb_time_audit_chflags(vfs_handle_struct
*handle
,
1448 const char *path
, unsigned int flags
)
1451 struct timespec ts1
,ts2
;
1454 clock_gettime_mono(&ts1
);
1455 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1456 clock_gettime_mono(&ts2
);
1457 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1459 if (timediff
> audit_timeout
) {
1460 smb_time_audit_log_fname("chflags", timediff
, path
);
1466 static struct file_id
smb_time_audit_file_id_create(struct vfs_handle_struct
*handle
,
1467 const SMB_STRUCT_STAT
*sbuf
)
1469 struct file_id id_zero
;
1470 struct file_id result
;
1471 struct timespec ts1
,ts2
;
1474 ZERO_STRUCT(id_zero
);
1476 clock_gettime_mono(&ts1
);
1477 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1478 clock_gettime_mono(&ts2
);
1479 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1481 if (timediff
> audit_timeout
) {
1482 smb_time_audit_log("file_id_create", timediff
);
1488 static NTSTATUS
smb_time_audit_streaminfo(vfs_handle_struct
*handle
,
1489 struct files_struct
*fsp
,
1491 TALLOC_CTX
*mem_ctx
,
1492 unsigned int *pnum_streams
,
1493 struct stream_struct
**pstreams
)
1496 struct timespec ts1
,ts2
;
1499 clock_gettime_mono(&ts1
);
1500 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1501 pnum_streams
, pstreams
);
1502 clock_gettime_mono(&ts2
);
1503 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1505 if (timediff
> audit_timeout
) {
1506 smb_time_audit_log_fsp("streaminfo", timediff
, fsp
);
1512 static int smb_time_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1515 TALLOC_CTX
*mem_ctx
,
1519 struct timespec ts1
,ts2
;
1522 clock_gettime_mono(&ts1
);
1523 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
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_fname("get_real_filename", timediff
, path
);
1535 static const char *smb_time_audit_connectpath(vfs_handle_struct
*handle
,
1539 struct timespec ts1
,ts2
;
1542 clock_gettime_mono(&ts1
);
1543 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1544 clock_gettime_mono(&ts2
);
1545 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1547 if (timediff
> audit_timeout
) {
1548 smb_time_audit_log_fname("connectpath", timediff
, fname
);
1554 static NTSTATUS
smb_time_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1555 struct byte_range_lock
*br_lck
,
1556 struct lock_struct
*plock
,
1560 struct timespec ts1
,ts2
;
1563 clock_gettime_mono(&ts1
);
1564 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1566 clock_gettime_mono(&ts2
);
1567 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1569 if (timediff
> audit_timeout
) {
1570 smb_time_audit_log_fsp("brl_lock_windows", timediff
,
1577 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1578 struct messaging_context
*msg_ctx
,
1579 struct byte_range_lock
*br_lck
,
1580 const struct lock_struct
*plock
)
1583 struct timespec ts1
,ts2
;
1586 clock_gettime_mono(&ts1
);
1587 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1589 clock_gettime_mono(&ts2
);
1590 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1592 if (timediff
> audit_timeout
) {
1593 smb_time_audit_log_fsp("brl_unlock_windows", timediff
,
1600 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1601 struct byte_range_lock
*br_lck
,
1602 struct lock_struct
*plock
)
1605 struct timespec ts1
,ts2
;
1608 clock_gettime_mono(&ts1
);
1609 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
1610 clock_gettime_mono(&ts2
);
1611 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1613 if (timediff
> audit_timeout
) {
1614 smb_time_audit_log_fsp("brl_cancel_windows", timediff
,
1621 static bool smb_time_audit_strict_lock(struct vfs_handle_struct
*handle
,
1622 struct files_struct
*fsp
,
1623 struct lock_struct
*plock
)
1626 struct timespec ts1
,ts2
;
1629 clock_gettime_mono(&ts1
);
1630 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1631 clock_gettime_mono(&ts2
);
1632 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1634 if (timediff
> audit_timeout
) {
1635 smb_time_audit_log_fsp("strict_lock", timediff
, fsp
);
1641 static void smb_time_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1642 struct files_struct
*fsp
,
1643 struct lock_struct
*plock
)
1645 struct timespec ts1
,ts2
;
1648 clock_gettime_mono(&ts1
);
1649 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1650 clock_gettime_mono(&ts2
);
1651 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1653 if (timediff
> audit_timeout
) {
1654 smb_time_audit_log_fsp("strict_unlock", timediff
, fsp
);
1658 static NTSTATUS
smb_time_audit_translate_name(struct vfs_handle_struct
*handle
,
1660 enum vfs_translate_direction direction
,
1661 TALLOC_CTX
*mem_ctx
,
1665 struct timespec ts1
,ts2
;
1668 clock_gettime_mono(&ts1
);
1669 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
1671 clock_gettime_mono(&ts2
);
1672 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1674 if (timediff
> audit_timeout
) {
1675 smb_time_audit_log_fname("translate_name", timediff
, name
);
1681 struct time_audit_cc_state
{
1682 struct timespec ts_send
;
1683 struct vfs_handle_struct
*handle
;
1686 static void smb_time_audit_copy_chunk_done(struct tevent_req
*subreq
);
1688 static struct tevent_req
*smb_time_audit_copy_chunk_send(struct vfs_handle_struct
*handle
,
1689 TALLOC_CTX
*mem_ctx
,
1690 struct tevent_context
*ev
,
1691 struct files_struct
*src_fsp
,
1693 struct files_struct
*dest_fsp
,
1697 struct tevent_req
*req
;
1698 struct tevent_req
*subreq
;
1699 struct time_audit_cc_state
*cc_state
;
1701 req
= tevent_req_create(mem_ctx
, &cc_state
, struct time_audit_cc_state
);
1706 cc_state
->handle
= handle
;
1707 clock_gettime_mono(&cc_state
->ts_send
);
1708 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
1710 dest_fsp
, dest_off
, num
);
1711 if (tevent_req_nomem(subreq
, req
)) {
1712 return tevent_req_post(req
, ev
);
1715 tevent_req_set_callback(subreq
, smb_time_audit_copy_chunk_done
, req
);
1719 static void smb_time_audit_copy_chunk_done(struct tevent_req
*subreq
)
1721 struct tevent_req
*req
= tevent_req_callback_data(
1722 subreq
, struct tevent_req
);
1723 struct time_audit_cc_state
*cc_state
1724 = tevent_req_data(req
, struct time_audit_cc_state
);
1727 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
1730 TALLOC_FREE(subreq
);
1731 if (tevent_req_nterror(req
, status
)) {
1734 tevent_req_done(req
);
1737 static NTSTATUS
smb_time_audit_copy_chunk_recv(struct vfs_handle_struct
*handle
,
1738 struct tevent_req
*req
,
1741 struct time_audit_cc_state
*cc_state
1742 = tevent_req_data(req
, struct time_audit_cc_state
);
1743 struct timespec ts_recv
;
1747 clock_gettime_mono(&ts_recv
);
1748 timediff
= nsec_time_diff(&ts_recv
, &cc_state
->ts_send
)*1.0e-9;
1749 if (timediff
> audit_timeout
) {
1750 smb_time_audit_log("copy_chunk", timediff
);
1753 *copied
= cc_state
->copied
;
1754 if (tevent_req_is_nterror(req
, &status
)) {
1755 tevent_req_received(req
);
1759 tevent_req_received(req
);
1760 return NT_STATUS_OK
;
1763 static NTSTATUS
smb_time_audit_get_compression(vfs_handle_struct
*handle
,
1764 TALLOC_CTX
*mem_ctx
,
1765 struct files_struct
*fsp
,
1766 struct smb_filename
*smb_fname
,
1767 uint16_t *_compression_fmt
)
1770 struct timespec ts1
,ts2
;
1773 clock_gettime_mono(&ts1
);
1774 result
= SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
1776 clock_gettime_mono(&ts2
);
1777 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1779 if (timediff
> audit_timeout
) {
1781 smb_time_audit_log_fsp("get_compression",
1784 smb_time_audit_log_smb_fname("get_compression",
1785 timediff
, smb_fname
);
1792 static NTSTATUS
smb_time_audit_set_compression(vfs_handle_struct
*handle
,
1793 TALLOC_CTX
*mem_ctx
,
1794 struct files_struct
*fsp
,
1795 uint16_t compression_fmt
)
1798 struct timespec ts1
,ts2
;
1801 clock_gettime_mono(&ts1
);
1802 result
= SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
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_fsp("set_compression", timediff
, fsp
);
1814 static NTSTATUS
smb_time_audit_readdir_attr(struct vfs_handle_struct
*handle
,
1815 const struct smb_filename
*fname
,
1816 TALLOC_CTX
*mem_ctx
,
1817 struct readdir_attr_data
**pattr_data
)
1820 struct timespec ts1
,ts2
;
1823 clock_gettime_mono(&ts1
);
1824 status
= SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
1825 clock_gettime_mono(&ts2
);
1826 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1828 if (timediff
> audit_timeout
) {
1829 smb_time_audit_log_smb_fname("readdir_attr", timediff
, fname
);
1835 static NTSTATUS
smb_time_audit_fget_nt_acl(vfs_handle_struct
*handle
,
1837 uint32 security_info
,
1838 TALLOC_CTX
*mem_ctx
,
1839 struct security_descriptor
**ppdesc
)
1842 struct timespec ts1
,ts2
;
1845 clock_gettime_mono(&ts1
);
1846 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
,
1848 clock_gettime_mono(&ts2
);
1849 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1851 if (timediff
> audit_timeout
) {
1852 smb_time_audit_log_fsp("fget_nt_acl", timediff
, fsp
);
1858 static NTSTATUS
smb_time_audit_get_nt_acl(vfs_handle_struct
*handle
,
1860 uint32 security_info
,
1861 TALLOC_CTX
*mem_ctx
,
1862 struct security_descriptor
**ppdesc
)
1865 struct timespec ts1
,ts2
;
1868 clock_gettime_mono(&ts1
);
1869 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
,
1871 clock_gettime_mono(&ts2
);
1872 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1874 if (timediff
> audit_timeout
) {
1875 smb_time_audit_log_fname("get_nt_acl", timediff
, name
);
1881 static NTSTATUS
smb_time_audit_fset_nt_acl(vfs_handle_struct
*handle
,
1883 uint32 security_info_sent
,
1884 const struct security_descriptor
*psd
)
1887 struct timespec ts1
,ts2
;
1890 clock_gettime_mono(&ts1
);
1891 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
,
1893 clock_gettime_mono(&ts2
);
1894 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1896 if (timediff
> audit_timeout
) {
1897 smb_time_audit_log_fsp("fset_nt_acl", timediff
, fsp
);
1903 static int smb_time_audit_chmod_acl(vfs_handle_struct
*handle
,
1904 const char *path
, mode_t mode
)
1907 struct timespec ts1
,ts2
;
1910 clock_gettime_mono(&ts1
);
1911 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1912 clock_gettime_mono(&ts2
);
1913 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1915 if (timediff
> audit_timeout
) {
1916 smb_time_audit_log_fname("chmod_acl", timediff
, path
);
1922 static int smb_time_audit_fchmod_acl(vfs_handle_struct
*handle
,
1923 files_struct
*fsp
, mode_t mode
)
1926 struct timespec ts1
,ts2
;
1929 clock_gettime_mono(&ts1
);
1930 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1931 clock_gettime_mono(&ts2
);
1932 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1934 if (timediff
> audit_timeout
) {
1935 smb_time_audit_log_fsp("fchmod_acl", timediff
, fsp
);
1941 static SMB_ACL_T
smb_time_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1943 SMB_ACL_TYPE_T type
,
1944 TALLOC_CTX
*mem_ctx
)
1947 struct timespec ts1
,ts2
;
1950 clock_gettime_mono(&ts1
);
1951 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
1952 clock_gettime_mono(&ts2
);
1953 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1955 if (timediff
> audit_timeout
) {
1956 smb_time_audit_log_fname("sys_acl_get_file", timediff
, path_p
);
1962 static SMB_ACL_T
smb_time_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
1964 TALLOC_CTX
*mem_ctx
)
1967 struct timespec ts1
,ts2
;
1970 clock_gettime_mono(&ts1
);
1971 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
1972 clock_gettime_mono(&ts2
);
1973 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1975 if (timediff
> audit_timeout
) {
1976 smb_time_audit_log_fsp("sys_acl_get_fd", timediff
, fsp
);
1983 static int smb_time_audit_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
1985 TALLOC_CTX
*mem_ctx
,
1986 char **blob_description
,
1990 struct timespec ts1
,ts2
;
1993 clock_gettime_mono(&ts1
);
1994 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
, blob_description
, blob
);
1995 clock_gettime_mono(&ts2
);
1996 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1998 if (timediff
> audit_timeout
) {
1999 smb_time_audit_log("sys_acl_blob_get_file", timediff
);
2005 static int smb_time_audit_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
2007 TALLOC_CTX
*mem_ctx
,
2008 char **blob_description
,
2012 struct timespec ts1
,ts2
;
2015 clock_gettime_mono(&ts1
);
2016 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
, blob_description
, blob
);
2017 clock_gettime_mono(&ts2
);
2018 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2020 if (timediff
> audit_timeout
) {
2021 smb_time_audit_log("sys_acl_blob_get_fd", timediff
);
2027 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
2029 SMB_ACL_TYPE_T acltype
,
2033 struct timespec ts1
,ts2
;
2036 clock_gettime_mono(&ts1
);
2037 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
2039 clock_gettime_mono(&ts2
);
2040 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2042 if (timediff
> audit_timeout
) {
2043 smb_time_audit_log_fname("sys_acl_set_file", timediff
, name
);
2049 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct
*handle
,
2054 struct timespec ts1
,ts2
;
2057 clock_gettime_mono(&ts1
);
2058 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
2059 clock_gettime_mono(&ts2
);
2060 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2062 if (timediff
> audit_timeout
) {
2063 smb_time_audit_log_fsp("sys_acl_set_fd", timediff
, fsp
);
2069 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
2073 struct timespec ts1
,ts2
;
2076 clock_gettime_mono(&ts1
);
2077 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
2078 clock_gettime_mono(&ts2
);
2079 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2081 if (timediff
> audit_timeout
) {
2082 smb_time_audit_log_fname("sys_acl_delete_def_file", timediff
, path
);
2088 static ssize_t
smb_time_audit_getxattr(struct vfs_handle_struct
*handle
,
2089 const char *path
, const char *name
,
2090 void *value
, size_t size
)
2093 struct timespec ts1
,ts2
;
2096 clock_gettime_mono(&ts1
);
2097 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
2098 clock_gettime_mono(&ts2
);
2099 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2101 if (timediff
> audit_timeout
) {
2102 smb_time_audit_log_fname("getxattr", timediff
, path
);
2108 static ssize_t
smb_time_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2109 struct files_struct
*fsp
,
2110 const char *name
, void *value
,
2114 struct timespec ts1
,ts2
;
2117 clock_gettime_mono(&ts1
);
2118 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2119 clock_gettime_mono(&ts2
);
2120 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2122 if (timediff
> audit_timeout
) {
2123 smb_time_audit_log_fsp("fgetxattr", timediff
, fsp
);
2129 static ssize_t
smb_time_audit_listxattr(struct vfs_handle_struct
*handle
,
2130 const char *path
, char *list
,
2134 struct timespec ts1
,ts2
;
2137 clock_gettime_mono(&ts1
);
2138 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
2139 clock_gettime_mono(&ts2
);
2140 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2142 if (timediff
> audit_timeout
) {
2143 smb_time_audit_log_fname("listxattr", timediff
, path
);
2149 static ssize_t
smb_time_audit_flistxattr(struct vfs_handle_struct
*handle
,
2150 struct files_struct
*fsp
, char *list
,
2154 struct timespec ts1
,ts2
;
2157 clock_gettime_mono(&ts1
);
2158 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
2159 clock_gettime_mono(&ts2
);
2160 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2162 if (timediff
> audit_timeout
) {
2163 smb_time_audit_log_fsp("flistxattr", timediff
, fsp
);
2169 static int smb_time_audit_removexattr(struct vfs_handle_struct
*handle
,
2170 const char *path
, const char *name
)
2173 struct timespec ts1
,ts2
;
2176 clock_gettime_mono(&ts1
);
2177 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2178 clock_gettime_mono(&ts2
);
2179 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2181 if (timediff
> audit_timeout
) {
2182 smb_time_audit_log_fname("removexattr", timediff
, path
);
2188 static int smb_time_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2189 struct files_struct
*fsp
,
2193 struct timespec ts1
,ts2
;
2196 clock_gettime_mono(&ts1
);
2197 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2198 clock_gettime_mono(&ts2
);
2199 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2201 if (timediff
> audit_timeout
) {
2202 smb_time_audit_log_fsp("fremovexattr", timediff
, fsp
);
2208 static int smb_time_audit_setxattr(struct vfs_handle_struct
*handle
,
2209 const char *path
, const char *name
,
2210 const void *value
, size_t size
,
2214 struct timespec ts1
,ts2
;
2217 clock_gettime_mono(&ts1
);
2218 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
2220 clock_gettime_mono(&ts2
);
2221 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2223 if (timediff
> audit_timeout
) {
2224 smb_time_audit_log_fname("setxattr", timediff
, path
);
2230 static int smb_time_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2231 struct files_struct
*fsp
, const char *name
,
2232 const void *value
, size_t size
, int flags
)
2235 struct timespec ts1
,ts2
;
2238 clock_gettime_mono(&ts1
);
2239 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2240 clock_gettime_mono(&ts2
);
2241 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2243 if (timediff
> audit_timeout
) {
2244 smb_time_audit_log_fsp("fsetxattr", timediff
, fsp
);
2250 static bool smb_time_audit_aio_force(struct vfs_handle_struct
*handle
,
2251 struct files_struct
*fsp
)
2254 struct timespec ts1
,ts2
;
2257 clock_gettime_mono(&ts1
);
2258 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2259 clock_gettime_mono(&ts2
);
2260 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2262 if (timediff
> audit_timeout
) {
2263 smb_time_audit_log_fsp("aio_force", timediff
, fsp
);
2269 static bool smb_time_audit_is_offline(struct vfs_handle_struct
*handle
,
2270 const struct smb_filename
*fname
,
2271 SMB_STRUCT_STAT
*sbuf
)
2274 struct timespec ts1
,ts2
;
2277 clock_gettime_mono(&ts1
);
2278 result
= SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
2279 clock_gettime_mono(&ts2
);
2280 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2282 if (timediff
> audit_timeout
) {
2283 smb_time_audit_log_smb_fname("is_offline", timediff
, fname
);
2289 static int smb_time_audit_set_offline(struct vfs_handle_struct
*handle
,
2290 const struct smb_filename
*fname
)
2293 struct timespec ts1
,ts2
;
2296 clock_gettime_mono(&ts1
);
2297 result
= SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
2298 clock_gettime_mono(&ts2
);
2299 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2301 if (timediff
> audit_timeout
) {
2302 smb_time_audit_log_smb_fname("set_offline", timediff
, fname
);
2308 static NTSTATUS
smb_time_audit_durable_cookie(struct vfs_handle_struct
*handle
,
2309 struct files_struct
*fsp
,
2310 TALLOC_CTX
*mem_ctx
,
2314 struct timespec ts1
,ts2
;
2317 clock_gettime_mono(&ts1
);
2318 result
= SMB_VFS_NEXT_DURABLE_COOKIE(handle
, fsp
, mem_ctx
, cookie
);
2319 clock_gettime_mono(&ts2
);
2320 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2322 if (timediff
> audit_timeout
) {
2323 smb_time_audit_log_fsp("durable_cookie", timediff
, fsp
);
2329 static NTSTATUS
smb_time_audit_durable_disconnect(struct vfs_handle_struct
*handle
,
2330 struct files_struct
*fsp
,
2331 const DATA_BLOB old_cookie
,
2332 TALLOC_CTX
*mem_ctx
,
2333 DATA_BLOB
*new_cookie
)
2336 struct timespec ts1
,ts2
;
2339 clock_gettime_mono(&ts1
);
2340 result
= SMB_VFS_NEXT_DURABLE_DISCONNECT(handle
, fsp
, old_cookie
,
2341 mem_ctx
, new_cookie
);
2342 clock_gettime_mono(&ts2
);
2343 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2345 if (timediff
> audit_timeout
) {
2346 smb_time_audit_log_fsp("durable_disconnect", timediff
, fsp
);
2352 static NTSTATUS
smb_time_audit_durable_reconnect(struct vfs_handle_struct
*handle
,
2353 struct smb_request
*smb1req
,
2354 struct smbXsrv_open
*op
,
2355 const DATA_BLOB old_cookie
,
2356 TALLOC_CTX
*mem_ctx
,
2357 struct files_struct
**fsp
,
2358 DATA_BLOB
*new_cookie
)
2361 struct timespec ts1
,ts2
;
2364 clock_gettime_mono(&ts1
);
2365 result
= SMB_VFS_NEXT_DURABLE_RECONNECT(handle
, smb1req
, op
, old_cookie
,
2366 mem_ctx
, fsp
, new_cookie
);
2367 clock_gettime_mono(&ts2
);
2368 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2370 if (timediff
> audit_timeout
) {
2371 smb_time_audit_log("durable_reconnect", timediff
);
2377 /* VFS operations */
2379 static struct vfs_fn_pointers vfs_time_audit_fns
= {
2380 .connect_fn
= smb_time_audit_connect
,
2381 .disconnect_fn
= smb_time_audit_disconnect
,
2382 .disk_free_fn
= smb_time_audit_disk_free
,
2383 .get_quota_fn
= smb_time_audit_get_quota
,
2384 .set_quota_fn
= smb_time_audit_set_quota
,
2385 .get_shadow_copy_data_fn
= smb_time_audit_get_shadow_copy_data
,
2386 .statvfs_fn
= smb_time_audit_statvfs
,
2387 .fs_capabilities_fn
= smb_time_audit_fs_capabilities
,
2388 .opendir_fn
= smb_time_audit_opendir
,
2389 .fdopendir_fn
= smb_time_audit_fdopendir
,
2390 .readdir_fn
= smb_time_audit_readdir
,
2391 .seekdir_fn
= smb_time_audit_seekdir
,
2392 .telldir_fn
= smb_time_audit_telldir
,
2393 .rewind_dir_fn
= smb_time_audit_rewinddir
,
2394 .mkdir_fn
= smb_time_audit_mkdir
,
2395 .rmdir_fn
= smb_time_audit_rmdir
,
2396 .closedir_fn
= smb_time_audit_closedir
,
2397 .init_search_op_fn
= smb_time_audit_init_search_op
,
2398 .open_fn
= smb_time_audit_open
,
2399 .create_file_fn
= smb_time_audit_create_file
,
2400 .close_fn
= smb_time_audit_close
,
2401 .read_fn
= smb_time_audit_read
,
2402 .pread_fn
= smb_time_audit_pread
,
2403 .pread_send_fn
= smb_time_audit_pread_send
,
2404 .pread_recv_fn
= smb_time_audit_pread_recv
,
2405 .write_fn
= smb_time_audit_write
,
2406 .pwrite_fn
= smb_time_audit_pwrite
,
2407 .pwrite_send_fn
= smb_time_audit_pwrite_send
,
2408 .pwrite_recv_fn
= smb_time_audit_pwrite_recv
,
2409 .lseek_fn
= smb_time_audit_lseek
,
2410 .sendfile_fn
= smb_time_audit_sendfile
,
2411 .recvfile_fn
= smb_time_audit_recvfile
,
2412 .rename_fn
= smb_time_audit_rename
,
2413 .fsync_fn
= smb_time_audit_fsync
,
2414 .fsync_send_fn
= smb_time_audit_fsync_send
,
2415 .fsync_recv_fn
= smb_time_audit_fsync_recv
,
2416 .stat_fn
= smb_time_audit_stat
,
2417 .fstat_fn
= smb_time_audit_fstat
,
2418 .lstat_fn
= smb_time_audit_lstat
,
2419 .get_alloc_size_fn
= smb_time_audit_get_alloc_size
,
2420 .unlink_fn
= smb_time_audit_unlink
,
2421 .chmod_fn
= smb_time_audit_chmod
,
2422 .fchmod_fn
= smb_time_audit_fchmod
,
2423 .chown_fn
= smb_time_audit_chown
,
2424 .fchown_fn
= smb_time_audit_fchown
,
2425 .lchown_fn
= smb_time_audit_lchown
,
2426 .chdir_fn
= smb_time_audit_chdir
,
2427 .getwd_fn
= smb_time_audit_getwd
,
2428 .ntimes_fn
= smb_time_audit_ntimes
,
2429 .ftruncate_fn
= smb_time_audit_ftruncate
,
2430 .fallocate_fn
= smb_time_audit_fallocate
,
2431 .lock_fn
= smb_time_audit_lock
,
2432 .kernel_flock_fn
= smb_time_audit_kernel_flock
,
2433 .linux_setlease_fn
= smb_time_audit_linux_setlease
,
2434 .getlock_fn
= smb_time_audit_getlock
,
2435 .symlink_fn
= smb_time_audit_symlink
,
2436 .readlink_fn
= smb_time_audit_readlink
,
2437 .link_fn
= smb_time_audit_link
,
2438 .mknod_fn
= smb_time_audit_mknod
,
2439 .realpath_fn
= smb_time_audit_realpath
,
2440 .notify_watch_fn
= smb_time_audit_notify_watch
,
2441 .chflags_fn
= smb_time_audit_chflags
,
2442 .file_id_create_fn
= smb_time_audit_file_id_create
,
2443 .streaminfo_fn
= smb_time_audit_streaminfo
,
2444 .get_real_filename_fn
= smb_time_audit_get_real_filename
,
2445 .connectpath_fn
= smb_time_audit_connectpath
,
2446 .brl_lock_windows_fn
= smb_time_audit_brl_lock_windows
,
2447 .brl_unlock_windows_fn
= smb_time_audit_brl_unlock_windows
,
2448 .brl_cancel_windows_fn
= smb_time_audit_brl_cancel_windows
,
2449 .strict_lock_fn
= smb_time_audit_strict_lock
,
2450 .strict_unlock_fn
= smb_time_audit_strict_unlock
,
2451 .translate_name_fn
= smb_time_audit_translate_name
,
2452 .copy_chunk_send_fn
= smb_time_audit_copy_chunk_send
,
2453 .copy_chunk_recv_fn
= smb_time_audit_copy_chunk_recv
,
2454 .get_compression_fn
= smb_time_audit_get_compression
,
2455 .set_compression_fn
= smb_time_audit_set_compression
,
2456 .readdir_attr_fn
= smb_time_audit_readdir_attr
,
2457 .fget_nt_acl_fn
= smb_time_audit_fget_nt_acl
,
2458 .get_nt_acl_fn
= smb_time_audit_get_nt_acl
,
2459 .fset_nt_acl_fn
= smb_time_audit_fset_nt_acl
,
2460 .chmod_acl_fn
= smb_time_audit_chmod_acl
,
2461 .fchmod_acl_fn
= smb_time_audit_fchmod_acl
,
2462 .sys_acl_get_file_fn
= smb_time_audit_sys_acl_get_file
,
2463 .sys_acl_get_fd_fn
= smb_time_audit_sys_acl_get_fd
,
2464 .sys_acl_blob_get_file_fn
= smb_time_audit_sys_acl_blob_get_file
,
2465 .sys_acl_blob_get_fd_fn
= smb_time_audit_sys_acl_blob_get_fd
,
2466 .sys_acl_set_file_fn
= smb_time_audit_sys_acl_set_file
,
2467 .sys_acl_set_fd_fn
= smb_time_audit_sys_acl_set_fd
,
2468 .sys_acl_delete_def_file_fn
= smb_time_audit_sys_acl_delete_def_file
,
2469 .getxattr_fn
= smb_time_audit_getxattr
,
2470 .fgetxattr_fn
= smb_time_audit_fgetxattr
,
2471 .listxattr_fn
= smb_time_audit_listxattr
,
2472 .flistxattr_fn
= smb_time_audit_flistxattr
,
2473 .removexattr_fn
= smb_time_audit_removexattr
,
2474 .fremovexattr_fn
= smb_time_audit_fremovexattr
,
2475 .setxattr_fn
= smb_time_audit_setxattr
,
2476 .fsetxattr_fn
= smb_time_audit_fsetxattr
,
2477 .aio_force_fn
= smb_time_audit_aio_force
,
2478 .is_offline_fn
= smb_time_audit_is_offline
,
2479 .set_offline_fn
= smb_time_audit_set_offline
,
2480 .durable_cookie_fn
= smb_time_audit_durable_cookie
,
2481 .durable_disconnect_fn
= smb_time_audit_durable_disconnect
,
2482 .durable_reconnect_fn
= smb_time_audit_durable_reconnect
,
2486 NTSTATUS
vfs_time_audit_init(void);
2487 NTSTATUS
vfs_time_audit_init(void)
2489 audit_timeout
= (double)lp_parm_int(-1, "time_audit", "timeout",
2491 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "time_audit",
2492 &vfs_time_audit_fns
);