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
,
160 const char *path
, uint64_t *bsize
,
161 uint64_t *dfree
, uint64_t *dsize
)
164 struct timespec ts1
,ts2
;
167 clock_gettime_mono(&ts1
);
168 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, bsize
, dfree
, dsize
);
169 clock_gettime_mono(&ts2
);
170 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
172 /* Don't have a reasonable notion of failure here */
173 if (timediff
> audit_timeout
) {
174 smb_time_audit_log_fname("disk_free", timediff
, path
);
180 static int smb_time_audit_get_quota(struct vfs_handle_struct
*handle
,
181 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
185 struct timespec ts1
,ts2
;
188 clock_gettime_mono(&ts1
);
189 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
190 clock_gettime_mono(&ts2
);
191 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
193 if (timediff
> audit_timeout
) {
194 smb_time_audit_log("get_quota", timediff
);
199 static int smb_time_audit_set_quota(struct vfs_handle_struct
*handle
,
200 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
204 struct timespec ts1
,ts2
;
207 clock_gettime_mono(&ts1
);
208 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
209 clock_gettime_mono(&ts2
);
210 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
212 if (timediff
> audit_timeout
) {
213 smb_time_audit_log("set_quota", timediff
);
219 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
220 struct files_struct
*fsp
,
221 struct shadow_copy_data
*shadow_copy_data
,
225 struct timespec ts1
,ts2
;
228 clock_gettime_mono(&ts1
);
229 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
,
230 shadow_copy_data
, labels
);
231 clock_gettime_mono(&ts2
);
232 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
234 if (timediff
> audit_timeout
) {
235 smb_time_audit_log_fsp("get_shadow_copy_data", timediff
, fsp
);
241 static int smb_time_audit_statvfs(struct vfs_handle_struct
*handle
,
243 struct vfs_statvfs_struct
*statbuf
)
246 struct timespec ts1
,ts2
;
249 clock_gettime_mono(&ts1
);
250 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
251 clock_gettime_mono(&ts2
);
252 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
254 if (timediff
> audit_timeout
) {
255 smb_time_audit_log_fname("statvfs", timediff
, path
);
261 static uint32_t smb_time_audit_fs_capabilities(struct vfs_handle_struct
*handle
,
262 enum timestamp_set_resolution
*p_ts_res
)
265 struct timespec ts1
,ts2
;
268 clock_gettime_mono(&ts1
);
269 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
270 clock_gettime_mono(&ts2
);
271 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
273 if (timediff
> audit_timeout
) {
274 smb_time_audit_log("fs_capabilities", timediff
);
280 static NTSTATUS
smb_time_audit_snap_check_path(struct vfs_handle_struct
*handle
,
282 const char *service_path
,
286 struct timespec ts1
,ts2
;
289 clock_gettime_mono(&ts1
);
290 status
= SMB_VFS_NEXT_SNAP_CHECK_PATH(handle
, mem_ctx
, service_path
,
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("snap_check_path", timediff
);
302 static NTSTATUS
smb_time_audit_snap_create(struct vfs_handle_struct
*handle
,
304 const char *base_volume
,
311 struct timespec ts1
,ts2
;
314 clock_gettime_mono(&ts1
);
315 status
= SMB_VFS_NEXT_SNAP_CREATE(handle
, mem_ctx
, base_volume
, tstamp
,
316 rw
, base_path
, snap_path
);
317 clock_gettime_mono(&ts2
);
318 timediff
= nsec_time_diff(&ts2
,&ts1
) * 1.0e-9;
320 if (timediff
> audit_timeout
) {
321 smb_time_audit_log("snap_create", timediff
);
327 static NTSTATUS
smb_time_audit_snap_delete(struct vfs_handle_struct
*handle
,
333 struct timespec ts1
,ts2
;
336 clock_gettime_mono(&ts1
);
337 status
= SMB_VFS_NEXT_SNAP_DELETE(handle
, mem_ctx
, base_path
,
339 clock_gettime_mono(&ts2
);
340 timediff
= nsec_time_diff(&ts2
, &ts1
) * 1.0e-9;
342 if (timediff
> audit_timeout
) {
343 smb_time_audit_log("snap_delete", timediff
);
349 static DIR *smb_time_audit_opendir(vfs_handle_struct
*handle
,
351 const char *mask
, uint32_t attr
)
354 struct timespec ts1
,ts2
;
357 clock_gettime_mono(&ts1
);
358 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
359 clock_gettime_mono(&ts2
);
360 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
362 if (timediff
> audit_timeout
) {
363 smb_time_audit_log_fname("opendir", timediff
, fname
);
369 static DIR *smb_time_audit_fdopendir(vfs_handle_struct
*handle
,
371 const char *mask
, uint32_t attr
)
374 struct timespec ts1
,ts2
;
377 clock_gettime_mono(&ts1
);
378 result
= SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
379 clock_gettime_mono(&ts2
);
380 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
382 if (timediff
> audit_timeout
) {
383 smb_time_audit_log_fsp("fdopendir", timediff
, fsp
);
389 static struct dirent
*smb_time_audit_readdir(vfs_handle_struct
*handle
,
391 SMB_STRUCT_STAT
*sbuf
)
393 struct dirent
*result
;
394 struct timespec ts1
,ts2
;
397 clock_gettime_mono(&ts1
);
398 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
399 clock_gettime_mono(&ts2
);
400 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
402 if (timediff
> audit_timeout
) {
403 smb_time_audit_log("readdir", timediff
);
409 static void smb_time_audit_seekdir(vfs_handle_struct
*handle
,
410 DIR *dirp
, long offset
)
412 struct timespec ts1
,ts2
;
415 clock_gettime_mono(&ts1
);
416 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
417 clock_gettime_mono(&ts2
);
418 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
420 if (timediff
> audit_timeout
) {
421 smb_time_audit_log("seekdir", timediff
);
426 static long smb_time_audit_telldir(vfs_handle_struct
*handle
,
430 struct timespec ts1
,ts2
;
433 clock_gettime_mono(&ts1
);
434 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
435 clock_gettime_mono(&ts2
);
436 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
438 if (timediff
> audit_timeout
) {
439 smb_time_audit_log("telldir", timediff
);
445 static void smb_time_audit_rewinddir(vfs_handle_struct
*handle
,
448 struct timespec ts1
,ts2
;
451 clock_gettime_mono(&ts1
);
452 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
453 clock_gettime_mono(&ts2
);
454 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
456 if (timediff
> audit_timeout
) {
457 smb_time_audit_log("rewinddir", timediff
);
462 static int smb_time_audit_mkdir(vfs_handle_struct
*handle
,
463 const char *path
, mode_t mode
)
466 struct timespec ts1
,ts2
;
469 clock_gettime_mono(&ts1
);
470 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
471 clock_gettime_mono(&ts2
);
472 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
474 if (timediff
> audit_timeout
) {
475 smb_time_audit_log_fname("mkdir", timediff
, path
);
481 static int smb_time_audit_rmdir(vfs_handle_struct
*handle
,
485 struct timespec ts1
,ts2
;
488 clock_gettime_mono(&ts1
);
489 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
490 clock_gettime_mono(&ts2
);
491 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
493 if (timediff
> audit_timeout
) {
494 smb_time_audit_log_fname("rmdir", timediff
, path
);
500 static int smb_time_audit_closedir(vfs_handle_struct
*handle
,
504 struct timespec ts1
,ts2
;
507 clock_gettime_mono(&ts1
);
508 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
509 clock_gettime_mono(&ts2
);
510 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
512 if (timediff
> audit_timeout
) {
513 smb_time_audit_log("closedir", timediff
);
519 static void smb_time_audit_init_search_op(vfs_handle_struct
*handle
,
522 struct timespec ts1
,ts2
;
525 clock_gettime_mono(&ts1
);
526 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
527 clock_gettime_mono(&ts2
);
528 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
530 if (timediff
> audit_timeout
) {
531 smb_time_audit_log("init_search_op", timediff
);
535 static int smb_time_audit_open(vfs_handle_struct
*handle
,
536 struct smb_filename
*fname
,
538 int flags
, mode_t mode
)
541 struct timespec ts1
,ts2
;
544 clock_gettime_mono(&ts1
);
545 result
= SMB_VFS_NEXT_OPEN(handle
, fname
, fsp
, flags
, mode
);
546 clock_gettime_mono(&ts2
);
547 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
549 if (timediff
> audit_timeout
) {
550 smb_time_audit_log_fsp("open", timediff
, fsp
);
556 static NTSTATUS
smb_time_audit_create_file(vfs_handle_struct
*handle
,
557 struct smb_request
*req
,
558 uint16_t root_dir_fid
,
559 struct smb_filename
*fname
,
560 uint32_t access_mask
,
561 uint32_t share_access
,
562 uint32_t create_disposition
,
563 uint32_t create_options
,
564 uint32_t file_attributes
,
565 uint32_t oplock_request
,
566 struct smb2_lease
*lease
,
567 uint64_t allocation_size
,
568 uint32_t private_flags
,
569 struct security_descriptor
*sd
,
570 struct ea_list
*ea_list
,
571 files_struct
**result_fsp
,
573 const struct smb2_create_blobs
*in_context_blobs
,
574 struct smb2_create_blobs
*out_context_blobs
)
577 struct timespec ts1
,ts2
;
580 clock_gettime_mono(&ts1
);
581 result
= SMB_VFS_NEXT_CREATE_FILE(
584 root_dir_fid
, /* root_dir_fid */
586 access_mask
, /* access_mask */
587 share_access
, /* share_access */
588 create_disposition
, /* create_disposition*/
589 create_options
, /* create_options */
590 file_attributes
, /* file_attributes */
591 oplock_request
, /* oplock_request */
593 allocation_size
, /* allocation_size */
596 ea_list
, /* ea_list */
597 result_fsp
, /* result */
599 in_context_blobs
, out_context_blobs
); /* create context */
600 clock_gettime_mono(&ts2
);
601 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
603 if (timediff
> audit_timeout
) {
605 * can't use result_fsp this time, may have
606 * invalid content causing smbd crash
608 smb_time_audit_log_smb_fname("create_file", timediff
,
615 static int smb_time_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
618 struct timespec ts1
,ts2
;
621 clock_gettime_mono(&ts1
);
622 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
623 clock_gettime_mono(&ts2
);
624 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
626 if (timediff
> audit_timeout
) {
627 smb_time_audit_log_fsp("close", timediff
, fsp
);
633 static ssize_t
smb_time_audit_read(vfs_handle_struct
*handle
,
634 files_struct
*fsp
, void *data
, size_t n
)
637 struct timespec ts1
,ts2
;
640 clock_gettime_mono(&ts1
);
641 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
642 clock_gettime_mono(&ts2
);
643 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
645 if (timediff
> audit_timeout
) {
646 smb_time_audit_log_fsp("read", timediff
, fsp
);
652 static ssize_t
smb_time_audit_pread(vfs_handle_struct
*handle
,
654 void *data
, size_t n
, off_t offset
)
657 struct timespec ts1
,ts2
;
660 clock_gettime_mono(&ts1
);
661 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
662 clock_gettime_mono(&ts2
);
663 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
665 if (timediff
> audit_timeout
) {
666 smb_time_audit_log_fsp("pread", timediff
, fsp
);
672 struct smb_time_audit_pread_state
{
673 struct files_struct
*fsp
;
679 static void smb_time_audit_pread_done(struct tevent_req
*subreq
);
681 static struct tevent_req
*smb_time_audit_pread_send(
682 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
683 struct tevent_context
*ev
, struct files_struct
*fsp
,
684 void *data
, size_t n
, off_t offset
)
686 struct tevent_req
*req
, *subreq
;
687 struct smb_time_audit_pread_state
*state
;
689 req
= tevent_req_create(mem_ctx
, &state
,
690 struct smb_time_audit_pread_state
);
694 clock_gettime_mono(&state
->ts1
);
697 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
699 if (tevent_req_nomem(subreq
, req
)) {
700 return tevent_req_post(req
, ev
);
702 tevent_req_set_callback(subreq
, smb_time_audit_pread_done
, req
);
706 static void smb_time_audit_pread_done(struct tevent_req
*subreq
)
708 struct tevent_req
*req
= tevent_req_callback_data(
709 subreq
, struct tevent_req
);
710 struct smb_time_audit_pread_state
*state
= tevent_req_data(
711 req
, struct smb_time_audit_pread_state
);
713 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
715 tevent_req_done(req
);
718 static ssize_t
smb_time_audit_pread_recv(struct tevent_req
*req
, int *err
)
720 struct smb_time_audit_pread_state
*state
= tevent_req_data(
721 req
, struct smb_time_audit_pread_state
);
725 clock_gettime_mono(&ts2
);
726 timediff
= nsec_time_diff(&ts2
,&state
->ts1
)*1.0e-9;
728 if (timediff
> audit_timeout
) {
729 smb_time_audit_log_fsp("pread", timediff
, state
->fsp
);
732 if (tevent_req_is_unix_error(req
, err
)) {
739 static ssize_t
smb_time_audit_write(vfs_handle_struct
*handle
,
741 const void *data
, size_t n
)
744 struct timespec ts1
,ts2
;
747 clock_gettime_mono(&ts1
);
748 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
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_fsp("write", timediff
, fsp
);
759 static ssize_t
smb_time_audit_pwrite(vfs_handle_struct
*handle
,
761 const void *data
, size_t n
,
765 struct timespec ts1
,ts2
;
768 clock_gettime_mono(&ts1
);
769 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
770 clock_gettime_mono(&ts2
);
771 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
773 if (timediff
> audit_timeout
) {
774 smb_time_audit_log_fsp("pwrite", timediff
, fsp
);
780 struct smb_time_audit_pwrite_state
{
781 struct files_struct
*fsp
;
787 static void smb_time_audit_pwrite_done(struct tevent_req
*subreq
);
789 static struct tevent_req
*smb_time_audit_pwrite_send(
790 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
791 struct tevent_context
*ev
, struct files_struct
*fsp
,
792 const void *data
, size_t n
, off_t offset
)
794 struct tevent_req
*req
, *subreq
;
795 struct smb_time_audit_pwrite_state
*state
;
797 req
= tevent_req_create(mem_ctx
, &state
,
798 struct smb_time_audit_pwrite_state
);
802 clock_gettime_mono(&state
->ts1
);
805 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
807 if (tevent_req_nomem(subreq
, req
)) {
808 return tevent_req_post(req
, ev
);
810 tevent_req_set_callback(subreq
, smb_time_audit_pwrite_done
, req
);
814 static void smb_time_audit_pwrite_done(struct tevent_req
*subreq
)
816 struct tevent_req
*req
= tevent_req_callback_data(
817 subreq
, struct tevent_req
);
818 struct smb_time_audit_pwrite_state
*state
= tevent_req_data(
819 req
, struct smb_time_audit_pwrite_state
);
821 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
823 tevent_req_done(req
);
826 static ssize_t
smb_time_audit_pwrite_recv(struct tevent_req
*req
, int *err
)
828 struct smb_time_audit_pwrite_state
*state
= tevent_req_data(
829 req
, struct smb_time_audit_pwrite_state
);
833 clock_gettime_mono(&ts2
);
834 timediff
= nsec_time_diff(&ts2
,&state
->ts1
)*1.0e-9;
836 if (timediff
> audit_timeout
) {
837 smb_time_audit_log_fsp("pwrite", timediff
, state
->fsp
);
840 if (tevent_req_is_unix_error(req
, err
)) {
847 static off_t
smb_time_audit_lseek(vfs_handle_struct
*handle
,
849 off_t offset
, int whence
)
852 struct timespec ts1
,ts2
;
855 clock_gettime_mono(&ts1
);
856 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
857 clock_gettime_mono(&ts2
);
858 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
860 if (timediff
> audit_timeout
) {
861 smb_time_audit_log_fsp("lseek", timediff
, fsp
);
867 static ssize_t
smb_time_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
868 files_struct
*fromfsp
,
869 const DATA_BLOB
*hdr
, off_t offset
,
873 struct timespec ts1
,ts2
;
876 clock_gettime_mono(&ts1
);
877 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
878 clock_gettime_mono(&ts2
);
879 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
881 if (timediff
> audit_timeout
) {
882 smb_time_audit_log_fsp("sendfile", timediff
, fromfsp
);
888 static ssize_t
smb_time_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
894 struct timespec ts1
,ts2
;
897 clock_gettime_mono(&ts1
);
898 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
899 clock_gettime_mono(&ts2
);
900 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
902 if (timediff
> audit_timeout
) {
903 smb_time_audit_log_fsp("recvfile", timediff
, tofsp
);
909 static int smb_time_audit_rename(vfs_handle_struct
*handle
,
910 const struct smb_filename
*oldname
,
911 const struct smb_filename
*newname
)
914 struct timespec ts1
,ts2
;
917 clock_gettime_mono(&ts1
);
918 result
= SMB_VFS_NEXT_RENAME(handle
, oldname
, newname
);
919 clock_gettime_mono(&ts2
);
920 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
922 if (timediff
> audit_timeout
) {
923 smb_time_audit_log_smb_fname("rename", timediff
, newname
);
929 static int smb_time_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
932 struct timespec ts1
,ts2
;
935 clock_gettime_mono(&ts1
);
936 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
937 clock_gettime_mono(&ts2
);
938 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
940 if (timediff
> audit_timeout
) {
941 smb_time_audit_log_fsp("fsync", timediff
, fsp
);
947 struct smb_time_audit_fsync_state
{
948 struct files_struct
*fsp
;
954 static void smb_time_audit_fsync_done(struct tevent_req
*subreq
);
956 static struct tevent_req
*smb_time_audit_fsync_send(
957 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
958 struct tevent_context
*ev
, struct files_struct
*fsp
)
960 struct tevent_req
*req
, *subreq
;
961 struct smb_time_audit_fsync_state
*state
;
963 req
= tevent_req_create(mem_ctx
, &state
,
964 struct smb_time_audit_fsync_state
);
968 clock_gettime_mono(&state
->ts1
);
971 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
972 if (tevent_req_nomem(subreq
, req
)) {
973 return tevent_req_post(req
, ev
);
975 tevent_req_set_callback(subreq
, smb_time_audit_fsync_done
, req
);
979 static void smb_time_audit_fsync_done(struct tevent_req
*subreq
)
981 struct tevent_req
*req
= tevent_req_callback_data(
982 subreq
, struct tevent_req
);
983 struct smb_time_audit_fsync_state
*state
= tevent_req_data(
984 req
, struct smb_time_audit_fsync_state
);
986 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
988 tevent_req_done(req
);
991 static int smb_time_audit_fsync_recv(struct tevent_req
*req
, int *err
)
993 struct smb_time_audit_fsync_state
*state
= tevent_req_data(
994 req
, struct smb_time_audit_fsync_state
);
998 clock_gettime_mono(&ts2
);
999 timediff
= nsec_time_diff(&ts2
,&state
->ts1
)*1.0e-9;
1001 if (timediff
> audit_timeout
) {
1002 smb_time_audit_log_fsp("fsync", timediff
, state
->fsp
);
1005 if (tevent_req_is_unix_error(req
, err
)) {
1012 static int smb_time_audit_stat(vfs_handle_struct
*handle
,
1013 struct smb_filename
*fname
)
1016 struct timespec ts1
,ts2
;
1019 clock_gettime_mono(&ts1
);
1020 result
= SMB_VFS_NEXT_STAT(handle
, fname
);
1021 clock_gettime_mono(&ts2
);
1022 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1024 if (timediff
> audit_timeout
) {
1025 smb_time_audit_log_smb_fname("stat", timediff
, fname
);
1031 static int smb_time_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1032 SMB_STRUCT_STAT
*sbuf
)
1035 struct timespec ts1
,ts2
;
1038 clock_gettime_mono(&ts1
);
1039 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1040 clock_gettime_mono(&ts2
);
1041 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1043 if (timediff
> audit_timeout
) {
1044 smb_time_audit_log_fsp("fstat", timediff
, fsp
);
1050 static int smb_time_audit_lstat(vfs_handle_struct
*handle
,
1051 struct smb_filename
*path
)
1054 struct timespec ts1
,ts2
;
1057 clock_gettime_mono(&ts1
);
1058 result
= SMB_VFS_NEXT_LSTAT(handle
, path
);
1059 clock_gettime_mono(&ts2
);
1060 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1062 if (timediff
> audit_timeout
) {
1063 smb_time_audit_log_smb_fname("lstat", timediff
, path
);
1069 static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct
*handle
,
1071 const SMB_STRUCT_STAT
*sbuf
)
1074 struct timespec ts1
,ts2
;
1077 clock_gettime_mono(&ts1
);
1078 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1079 clock_gettime_mono(&ts2
);
1080 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1082 if (timediff
> audit_timeout
) {
1083 smb_time_audit_log_fsp("get_alloc_size", timediff
, fsp
);
1089 static int smb_time_audit_unlink(vfs_handle_struct
*handle
,
1090 const struct smb_filename
*path
)
1093 struct timespec ts1
,ts2
;
1096 clock_gettime_mono(&ts1
);
1097 result
= SMB_VFS_NEXT_UNLINK(handle
, path
);
1098 clock_gettime_mono(&ts2
);
1099 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1101 if (timediff
> audit_timeout
) {
1102 smb_time_audit_log_smb_fname("unlink", timediff
, path
);
1108 static int smb_time_audit_chmod(vfs_handle_struct
*handle
,
1109 const char *path
, mode_t mode
)
1112 struct timespec ts1
,ts2
;
1115 clock_gettime_mono(&ts1
);
1116 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1117 clock_gettime_mono(&ts2
);
1118 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1120 if (timediff
> audit_timeout
) {
1121 smb_time_audit_log_fname("chmod", timediff
, path
);
1127 static int smb_time_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1131 struct timespec ts1
,ts2
;
1134 clock_gettime_mono(&ts1
);
1135 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1136 clock_gettime_mono(&ts2
);
1137 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1139 if (timediff
> audit_timeout
) {
1140 smb_time_audit_log_fsp("fchmod", timediff
, fsp
);
1146 static int smb_time_audit_chown(vfs_handle_struct
*handle
,
1147 const char *path
, uid_t uid
, gid_t gid
)
1150 struct timespec ts1
,ts2
;
1153 clock_gettime_mono(&ts1
);
1154 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1155 clock_gettime_mono(&ts2
);
1156 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1158 if (timediff
> audit_timeout
) {
1159 smb_time_audit_log_fname("chown", timediff
, path
);
1165 static int smb_time_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1166 uid_t uid
, gid_t gid
)
1169 struct timespec ts1
,ts2
;
1172 clock_gettime_mono(&ts1
);
1173 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1174 clock_gettime_mono(&ts2
);
1175 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1177 if (timediff
> audit_timeout
) {
1178 smb_time_audit_log_fsp("fchown", timediff
, fsp
);
1184 static int smb_time_audit_lchown(vfs_handle_struct
*handle
,
1185 const char *path
, uid_t uid
, gid_t gid
)
1188 struct timespec ts1
,ts2
;
1191 clock_gettime_mono(&ts1
);
1192 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1193 clock_gettime_mono(&ts2
);
1194 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1196 if (timediff
> audit_timeout
) {
1197 smb_time_audit_log_fname("lchown", timediff
, path
);
1203 static int smb_time_audit_chdir(vfs_handle_struct
*handle
, const char *path
)
1206 struct timespec ts1
,ts2
;
1209 clock_gettime_mono(&ts1
);
1210 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
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_fname("chdir", timediff
, path
);
1221 static char *smb_time_audit_getwd(vfs_handle_struct
*handle
)
1224 struct timespec ts1
,ts2
;
1227 clock_gettime_mono(&ts1
);
1228 result
= SMB_VFS_NEXT_GETWD(handle
);
1229 clock_gettime_mono(&ts2
);
1230 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1232 if (timediff
> audit_timeout
) {
1233 smb_time_audit_log("getwd", timediff
);
1239 static int smb_time_audit_ntimes(vfs_handle_struct
*handle
,
1240 const struct smb_filename
*path
,
1241 struct smb_file_time
*ft
)
1244 struct timespec ts1
,ts2
;
1247 clock_gettime_mono(&ts1
);
1248 result
= SMB_VFS_NEXT_NTIMES(handle
, path
, ft
);
1249 clock_gettime_mono(&ts2
);
1250 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1252 if (timediff
> audit_timeout
) {
1253 smb_time_audit_log_smb_fname("ntimes", timediff
, path
);
1259 static int smb_time_audit_ftruncate(vfs_handle_struct
*handle
,
1264 struct timespec ts1
,ts2
;
1267 clock_gettime_mono(&ts1
);
1268 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1269 clock_gettime_mono(&ts2
);
1270 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1272 if (timediff
> audit_timeout
) {
1273 smb_time_audit_log_fsp("ftruncate", timediff
, fsp
);
1279 static int smb_time_audit_fallocate(vfs_handle_struct
*handle
,
1286 int saved_errno
= 0;
1287 struct timespec ts1
,ts2
;
1290 clock_gettime_mono(&ts1
);
1291 result
= SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1293 saved_errno
= errno
;
1295 clock_gettime_mono(&ts2
);
1296 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1298 if (timediff
> audit_timeout
) {
1299 smb_time_audit_log_fsp("fallocate", timediff
, fsp
);
1302 errno
= saved_errno
;
1307 static bool smb_time_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1308 int op
, off_t offset
, off_t count
,
1312 struct timespec ts1
,ts2
;
1315 clock_gettime_mono(&ts1
);
1316 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1317 clock_gettime_mono(&ts2
);
1318 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1320 if (timediff
> audit_timeout
) {
1321 smb_time_audit_log_fsp("lock", timediff
, fsp
);
1327 static int smb_time_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1328 struct files_struct
*fsp
,
1329 uint32_t share_mode
, uint32_t access_mask
)
1332 struct timespec ts1
,ts2
;
1335 clock_gettime_mono(&ts1
);
1336 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
,
1338 clock_gettime_mono(&ts2
);
1339 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1341 if (timediff
> audit_timeout
) {
1342 smb_time_audit_log_fsp("kernel_flock", timediff
, fsp
);
1348 static int smb_time_audit_linux_setlease(vfs_handle_struct
*handle
,
1353 struct timespec ts1
,ts2
;
1356 clock_gettime_mono(&ts1
);
1357 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
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_fsp("linux_setlease", timediff
, fsp
);
1368 static bool smb_time_audit_getlock(vfs_handle_struct
*handle
,
1370 off_t
*poffset
, off_t
*pcount
,
1371 int *ptype
, pid_t
*ppid
)
1374 struct timespec ts1
,ts2
;
1377 clock_gettime_mono(&ts1
);
1378 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
,
1380 clock_gettime_mono(&ts2
);
1381 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1383 if (timediff
> audit_timeout
) {
1384 smb_time_audit_log_fsp("getlock", timediff
, fsp
);
1390 static int smb_time_audit_symlink(vfs_handle_struct
*handle
,
1391 const char *oldpath
, const char *newpath
)
1394 struct timespec ts1
,ts2
;
1397 clock_gettime_mono(&ts1
);
1398 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1399 clock_gettime_mono(&ts2
);
1400 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1402 if (timediff
> audit_timeout
) {
1403 smb_time_audit_log_fname("symlink", timediff
, newpath
);
1409 static int smb_time_audit_readlink(vfs_handle_struct
*handle
,
1410 const char *path
, char *buf
, size_t bufsiz
)
1413 struct timespec ts1
,ts2
;
1416 clock_gettime_mono(&ts1
);
1417 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1418 clock_gettime_mono(&ts2
);
1419 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1421 if (timediff
> audit_timeout
) {
1422 smb_time_audit_log_fname("readlink", timediff
, path
);
1428 static int smb_time_audit_link(vfs_handle_struct
*handle
,
1429 const char *oldpath
, const char *newpath
)
1432 struct timespec ts1
,ts2
;
1435 clock_gettime_mono(&ts1
);
1436 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
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("link", timediff
, newpath
);
1447 static int smb_time_audit_mknod(vfs_handle_struct
*handle
,
1448 const char *pathname
, mode_t mode
,
1452 struct timespec ts1
,ts2
;
1455 clock_gettime_mono(&ts1
);
1456 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1457 clock_gettime_mono(&ts2
);
1458 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1460 if (timediff
> audit_timeout
) {
1461 smb_time_audit_log_fname("mknod", timediff
, pathname
);
1467 static char *smb_time_audit_realpath(vfs_handle_struct
*handle
,
1471 struct timespec ts1
,ts2
;
1474 clock_gettime_mono(&ts1
);
1475 result
= SMB_VFS_NEXT_REALPATH(handle
, path
);
1476 clock_gettime_mono(&ts2
);
1477 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1479 if (timediff
> audit_timeout
) {
1480 smb_time_audit_log_fname("realpath", timediff
, path
);
1486 static int smb_time_audit_chflags(vfs_handle_struct
*handle
,
1487 const char *path
, unsigned int flags
)
1490 struct timespec ts1
,ts2
;
1493 clock_gettime_mono(&ts1
);
1494 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1495 clock_gettime_mono(&ts2
);
1496 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1498 if (timediff
> audit_timeout
) {
1499 smb_time_audit_log_fname("chflags", timediff
, path
);
1505 static struct file_id
smb_time_audit_file_id_create(struct vfs_handle_struct
*handle
,
1506 const SMB_STRUCT_STAT
*sbuf
)
1508 struct file_id id_zero
;
1509 struct file_id result
;
1510 struct timespec ts1
,ts2
;
1513 ZERO_STRUCT(id_zero
);
1515 clock_gettime_mono(&ts1
);
1516 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1517 clock_gettime_mono(&ts2
);
1518 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1520 if (timediff
> audit_timeout
) {
1521 smb_time_audit_log("file_id_create", timediff
);
1527 static NTSTATUS
smb_time_audit_streaminfo(vfs_handle_struct
*handle
,
1528 struct files_struct
*fsp
,
1530 TALLOC_CTX
*mem_ctx
,
1531 unsigned int *pnum_streams
,
1532 struct stream_struct
**pstreams
)
1535 struct timespec ts1
,ts2
;
1538 clock_gettime_mono(&ts1
);
1539 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1540 pnum_streams
, pstreams
);
1541 clock_gettime_mono(&ts2
);
1542 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1544 if (timediff
> audit_timeout
) {
1545 smb_time_audit_log_fsp("streaminfo", timediff
, fsp
);
1551 static int smb_time_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1554 TALLOC_CTX
*mem_ctx
,
1558 struct timespec ts1
,ts2
;
1561 clock_gettime_mono(&ts1
);
1562 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
1564 clock_gettime_mono(&ts2
);
1565 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1567 if (timediff
> audit_timeout
) {
1568 smb_time_audit_log_fname("get_real_filename", timediff
, path
);
1574 static const char *smb_time_audit_connectpath(vfs_handle_struct
*handle
,
1578 struct timespec ts1
,ts2
;
1581 clock_gettime_mono(&ts1
);
1582 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1583 clock_gettime_mono(&ts2
);
1584 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1586 if (timediff
> audit_timeout
) {
1587 smb_time_audit_log_fname("connectpath", timediff
, fname
);
1593 static NTSTATUS
smb_time_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1594 struct byte_range_lock
*br_lck
,
1595 struct lock_struct
*plock
,
1599 struct timespec ts1
,ts2
;
1602 clock_gettime_mono(&ts1
);
1603 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1605 clock_gettime_mono(&ts2
);
1606 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1608 if (timediff
> audit_timeout
) {
1609 smb_time_audit_log_fsp("brl_lock_windows", timediff
,
1616 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1617 struct messaging_context
*msg_ctx
,
1618 struct byte_range_lock
*br_lck
,
1619 const struct lock_struct
*plock
)
1622 struct timespec ts1
,ts2
;
1625 clock_gettime_mono(&ts1
);
1626 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1628 clock_gettime_mono(&ts2
);
1629 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1631 if (timediff
> audit_timeout
) {
1632 smb_time_audit_log_fsp("brl_unlock_windows", timediff
,
1639 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1640 struct byte_range_lock
*br_lck
,
1641 struct lock_struct
*plock
)
1644 struct timespec ts1
,ts2
;
1647 clock_gettime_mono(&ts1
);
1648 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
1649 clock_gettime_mono(&ts2
);
1650 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1652 if (timediff
> audit_timeout
) {
1653 smb_time_audit_log_fsp("brl_cancel_windows", timediff
,
1660 static bool smb_time_audit_strict_lock(struct vfs_handle_struct
*handle
,
1661 struct files_struct
*fsp
,
1662 struct lock_struct
*plock
)
1665 struct timespec ts1
,ts2
;
1668 clock_gettime_mono(&ts1
);
1669 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1670 clock_gettime_mono(&ts2
);
1671 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1673 if (timediff
> audit_timeout
) {
1674 smb_time_audit_log_fsp("strict_lock", timediff
, fsp
);
1680 static void smb_time_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1681 struct files_struct
*fsp
,
1682 struct lock_struct
*plock
)
1684 struct timespec ts1
,ts2
;
1687 clock_gettime_mono(&ts1
);
1688 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1689 clock_gettime_mono(&ts2
);
1690 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1692 if (timediff
> audit_timeout
) {
1693 smb_time_audit_log_fsp("strict_unlock", timediff
, fsp
);
1697 static NTSTATUS
smb_time_audit_translate_name(struct vfs_handle_struct
*handle
,
1699 enum vfs_translate_direction direction
,
1700 TALLOC_CTX
*mem_ctx
,
1704 struct timespec ts1
,ts2
;
1707 clock_gettime_mono(&ts1
);
1708 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
1710 clock_gettime_mono(&ts2
);
1711 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1713 if (timediff
> audit_timeout
) {
1714 smb_time_audit_log_fname("translate_name", timediff
, name
);
1720 struct time_audit_cc_state
{
1721 struct timespec ts_send
;
1722 struct vfs_handle_struct
*handle
;
1725 static void smb_time_audit_copy_chunk_done(struct tevent_req
*subreq
);
1727 static struct tevent_req
*smb_time_audit_copy_chunk_send(struct vfs_handle_struct
*handle
,
1728 TALLOC_CTX
*mem_ctx
,
1729 struct tevent_context
*ev
,
1730 struct files_struct
*src_fsp
,
1732 struct files_struct
*dest_fsp
,
1736 struct tevent_req
*req
;
1737 struct tevent_req
*subreq
;
1738 struct time_audit_cc_state
*cc_state
;
1740 req
= tevent_req_create(mem_ctx
, &cc_state
, struct time_audit_cc_state
);
1745 cc_state
->handle
= handle
;
1746 clock_gettime_mono(&cc_state
->ts_send
);
1747 subreq
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, cc_state
, ev
,
1749 dest_fsp
, dest_off
, num
);
1750 if (tevent_req_nomem(subreq
, req
)) {
1751 return tevent_req_post(req
, ev
);
1754 tevent_req_set_callback(subreq
, smb_time_audit_copy_chunk_done
, req
);
1758 static void smb_time_audit_copy_chunk_done(struct tevent_req
*subreq
)
1760 struct tevent_req
*req
= tevent_req_callback_data(
1761 subreq
, struct tevent_req
);
1762 struct time_audit_cc_state
*cc_state
1763 = tevent_req_data(req
, struct time_audit_cc_state
);
1766 status
= SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state
->handle
,
1769 TALLOC_FREE(subreq
);
1770 if (tevent_req_nterror(req
, status
)) {
1773 tevent_req_done(req
);
1776 static NTSTATUS
smb_time_audit_copy_chunk_recv(struct vfs_handle_struct
*handle
,
1777 struct tevent_req
*req
,
1780 struct time_audit_cc_state
*cc_state
1781 = tevent_req_data(req
, struct time_audit_cc_state
);
1782 struct timespec ts_recv
;
1786 clock_gettime_mono(&ts_recv
);
1787 timediff
= nsec_time_diff(&ts_recv
, &cc_state
->ts_send
)*1.0e-9;
1788 if (timediff
> audit_timeout
) {
1789 smb_time_audit_log("copy_chunk", timediff
);
1792 *copied
= cc_state
->copied
;
1793 if (tevent_req_is_nterror(req
, &status
)) {
1794 tevent_req_received(req
);
1798 tevent_req_received(req
);
1799 return NT_STATUS_OK
;
1802 static NTSTATUS
smb_time_audit_get_compression(vfs_handle_struct
*handle
,
1803 TALLOC_CTX
*mem_ctx
,
1804 struct files_struct
*fsp
,
1805 struct smb_filename
*smb_fname
,
1806 uint16_t *_compression_fmt
)
1809 struct timespec ts1
,ts2
;
1812 clock_gettime_mono(&ts1
);
1813 result
= SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
1815 clock_gettime_mono(&ts2
);
1816 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1818 if (timediff
> audit_timeout
) {
1820 smb_time_audit_log_fsp("get_compression",
1823 smb_time_audit_log_smb_fname("get_compression",
1824 timediff
, smb_fname
);
1831 static NTSTATUS
smb_time_audit_set_compression(vfs_handle_struct
*handle
,
1832 TALLOC_CTX
*mem_ctx
,
1833 struct files_struct
*fsp
,
1834 uint16_t compression_fmt
)
1837 struct timespec ts1
,ts2
;
1840 clock_gettime_mono(&ts1
);
1841 result
= SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
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_fsp("set_compression", timediff
, fsp
);
1853 static NTSTATUS
smb_time_audit_readdir_attr(struct vfs_handle_struct
*handle
,
1854 const struct smb_filename
*fname
,
1855 TALLOC_CTX
*mem_ctx
,
1856 struct readdir_attr_data
**pattr_data
)
1859 struct timespec ts1
,ts2
;
1862 clock_gettime_mono(&ts1
);
1863 status
= SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
1864 clock_gettime_mono(&ts2
);
1865 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1867 if (timediff
> audit_timeout
) {
1868 smb_time_audit_log_smb_fname("readdir_attr", timediff
, fname
);
1874 static NTSTATUS
smb_time_audit_fget_nt_acl(vfs_handle_struct
*handle
,
1876 uint32_t security_info
,
1877 TALLOC_CTX
*mem_ctx
,
1878 struct security_descriptor
**ppdesc
)
1881 struct timespec ts1
,ts2
;
1884 clock_gettime_mono(&ts1
);
1885 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
,
1887 clock_gettime_mono(&ts2
);
1888 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1890 if (timediff
> audit_timeout
) {
1891 smb_time_audit_log_fsp("fget_nt_acl", timediff
, fsp
);
1897 static NTSTATUS
smb_time_audit_get_nt_acl(vfs_handle_struct
*handle
,
1899 uint32_t security_info
,
1900 TALLOC_CTX
*mem_ctx
,
1901 struct security_descriptor
**ppdesc
)
1904 struct timespec ts1
,ts2
;
1907 clock_gettime_mono(&ts1
);
1908 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
,
1910 clock_gettime_mono(&ts2
);
1911 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1913 if (timediff
> audit_timeout
) {
1914 smb_time_audit_log_fname("get_nt_acl", timediff
, name
);
1920 static NTSTATUS
smb_time_audit_fset_nt_acl(vfs_handle_struct
*handle
,
1922 uint32_t security_info_sent
,
1923 const struct security_descriptor
*psd
)
1926 struct timespec ts1
,ts2
;
1929 clock_gettime_mono(&ts1
);
1930 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
,
1932 clock_gettime_mono(&ts2
);
1933 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1935 if (timediff
> audit_timeout
) {
1936 smb_time_audit_log_fsp("fset_nt_acl", timediff
, fsp
);
1942 static int smb_time_audit_chmod_acl(vfs_handle_struct
*handle
,
1943 const char *path
, mode_t mode
)
1946 struct timespec ts1
,ts2
;
1949 clock_gettime_mono(&ts1
);
1950 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1951 clock_gettime_mono(&ts2
);
1952 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1954 if (timediff
> audit_timeout
) {
1955 smb_time_audit_log_fname("chmod_acl", timediff
, path
);
1961 static int smb_time_audit_fchmod_acl(vfs_handle_struct
*handle
,
1962 files_struct
*fsp
, mode_t mode
)
1965 struct timespec ts1
,ts2
;
1968 clock_gettime_mono(&ts1
);
1969 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1970 clock_gettime_mono(&ts2
);
1971 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1973 if (timediff
> audit_timeout
) {
1974 smb_time_audit_log_fsp("fchmod_acl", timediff
, fsp
);
1980 static SMB_ACL_T
smb_time_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1982 SMB_ACL_TYPE_T type
,
1983 TALLOC_CTX
*mem_ctx
)
1986 struct timespec ts1
,ts2
;
1989 clock_gettime_mono(&ts1
);
1990 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
1991 clock_gettime_mono(&ts2
);
1992 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
1994 if (timediff
> audit_timeout
) {
1995 smb_time_audit_log_fname("sys_acl_get_file", timediff
, path_p
);
2001 static SMB_ACL_T
smb_time_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
2003 TALLOC_CTX
*mem_ctx
)
2006 struct timespec ts1
,ts2
;
2009 clock_gettime_mono(&ts1
);
2010 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
2011 clock_gettime_mono(&ts2
);
2012 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2014 if (timediff
> audit_timeout
) {
2015 smb_time_audit_log_fsp("sys_acl_get_fd", timediff
, fsp
);
2022 static int smb_time_audit_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
2024 TALLOC_CTX
*mem_ctx
,
2025 char **blob_description
,
2029 struct timespec ts1
,ts2
;
2032 clock_gettime_mono(&ts1
);
2033 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
, blob_description
, blob
);
2034 clock_gettime_mono(&ts2
);
2035 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2037 if (timediff
> audit_timeout
) {
2038 smb_time_audit_log("sys_acl_blob_get_file", timediff
);
2044 static int smb_time_audit_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
2046 TALLOC_CTX
*mem_ctx
,
2047 char **blob_description
,
2051 struct timespec ts1
,ts2
;
2054 clock_gettime_mono(&ts1
);
2055 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
, blob_description
, blob
);
2056 clock_gettime_mono(&ts2
);
2057 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2059 if (timediff
> audit_timeout
) {
2060 smb_time_audit_log("sys_acl_blob_get_fd", timediff
);
2066 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
2068 SMB_ACL_TYPE_T acltype
,
2072 struct timespec ts1
,ts2
;
2075 clock_gettime_mono(&ts1
);
2076 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
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_set_file", timediff
, name
);
2088 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct
*handle
,
2093 struct timespec ts1
,ts2
;
2096 clock_gettime_mono(&ts1
);
2097 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
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_fsp("sys_acl_set_fd", timediff
, fsp
);
2108 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
2112 struct timespec ts1
,ts2
;
2115 clock_gettime_mono(&ts1
);
2116 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
2117 clock_gettime_mono(&ts2
);
2118 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2120 if (timediff
> audit_timeout
) {
2121 smb_time_audit_log_fname("sys_acl_delete_def_file", timediff
, path
);
2127 static ssize_t
smb_time_audit_getxattr(struct vfs_handle_struct
*handle
,
2128 const char *path
, const char *name
,
2129 void *value
, size_t size
)
2132 struct timespec ts1
,ts2
;
2135 clock_gettime_mono(&ts1
);
2136 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
2137 clock_gettime_mono(&ts2
);
2138 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2140 if (timediff
> audit_timeout
) {
2141 smb_time_audit_log_fname("getxattr", timediff
, path
);
2147 static ssize_t
smb_time_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2148 struct files_struct
*fsp
,
2149 const char *name
, void *value
,
2153 struct timespec ts1
,ts2
;
2156 clock_gettime_mono(&ts1
);
2157 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2158 clock_gettime_mono(&ts2
);
2159 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2161 if (timediff
> audit_timeout
) {
2162 smb_time_audit_log_fsp("fgetxattr", timediff
, fsp
);
2168 static ssize_t
smb_time_audit_listxattr(struct vfs_handle_struct
*handle
,
2169 const char *path
, char *list
,
2173 struct timespec ts1
,ts2
;
2176 clock_gettime_mono(&ts1
);
2177 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
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("listxattr", timediff
, path
);
2188 static ssize_t
smb_time_audit_flistxattr(struct vfs_handle_struct
*handle
,
2189 struct files_struct
*fsp
, char *list
,
2193 struct timespec ts1
,ts2
;
2196 clock_gettime_mono(&ts1
);
2197 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
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("flistxattr", timediff
, fsp
);
2208 static int smb_time_audit_removexattr(struct vfs_handle_struct
*handle
,
2209 const char *path
, const char *name
)
2212 struct timespec ts1
,ts2
;
2215 clock_gettime_mono(&ts1
);
2216 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2217 clock_gettime_mono(&ts2
);
2218 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2220 if (timediff
> audit_timeout
) {
2221 smb_time_audit_log_fname("removexattr", timediff
, path
);
2227 static int smb_time_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2228 struct files_struct
*fsp
,
2232 struct timespec ts1
,ts2
;
2235 clock_gettime_mono(&ts1
);
2236 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2237 clock_gettime_mono(&ts2
);
2238 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2240 if (timediff
> audit_timeout
) {
2241 smb_time_audit_log_fsp("fremovexattr", timediff
, fsp
);
2247 static int smb_time_audit_setxattr(struct vfs_handle_struct
*handle
,
2248 const char *path
, const char *name
,
2249 const void *value
, size_t size
,
2253 struct timespec ts1
,ts2
;
2256 clock_gettime_mono(&ts1
);
2257 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
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_fname("setxattr", timediff
, path
);
2269 static int smb_time_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2270 struct files_struct
*fsp
, const char *name
,
2271 const void *value
, size_t size
, int flags
)
2274 struct timespec ts1
,ts2
;
2277 clock_gettime_mono(&ts1
);
2278 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
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_fsp("fsetxattr", timediff
, fsp
);
2289 static bool smb_time_audit_aio_force(struct vfs_handle_struct
*handle
,
2290 struct files_struct
*fsp
)
2293 struct timespec ts1
,ts2
;
2296 clock_gettime_mono(&ts1
);
2297 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
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_fsp("aio_force", timediff
, fsp
);
2308 static bool smb_time_audit_is_offline(struct vfs_handle_struct
*handle
,
2309 const struct smb_filename
*fname
,
2310 SMB_STRUCT_STAT
*sbuf
)
2313 struct timespec ts1
,ts2
;
2316 clock_gettime_mono(&ts1
);
2317 result
= SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
2318 clock_gettime_mono(&ts2
);
2319 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2321 if (timediff
> audit_timeout
) {
2322 smb_time_audit_log_smb_fname("is_offline", timediff
, fname
);
2328 static int smb_time_audit_set_offline(struct vfs_handle_struct
*handle
,
2329 const struct smb_filename
*fname
)
2332 struct timespec ts1
,ts2
;
2335 clock_gettime_mono(&ts1
);
2336 result
= SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
2337 clock_gettime_mono(&ts2
);
2338 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2340 if (timediff
> audit_timeout
) {
2341 smb_time_audit_log_smb_fname("set_offline", timediff
, fname
);
2347 static NTSTATUS
smb_time_audit_durable_cookie(struct vfs_handle_struct
*handle
,
2348 struct files_struct
*fsp
,
2349 TALLOC_CTX
*mem_ctx
,
2353 struct timespec ts1
,ts2
;
2356 clock_gettime_mono(&ts1
);
2357 result
= SMB_VFS_NEXT_DURABLE_COOKIE(handle
, fsp
, mem_ctx
, cookie
);
2358 clock_gettime_mono(&ts2
);
2359 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2361 if (timediff
> audit_timeout
) {
2362 smb_time_audit_log_fsp("durable_cookie", timediff
, fsp
);
2368 static NTSTATUS
smb_time_audit_durable_disconnect(struct vfs_handle_struct
*handle
,
2369 struct files_struct
*fsp
,
2370 const DATA_BLOB old_cookie
,
2371 TALLOC_CTX
*mem_ctx
,
2372 DATA_BLOB
*new_cookie
)
2375 struct timespec ts1
,ts2
;
2378 clock_gettime_mono(&ts1
);
2379 result
= SMB_VFS_NEXT_DURABLE_DISCONNECT(handle
, fsp
, old_cookie
,
2380 mem_ctx
, new_cookie
);
2381 clock_gettime_mono(&ts2
);
2382 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2384 if (timediff
> audit_timeout
) {
2385 smb_time_audit_log_fsp("durable_disconnect", timediff
, fsp
);
2391 static NTSTATUS
smb_time_audit_durable_reconnect(struct vfs_handle_struct
*handle
,
2392 struct smb_request
*smb1req
,
2393 struct smbXsrv_open
*op
,
2394 const DATA_BLOB old_cookie
,
2395 TALLOC_CTX
*mem_ctx
,
2396 struct files_struct
**fsp
,
2397 DATA_BLOB
*new_cookie
)
2400 struct timespec ts1
,ts2
;
2403 clock_gettime_mono(&ts1
);
2404 result
= SMB_VFS_NEXT_DURABLE_RECONNECT(handle
, smb1req
, op
, old_cookie
,
2405 mem_ctx
, fsp
, new_cookie
);
2406 clock_gettime_mono(&ts2
);
2407 timediff
= nsec_time_diff(&ts2
,&ts1
)*1.0e-9;
2409 if (timediff
> audit_timeout
) {
2410 smb_time_audit_log("durable_reconnect", timediff
);
2416 /* VFS operations */
2418 static struct vfs_fn_pointers vfs_time_audit_fns
= {
2419 .connect_fn
= smb_time_audit_connect
,
2420 .disconnect_fn
= smb_time_audit_disconnect
,
2421 .disk_free_fn
= smb_time_audit_disk_free
,
2422 .get_quota_fn
= smb_time_audit_get_quota
,
2423 .set_quota_fn
= smb_time_audit_set_quota
,
2424 .get_shadow_copy_data_fn
= smb_time_audit_get_shadow_copy_data
,
2425 .statvfs_fn
= smb_time_audit_statvfs
,
2426 .fs_capabilities_fn
= smb_time_audit_fs_capabilities
,
2427 .snap_check_path_fn
= smb_time_audit_snap_check_path
,
2428 .snap_create_fn
= smb_time_audit_snap_create
,
2429 .snap_delete_fn
= smb_time_audit_snap_delete
,
2430 .opendir_fn
= smb_time_audit_opendir
,
2431 .fdopendir_fn
= smb_time_audit_fdopendir
,
2432 .readdir_fn
= smb_time_audit_readdir
,
2433 .seekdir_fn
= smb_time_audit_seekdir
,
2434 .telldir_fn
= smb_time_audit_telldir
,
2435 .rewind_dir_fn
= smb_time_audit_rewinddir
,
2436 .mkdir_fn
= smb_time_audit_mkdir
,
2437 .rmdir_fn
= smb_time_audit_rmdir
,
2438 .closedir_fn
= smb_time_audit_closedir
,
2439 .init_search_op_fn
= smb_time_audit_init_search_op
,
2440 .open_fn
= smb_time_audit_open
,
2441 .create_file_fn
= smb_time_audit_create_file
,
2442 .close_fn
= smb_time_audit_close
,
2443 .read_fn
= smb_time_audit_read
,
2444 .pread_fn
= smb_time_audit_pread
,
2445 .pread_send_fn
= smb_time_audit_pread_send
,
2446 .pread_recv_fn
= smb_time_audit_pread_recv
,
2447 .write_fn
= smb_time_audit_write
,
2448 .pwrite_fn
= smb_time_audit_pwrite
,
2449 .pwrite_send_fn
= smb_time_audit_pwrite_send
,
2450 .pwrite_recv_fn
= smb_time_audit_pwrite_recv
,
2451 .lseek_fn
= smb_time_audit_lseek
,
2452 .sendfile_fn
= smb_time_audit_sendfile
,
2453 .recvfile_fn
= smb_time_audit_recvfile
,
2454 .rename_fn
= smb_time_audit_rename
,
2455 .fsync_fn
= smb_time_audit_fsync
,
2456 .fsync_send_fn
= smb_time_audit_fsync_send
,
2457 .fsync_recv_fn
= smb_time_audit_fsync_recv
,
2458 .stat_fn
= smb_time_audit_stat
,
2459 .fstat_fn
= smb_time_audit_fstat
,
2460 .lstat_fn
= smb_time_audit_lstat
,
2461 .get_alloc_size_fn
= smb_time_audit_get_alloc_size
,
2462 .unlink_fn
= smb_time_audit_unlink
,
2463 .chmod_fn
= smb_time_audit_chmod
,
2464 .fchmod_fn
= smb_time_audit_fchmod
,
2465 .chown_fn
= smb_time_audit_chown
,
2466 .fchown_fn
= smb_time_audit_fchown
,
2467 .lchown_fn
= smb_time_audit_lchown
,
2468 .chdir_fn
= smb_time_audit_chdir
,
2469 .getwd_fn
= smb_time_audit_getwd
,
2470 .ntimes_fn
= smb_time_audit_ntimes
,
2471 .ftruncate_fn
= smb_time_audit_ftruncate
,
2472 .fallocate_fn
= smb_time_audit_fallocate
,
2473 .lock_fn
= smb_time_audit_lock
,
2474 .kernel_flock_fn
= smb_time_audit_kernel_flock
,
2475 .linux_setlease_fn
= smb_time_audit_linux_setlease
,
2476 .getlock_fn
= smb_time_audit_getlock
,
2477 .symlink_fn
= smb_time_audit_symlink
,
2478 .readlink_fn
= smb_time_audit_readlink
,
2479 .link_fn
= smb_time_audit_link
,
2480 .mknod_fn
= smb_time_audit_mknod
,
2481 .realpath_fn
= smb_time_audit_realpath
,
2482 .chflags_fn
= smb_time_audit_chflags
,
2483 .file_id_create_fn
= smb_time_audit_file_id_create
,
2484 .streaminfo_fn
= smb_time_audit_streaminfo
,
2485 .get_real_filename_fn
= smb_time_audit_get_real_filename
,
2486 .connectpath_fn
= smb_time_audit_connectpath
,
2487 .brl_lock_windows_fn
= smb_time_audit_brl_lock_windows
,
2488 .brl_unlock_windows_fn
= smb_time_audit_brl_unlock_windows
,
2489 .brl_cancel_windows_fn
= smb_time_audit_brl_cancel_windows
,
2490 .strict_lock_fn
= smb_time_audit_strict_lock
,
2491 .strict_unlock_fn
= smb_time_audit_strict_unlock
,
2492 .translate_name_fn
= smb_time_audit_translate_name
,
2493 .copy_chunk_send_fn
= smb_time_audit_copy_chunk_send
,
2494 .copy_chunk_recv_fn
= smb_time_audit_copy_chunk_recv
,
2495 .get_compression_fn
= smb_time_audit_get_compression
,
2496 .set_compression_fn
= smb_time_audit_set_compression
,
2497 .readdir_attr_fn
= smb_time_audit_readdir_attr
,
2498 .fget_nt_acl_fn
= smb_time_audit_fget_nt_acl
,
2499 .get_nt_acl_fn
= smb_time_audit_get_nt_acl
,
2500 .fset_nt_acl_fn
= smb_time_audit_fset_nt_acl
,
2501 .chmod_acl_fn
= smb_time_audit_chmod_acl
,
2502 .fchmod_acl_fn
= smb_time_audit_fchmod_acl
,
2503 .sys_acl_get_file_fn
= smb_time_audit_sys_acl_get_file
,
2504 .sys_acl_get_fd_fn
= smb_time_audit_sys_acl_get_fd
,
2505 .sys_acl_blob_get_file_fn
= smb_time_audit_sys_acl_blob_get_file
,
2506 .sys_acl_blob_get_fd_fn
= smb_time_audit_sys_acl_blob_get_fd
,
2507 .sys_acl_set_file_fn
= smb_time_audit_sys_acl_set_file
,
2508 .sys_acl_set_fd_fn
= smb_time_audit_sys_acl_set_fd
,
2509 .sys_acl_delete_def_file_fn
= smb_time_audit_sys_acl_delete_def_file
,
2510 .getxattr_fn
= smb_time_audit_getxattr
,
2511 .fgetxattr_fn
= smb_time_audit_fgetxattr
,
2512 .listxattr_fn
= smb_time_audit_listxattr
,
2513 .flistxattr_fn
= smb_time_audit_flistxattr
,
2514 .removexattr_fn
= smb_time_audit_removexattr
,
2515 .fremovexattr_fn
= smb_time_audit_fremovexattr
,
2516 .setxattr_fn
= smb_time_audit_setxattr
,
2517 .fsetxattr_fn
= smb_time_audit_fsetxattr
,
2518 .aio_force_fn
= smb_time_audit_aio_force
,
2519 .is_offline_fn
= smb_time_audit_is_offline
,
2520 .set_offline_fn
= smb_time_audit_set_offline
,
2521 .durable_cookie_fn
= smb_time_audit_durable_cookie
,
2522 .durable_disconnect_fn
= smb_time_audit_durable_disconnect
,
2523 .durable_reconnect_fn
= smb_time_audit_durable_reconnect
,
2527 NTSTATUS
vfs_time_audit_init(void);
2528 NTSTATUS
vfs_time_audit_init(void)
2530 audit_timeout
= (double)lp_parm_int(-1, "time_audit", "timeout",
2532 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "time_audit",
2533 &vfs_time_audit_fns
);