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 struct smb_filename *smb_fname,
166 struct timespec ts1,ts2;
169 clock_gettime_mono(&ts1);
170 result = SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
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",
178 smb_fname->base_name);
184 static int smb_time_audit_get_quota(struct vfs_handle_struct *handle,
185 const struct smb_filename *smb_fname,
186 enum SMB_QUOTA_TYPE qtype,
191 struct timespec ts1,ts2;
194 clock_gettime_mono(&ts1);
195 result = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt);
196 clock_gettime_mono(&ts2);
197 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
199 if (timediff > audit_timeout) {
200 smb_time_audit_log_fname("get_quota",
202 smb_fname->base_name);
207 static int smb_time_audit_set_quota(struct vfs_handle_struct *handle,
208 enum SMB_QUOTA_TYPE qtype, unid_t id,
212 struct timespec ts1,ts2;
215 clock_gettime_mono(&ts1);
216 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
217 clock_gettime_mono(&ts2);
218 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
220 if (timediff > audit_timeout) {
221 smb_time_audit_log("set_quota", timediff);
227 static int smb_time_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
228 struct files_struct *fsp,
229 struct shadow_copy_data *shadow_copy_data,
233 struct timespec ts1,ts2;
236 clock_gettime_mono(&ts1);
237 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp,
238 shadow_copy_data, labels);
239 clock_gettime_mono(&ts2);
240 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
242 if (timediff > audit_timeout) {
243 smb_time_audit_log_fsp("get_shadow_copy_data", timediff, fsp);
249 static int smb_time_audit_statvfs(struct vfs_handle_struct *handle,
250 const struct smb_filename *smb_fname,
251 struct vfs_statvfs_struct *statbuf)
254 struct timespec ts1,ts2;
257 clock_gettime_mono(&ts1);
258 result = SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
259 clock_gettime_mono(&ts2);
260 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
262 if (timediff > audit_timeout) {
263 smb_time_audit_log_fname("statvfs", timediff,
264 smb_fname->base_name);
270 static uint32_t smb_time_audit_fs_capabilities(struct vfs_handle_struct *handle,
271 enum timestamp_set_resolution *p_ts_res)
274 struct timespec ts1,ts2;
277 clock_gettime_mono(&ts1);
278 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
279 clock_gettime_mono(&ts2);
280 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
282 if (timediff > audit_timeout) {
283 smb_time_audit_log("fs_capabilities", timediff);
289 static NTSTATUS smb_time_audit_get_dfs_referrals(
290 struct vfs_handle_struct *handle,
291 struct dfs_GetDFSReferral *r)
294 struct timespec ts1,ts2;
297 clock_gettime_mono(&ts1);
298 result = SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
299 clock_gettime_mono(&ts2);
300 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
302 if (timediff > audit_timeout) {
303 smb_time_audit_log("get_dfs_referrals(", timediff);
309 static NTSTATUS smb_time_audit_snap_check_path(struct vfs_handle_struct *handle,
311 const char *service_path,
315 struct timespec ts1,ts2;
318 clock_gettime_mono(&ts1);
319 status = SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
321 clock_gettime_mono(&ts2);
322 timediff = nsec_time_diff(&ts2, &ts1) * 1.0e-9;
324 if (timediff > audit_timeout) {
325 smb_time_audit_log("snap_check_path", timediff);
331 static NTSTATUS smb_time_audit_snap_create(struct vfs_handle_struct *handle,
333 const char *base_volume,
340 struct timespec ts1,ts2;
343 clock_gettime_mono(&ts1);
344 status = SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
345 rw, base_path, snap_path);
346 clock_gettime_mono(&ts2);
347 timediff = nsec_time_diff(&ts2 ,&ts1) * 1.0e-9;
349 if (timediff > audit_timeout) {
350 smb_time_audit_log("snap_create", timediff);
356 static NTSTATUS smb_time_audit_snap_delete(struct vfs_handle_struct *handle,
362 struct timespec ts1,ts2;
365 clock_gettime_mono(&ts1);
366 status = SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path,
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("snap_delete", timediff);
378 static DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
379 const struct smb_filename *smb_fname,
380 const char *mask, uint32_t attr)
383 struct timespec ts1,ts2;
386 clock_gettime_mono(&ts1);
387 result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
388 clock_gettime_mono(&ts2);
389 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
391 if (timediff > audit_timeout) {
392 smb_time_audit_log_smb_fname("opendir", timediff, smb_fname);
398 static DIR *smb_time_audit_fdopendir(vfs_handle_struct *handle,
400 const char *mask, uint32_t attr)
403 struct timespec ts1,ts2;
406 clock_gettime_mono(&ts1);
407 result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
408 clock_gettime_mono(&ts2);
409 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
411 if (timediff > audit_timeout) {
412 smb_time_audit_log_fsp("fdopendir", timediff, fsp);
418 static struct dirent *smb_time_audit_readdir(vfs_handle_struct *handle,
420 SMB_STRUCT_STAT *sbuf)
422 struct dirent *result;
423 struct timespec ts1,ts2;
426 clock_gettime_mono(&ts1);
427 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
428 clock_gettime_mono(&ts2);
429 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
431 if (timediff > audit_timeout) {
432 smb_time_audit_log("readdir", timediff);
438 static void smb_time_audit_seekdir(vfs_handle_struct *handle,
439 DIR *dirp, long offset)
441 struct timespec ts1,ts2;
444 clock_gettime_mono(&ts1);
445 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
446 clock_gettime_mono(&ts2);
447 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
449 if (timediff > audit_timeout) {
450 smb_time_audit_log("seekdir", timediff);
455 static long smb_time_audit_telldir(vfs_handle_struct *handle,
459 struct timespec ts1,ts2;
462 clock_gettime_mono(&ts1);
463 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
464 clock_gettime_mono(&ts2);
465 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
467 if (timediff > audit_timeout) {
468 smb_time_audit_log("telldir", timediff);
474 static void smb_time_audit_rewinddir(vfs_handle_struct *handle,
477 struct timespec ts1,ts2;
480 clock_gettime_mono(&ts1);
481 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
482 clock_gettime_mono(&ts2);
483 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
485 if (timediff > audit_timeout) {
486 smb_time_audit_log("rewinddir", timediff);
491 static int smb_time_audit_mkdir(vfs_handle_struct *handle,
492 const struct smb_filename *smb_fname,
496 struct timespec ts1,ts2;
499 clock_gettime_mono(&ts1);
500 result = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
501 clock_gettime_mono(&ts2);
502 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
504 if (timediff > audit_timeout) {
505 smb_time_audit_log_smb_fname("mkdir",
513 static int smb_time_audit_rmdir(vfs_handle_struct *handle,
514 const struct smb_filename *smb_fname)
517 struct timespec ts1,ts2;
520 clock_gettime_mono(&ts1);
521 result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
522 clock_gettime_mono(&ts2);
523 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
525 if (timediff > audit_timeout) {
526 smb_time_audit_log_smb_fname("rmdir",
534 static int smb_time_audit_closedir(vfs_handle_struct *handle,
538 struct timespec ts1,ts2;
541 clock_gettime_mono(&ts1);
542 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
543 clock_gettime_mono(&ts2);
544 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
546 if (timediff > audit_timeout) {
547 smb_time_audit_log("closedir", timediff);
553 static void smb_time_audit_init_search_op(vfs_handle_struct *handle,
556 struct timespec ts1,ts2;
559 clock_gettime_mono(&ts1);
560 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
561 clock_gettime_mono(&ts2);
562 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
564 if (timediff > audit_timeout) {
565 smb_time_audit_log("init_search_op", timediff);
569 static int smb_time_audit_open(vfs_handle_struct *handle,
570 struct smb_filename *fname,
572 int flags, mode_t mode)
575 struct timespec ts1,ts2;
578 clock_gettime_mono(&ts1);
579 result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
580 clock_gettime_mono(&ts2);
581 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
583 if (timediff > audit_timeout) {
584 smb_time_audit_log_fsp("open", timediff, fsp);
590 static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
591 struct smb_request *req,
592 uint16_t root_dir_fid,
593 struct smb_filename *fname,
594 uint32_t access_mask,
595 uint32_t share_access,
596 uint32_t create_disposition,
597 uint32_t create_options,
598 uint32_t file_attributes,
599 uint32_t oplock_request,
600 struct smb2_lease *lease,
601 uint64_t allocation_size,
602 uint32_t private_flags,
603 struct security_descriptor *sd,
604 struct ea_list *ea_list,
605 files_struct **result_fsp,
607 const struct smb2_create_blobs *in_context_blobs,
608 struct smb2_create_blobs *out_context_blobs)
611 struct timespec ts1,ts2;
614 clock_gettime_mono(&ts1);
615 result = SMB_VFS_NEXT_CREATE_FILE(
618 root_dir_fid, /* root_dir_fid */
620 access_mask, /* access_mask */
621 share_access, /* share_access */
622 create_disposition, /* create_disposition*/
623 create_options, /* create_options */
624 file_attributes, /* file_attributes */
625 oplock_request, /* oplock_request */
627 allocation_size, /* allocation_size */
630 ea_list, /* ea_list */
631 result_fsp, /* result */
633 in_context_blobs, out_context_blobs); /* create context */
634 clock_gettime_mono(&ts2);
635 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
637 if (timediff > audit_timeout) {
639 * can't use result_fsp this time, may have
640 * invalid content causing smbd crash
642 smb_time_audit_log_smb_fname("create_file", timediff,
649 static int smb_time_audit_close(vfs_handle_struct *handle, files_struct *fsp)
652 struct timespec ts1,ts2;
655 clock_gettime_mono(&ts1);
656 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
657 clock_gettime_mono(&ts2);
658 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
660 if (timediff > audit_timeout) {
661 smb_time_audit_log_fsp("close", timediff, fsp);
667 static ssize_t smb_time_audit_read(vfs_handle_struct *handle,
668 files_struct *fsp, void *data, size_t n)
671 struct timespec ts1,ts2;
674 clock_gettime_mono(&ts1);
675 result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
676 clock_gettime_mono(&ts2);
677 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
679 if (timediff > audit_timeout) {
680 smb_time_audit_log_fsp("read", timediff, fsp);
686 static ssize_t smb_time_audit_pread(vfs_handle_struct *handle,
688 void *data, size_t n, off_t offset)
691 struct timespec ts1,ts2;
694 clock_gettime_mono(&ts1);
695 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
696 clock_gettime_mono(&ts2);
697 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
699 if (timediff > audit_timeout) {
700 smb_time_audit_log_fsp("pread", timediff, fsp);
706 struct smb_time_audit_pread_state {
707 struct files_struct *fsp;
709 struct vfs_aio_state vfs_aio_state;
712 static void smb_time_audit_pread_done(struct tevent_req *subreq);
714 static struct tevent_req *smb_time_audit_pread_send(
715 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
716 struct tevent_context *ev, struct files_struct *fsp,
717 void *data, size_t n, off_t offset)
719 struct tevent_req *req, *subreq;
720 struct smb_time_audit_pread_state *state;
722 req = tevent_req_create(mem_ctx, &state,
723 struct smb_time_audit_pread_state);
729 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
731 if (tevent_req_nomem(subreq, req)) {
732 return tevent_req_post(req, ev);
734 tevent_req_set_callback(subreq, smb_time_audit_pread_done, req);
738 static void smb_time_audit_pread_done(struct tevent_req *subreq)
740 struct tevent_req *req = tevent_req_callback_data(
741 subreq, struct tevent_req);
742 struct smb_time_audit_pread_state *state = tevent_req_data(
743 req, struct smb_time_audit_pread_state);
745 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
747 tevent_req_done(req);
750 static ssize_t smb_time_audit_pread_recv(struct tevent_req *req,
751 struct vfs_aio_state *vfs_aio_state)
753 struct smb_time_audit_pread_state *state = tevent_req_data(
754 req, struct smb_time_audit_pread_state);
757 timediff = state->vfs_aio_state.duration * 1.0e-9;
759 if (timediff > audit_timeout) {
760 smb_time_audit_log_fsp("async pread", timediff, state->fsp);
763 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
766 *vfs_aio_state = state->vfs_aio_state;
770 static ssize_t smb_time_audit_write(vfs_handle_struct *handle,
772 const void *data, size_t n)
775 struct timespec ts1,ts2;
778 clock_gettime_mono(&ts1);
779 result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
780 clock_gettime_mono(&ts2);
781 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
783 if (timediff > audit_timeout) {
784 smb_time_audit_log_fsp("write", timediff, fsp);
790 static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle,
792 const void *data, size_t n,
796 struct timespec ts1,ts2;
799 clock_gettime_mono(&ts1);
800 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
801 clock_gettime_mono(&ts2);
802 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
804 if (timediff > audit_timeout) {
805 smb_time_audit_log_fsp("pwrite", timediff, fsp);
811 struct smb_time_audit_pwrite_state {
812 struct files_struct *fsp;
814 struct vfs_aio_state vfs_aio_state;
817 static void smb_time_audit_pwrite_done(struct tevent_req *subreq);
819 static struct tevent_req *smb_time_audit_pwrite_send(
820 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
821 struct tevent_context *ev, struct files_struct *fsp,
822 const void *data, size_t n, off_t offset)
824 struct tevent_req *req, *subreq;
825 struct smb_time_audit_pwrite_state *state;
827 req = tevent_req_create(mem_ctx, &state,
828 struct smb_time_audit_pwrite_state);
834 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
836 if (tevent_req_nomem(subreq, req)) {
837 return tevent_req_post(req, ev);
839 tevent_req_set_callback(subreq, smb_time_audit_pwrite_done, req);
843 static void smb_time_audit_pwrite_done(struct tevent_req *subreq)
845 struct tevent_req *req = tevent_req_callback_data(
846 subreq, struct tevent_req);
847 struct smb_time_audit_pwrite_state *state = tevent_req_data(
848 req, struct smb_time_audit_pwrite_state);
850 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
852 tevent_req_done(req);
855 static ssize_t smb_time_audit_pwrite_recv(struct tevent_req *req,
856 struct vfs_aio_state *vfs_aio_state)
858 struct smb_time_audit_pwrite_state *state = tevent_req_data(
859 req, struct smb_time_audit_pwrite_state);
862 timediff = state->vfs_aio_state.duration * 1.0e-9;
864 if (timediff > audit_timeout) {
865 smb_time_audit_log_fsp("async pwrite", timediff, state->fsp);
868 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
871 *vfs_aio_state = state->vfs_aio_state;
875 static off_t smb_time_audit_lseek(vfs_handle_struct *handle,
877 off_t offset, int whence)
880 struct timespec ts1,ts2;
883 clock_gettime_mono(&ts1);
884 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
885 clock_gettime_mono(&ts2);
886 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
888 if (timediff > audit_timeout) {
889 smb_time_audit_log_fsp("lseek", timediff, fsp);
895 static ssize_t smb_time_audit_sendfile(vfs_handle_struct *handle, int tofd,
896 files_struct *fromfsp,
897 const DATA_BLOB *hdr, off_t offset,
901 struct timespec ts1,ts2;
904 clock_gettime_mono(&ts1);
905 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
906 clock_gettime_mono(&ts2);
907 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
909 if (timediff > audit_timeout) {
910 smb_time_audit_log_fsp("sendfile", timediff, fromfsp);
916 static ssize_t smb_time_audit_recvfile(vfs_handle_struct *handle, int fromfd,
922 struct timespec ts1,ts2;
925 clock_gettime_mono(&ts1);
926 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
927 clock_gettime_mono(&ts2);
928 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
930 if (timediff > audit_timeout) {
931 smb_time_audit_log_fsp("recvfile", timediff, tofsp);
937 static int smb_time_audit_rename(vfs_handle_struct *handle,
938 const struct smb_filename *oldname,
939 const struct smb_filename *newname)
942 struct timespec ts1,ts2;
945 clock_gettime_mono(&ts1);
946 result = SMB_VFS_NEXT_RENAME(handle, oldname, newname);
947 clock_gettime_mono(&ts2);
948 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
950 if (timediff > audit_timeout) {
951 smb_time_audit_log_smb_fname("rename", timediff, newname);
957 static int smb_time_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
960 struct timespec ts1,ts2;
963 clock_gettime_mono(&ts1);
964 result = SMB_VFS_NEXT_FSYNC(handle, fsp);
965 clock_gettime_mono(&ts2);
966 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
968 if (timediff > audit_timeout) {
969 smb_time_audit_log_fsp("fsync", timediff, fsp);
975 struct smb_time_audit_fsync_state {
976 struct files_struct *fsp;
978 struct vfs_aio_state vfs_aio_state;
981 static void smb_time_audit_fsync_done(struct tevent_req *subreq);
983 static struct tevent_req *smb_time_audit_fsync_send(
984 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
985 struct tevent_context *ev, struct files_struct *fsp)
987 struct tevent_req *req, *subreq;
988 struct smb_time_audit_fsync_state *state;
990 req = tevent_req_create(mem_ctx, &state,
991 struct smb_time_audit_fsync_state);
997 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
998 if (tevent_req_nomem(subreq, req)) {
999 return tevent_req_post(req, ev);
1001 tevent_req_set_callback(subreq, smb_time_audit_fsync_done, req);
1005 static void smb_time_audit_fsync_done(struct tevent_req *subreq)
1007 struct tevent_req *req = tevent_req_callback_data(
1008 subreq, struct tevent_req);
1009 struct smb_time_audit_fsync_state *state = tevent_req_data(
1010 req, struct smb_time_audit_fsync_state);
1012 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
1013 TALLOC_FREE(subreq);
1014 tevent_req_done(req);
1017 static int smb_time_audit_fsync_recv(struct tevent_req *req,
1018 struct vfs_aio_state *vfs_aio_state)
1020 struct smb_time_audit_fsync_state *state = tevent_req_data(
1021 req, struct smb_time_audit_fsync_state);
1024 timediff = state->vfs_aio_state.duration * 1.0e-9;
1026 if (timediff > audit_timeout) {
1027 smb_time_audit_log_fsp("async fsync", timediff, state->fsp);
1030 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1033 *vfs_aio_state = state->vfs_aio_state;
1037 static int smb_time_audit_stat(vfs_handle_struct *handle,
1038 struct smb_filename *fname)
1041 struct timespec ts1,ts2;
1044 clock_gettime_mono(&ts1);
1045 result = SMB_VFS_NEXT_STAT(handle, fname);
1046 clock_gettime_mono(&ts2);
1047 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1049 if (timediff > audit_timeout) {
1050 smb_time_audit_log_smb_fname("stat", timediff, fname);
1056 static int smb_time_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
1057 SMB_STRUCT_STAT *sbuf)
1060 struct timespec ts1,ts2;
1063 clock_gettime_mono(&ts1);
1064 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
1065 clock_gettime_mono(&ts2);
1066 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1068 if (timediff > audit_timeout) {
1069 smb_time_audit_log_fsp("fstat", timediff, fsp);
1075 static int smb_time_audit_lstat(vfs_handle_struct *handle,
1076 struct smb_filename *path)
1079 struct timespec ts1,ts2;
1082 clock_gettime_mono(&ts1);
1083 result = SMB_VFS_NEXT_LSTAT(handle, path);
1084 clock_gettime_mono(&ts2);
1085 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1087 if (timediff > audit_timeout) {
1088 smb_time_audit_log_smb_fname("lstat", timediff, path);
1094 static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
1096 const SMB_STRUCT_STAT *sbuf)
1099 struct timespec ts1,ts2;
1102 clock_gettime_mono(&ts1);
1103 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
1104 clock_gettime_mono(&ts2);
1105 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1107 if (timediff > audit_timeout) {
1108 smb_time_audit_log_fsp("get_alloc_size", timediff, fsp);
1114 static int smb_time_audit_unlink(vfs_handle_struct *handle,
1115 const struct smb_filename *path)
1118 struct timespec ts1,ts2;
1121 clock_gettime_mono(&ts1);
1122 result = SMB_VFS_NEXT_UNLINK(handle, path);
1123 clock_gettime_mono(&ts2);
1124 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1126 if (timediff > audit_timeout) {
1127 smb_time_audit_log_smb_fname("unlink", timediff, path);
1133 static int smb_time_audit_chmod(vfs_handle_struct *handle,
1134 const struct smb_filename *smb_fname,
1138 struct timespec ts1,ts2;
1141 clock_gettime_mono(&ts1);
1142 result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
1143 clock_gettime_mono(&ts2);
1144 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1146 if (timediff > audit_timeout) {
1147 smb_time_audit_log_fname("chmod",
1149 smb_fname->base_name);
1155 static int smb_time_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
1159 struct timespec ts1,ts2;
1162 clock_gettime_mono(&ts1);
1163 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
1164 clock_gettime_mono(&ts2);
1165 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1167 if (timediff > audit_timeout) {
1168 smb_time_audit_log_fsp("fchmod", timediff, fsp);
1174 static int smb_time_audit_chown(vfs_handle_struct *handle,
1175 const struct smb_filename *smb_fname,
1180 struct timespec ts1,ts2;
1183 clock_gettime_mono(&ts1);
1184 result = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
1185 clock_gettime_mono(&ts2);
1186 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1188 if (timediff > audit_timeout) {
1189 smb_time_audit_log_fname("chown",
1191 smb_fname->base_name);
1197 static int smb_time_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
1198 uid_t uid, gid_t gid)
1201 struct timespec ts1,ts2;
1204 clock_gettime_mono(&ts1);
1205 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
1206 clock_gettime_mono(&ts2);
1207 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1209 if (timediff > audit_timeout) {
1210 smb_time_audit_log_fsp("fchown", timediff, fsp);
1216 static int smb_time_audit_lchown(vfs_handle_struct *handle,
1217 const struct smb_filename *smb_fname,
1222 struct timespec ts1,ts2;
1225 clock_gettime_mono(&ts1);
1226 result = SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
1227 clock_gettime_mono(&ts2);
1228 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1230 if (timediff > audit_timeout) {
1231 smb_time_audit_log_fname("lchown",
1233 smb_fname->base_name);
1239 static int smb_time_audit_chdir(vfs_handle_struct *handle,
1240 const struct smb_filename *smb_fname)
1243 struct timespec ts1,ts2;
1246 clock_gettime_mono(&ts1);
1247 result = SMB_VFS_NEXT_CHDIR(handle, smb_fname);
1248 clock_gettime_mono(&ts2);
1249 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1251 if (timediff > audit_timeout) {
1252 smb_time_audit_log_fname("chdir",
1254 smb_fname->base_name);
1260 static struct smb_filename *smb_time_audit_getwd(vfs_handle_struct *handle,
1261 TALLOC_CTX *mem_ctx)
1263 struct smb_filename *result;
1264 struct timespec ts1,ts2;
1267 clock_gettime_mono(&ts1);
1268 result = SMB_VFS_NEXT_GETWD(handle, mem_ctx);
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("getwd", timediff);
1279 static int smb_time_audit_ntimes(vfs_handle_struct *handle,
1280 const struct smb_filename *path,
1281 struct smb_file_time *ft)
1284 struct timespec ts1,ts2;
1287 clock_gettime_mono(&ts1);
1288 result = SMB_VFS_NEXT_NTIMES(handle, path, ft);
1289 clock_gettime_mono(&ts2);
1290 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1292 if (timediff > audit_timeout) {
1293 smb_time_audit_log_smb_fname("ntimes", timediff, path);
1299 static int smb_time_audit_ftruncate(vfs_handle_struct *handle,
1304 struct timespec ts1,ts2;
1307 clock_gettime_mono(&ts1);
1308 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
1309 clock_gettime_mono(&ts2);
1310 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1312 if (timediff > audit_timeout) {
1313 smb_time_audit_log_fsp("ftruncate", timediff, fsp);
1319 static int smb_time_audit_fallocate(vfs_handle_struct *handle,
1326 int saved_errno = 0;
1327 struct timespec ts1,ts2;
1330 clock_gettime_mono(&ts1);
1331 result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
1333 saved_errno = errno;
1335 clock_gettime_mono(&ts2);
1336 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1338 if (timediff > audit_timeout) {
1339 smb_time_audit_log_fsp("fallocate", timediff, fsp);
1342 errno = saved_errno;
1347 static bool smb_time_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
1348 int op, off_t offset, off_t count,
1352 struct timespec ts1,ts2;
1355 clock_gettime_mono(&ts1);
1356 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
1357 clock_gettime_mono(&ts2);
1358 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1360 if (timediff > audit_timeout) {
1361 smb_time_audit_log_fsp("lock", timediff, fsp);
1367 static int smb_time_audit_kernel_flock(struct vfs_handle_struct *handle,
1368 struct files_struct *fsp,
1369 uint32_t share_mode, uint32_t access_mask)
1372 struct timespec ts1,ts2;
1375 clock_gettime_mono(&ts1);
1376 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode,
1378 clock_gettime_mono(&ts2);
1379 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1381 if (timediff > audit_timeout) {
1382 smb_time_audit_log_fsp("kernel_flock", timediff, fsp);
1388 static int smb_time_audit_linux_setlease(vfs_handle_struct *handle,
1393 struct timespec ts1,ts2;
1396 clock_gettime_mono(&ts1);
1397 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
1398 clock_gettime_mono(&ts2);
1399 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1401 if (timediff > audit_timeout) {
1402 smb_time_audit_log_fsp("linux_setlease", timediff, fsp);
1408 static bool smb_time_audit_getlock(vfs_handle_struct *handle,
1410 off_t *poffset, off_t *pcount,
1411 int *ptype, pid_t *ppid)
1414 struct timespec ts1,ts2;
1417 clock_gettime_mono(&ts1);
1418 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype,
1420 clock_gettime_mono(&ts2);
1421 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1423 if (timediff > audit_timeout) {
1424 smb_time_audit_log_fsp("getlock", timediff, fsp);
1430 static int smb_time_audit_symlink(vfs_handle_struct *handle,
1431 const char *link_contents,
1432 const struct smb_filename *new_smb_fname)
1435 struct timespec ts1,ts2;
1438 clock_gettime_mono(&ts1);
1439 result = SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname);
1440 clock_gettime_mono(&ts2);
1441 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1443 if (timediff > audit_timeout) {
1444 smb_time_audit_log_fname("symlink", timediff,
1445 new_smb_fname->base_name);
1451 static int smb_time_audit_readlink(vfs_handle_struct *handle,
1452 const struct smb_filename *smb_fname,
1457 struct timespec ts1,ts2;
1460 clock_gettime_mono(&ts1);
1461 result = SMB_VFS_NEXT_READLINK(handle, smb_fname,
1463 clock_gettime_mono(&ts2);
1464 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1466 if (timediff > audit_timeout) {
1467 smb_time_audit_log_fname("readlink", timediff,
1468 smb_fname->base_name);
1474 static int smb_time_audit_link(vfs_handle_struct *handle,
1475 const struct smb_filename *old_smb_fname,
1476 const struct smb_filename *new_smb_fname)
1479 struct timespec ts1,ts2;
1482 clock_gettime_mono(&ts1);
1483 result = SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname);
1484 clock_gettime_mono(&ts2);
1485 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1487 if (timediff > audit_timeout) {
1488 smb_time_audit_log_fname("link", timediff,
1489 new_smb_fname->base_name);
1495 static int smb_time_audit_mknod(vfs_handle_struct *handle,
1496 const struct smb_filename *smb_fname,
1501 struct timespec ts1,ts2;
1504 clock_gettime_mono(&ts1);
1505 result = SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
1506 clock_gettime_mono(&ts2);
1507 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1509 if (timediff > audit_timeout) {
1510 smb_time_audit_log_smb_fname("mknod", timediff, smb_fname);
1516 static struct smb_filename *smb_time_audit_realpath(vfs_handle_struct *handle,
1518 const struct smb_filename *smb_fname)
1520 struct smb_filename *result_fname;
1521 struct timespec ts1,ts2;
1524 clock_gettime_mono(&ts1);
1525 result_fname = SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
1526 clock_gettime_mono(&ts2);
1527 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1529 if (timediff > audit_timeout) {
1530 smb_time_audit_log_fname("realpath", timediff,
1531 smb_fname->base_name);
1534 return result_fname;
1537 static int smb_time_audit_chflags(vfs_handle_struct *handle,
1538 const struct smb_filename *smb_fname,
1542 struct timespec ts1,ts2;
1545 clock_gettime_mono(&ts1);
1546 result = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
1547 clock_gettime_mono(&ts2);
1548 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1550 if (timediff > audit_timeout) {
1551 smb_time_audit_log_smb_fname("chflags", timediff, smb_fname);
1557 static struct file_id smb_time_audit_file_id_create(struct vfs_handle_struct *handle,
1558 const SMB_STRUCT_STAT *sbuf)
1560 struct file_id id_zero;
1561 struct file_id result;
1562 struct timespec ts1,ts2;
1565 ZERO_STRUCT(id_zero);
1567 clock_gettime_mono(&ts1);
1568 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1569 clock_gettime_mono(&ts2);
1570 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1572 if (timediff > audit_timeout) {
1573 smb_time_audit_log("file_id_create", timediff);
1579 static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
1580 struct files_struct *fsp,
1581 const struct smb_filename *smb_fname,
1582 TALLOC_CTX *mem_ctx,
1583 unsigned int *pnum_streams,
1584 struct stream_struct **pstreams)
1587 struct timespec ts1,ts2;
1590 clock_gettime_mono(&ts1);
1591 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
1592 pnum_streams, pstreams);
1593 clock_gettime_mono(&ts2);
1594 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1596 if (timediff > audit_timeout) {
1597 smb_time_audit_log_fsp("streaminfo", timediff, fsp);
1603 static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
1606 TALLOC_CTX *mem_ctx,
1610 struct timespec ts1,ts2;
1613 clock_gettime_mono(&ts1);
1614 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1616 clock_gettime_mono(&ts2);
1617 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1619 if (timediff > audit_timeout) {
1620 smb_time_audit_log_fname("get_real_filename", timediff, path);
1626 static const char *smb_time_audit_connectpath(vfs_handle_struct *handle,
1630 struct timespec ts1,ts2;
1633 clock_gettime_mono(&ts1);
1634 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
1635 clock_gettime_mono(&ts2);
1636 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1638 if (timediff > audit_timeout) {
1639 smb_time_audit_log_fname("connectpath", timediff, fname);
1645 static NTSTATUS smb_time_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1646 struct byte_range_lock *br_lck,
1647 struct lock_struct *plock,
1651 struct timespec ts1,ts2;
1654 clock_gettime_mono(&ts1);
1655 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1657 clock_gettime_mono(&ts2);
1658 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1660 if (timediff > audit_timeout) {
1661 smb_time_audit_log_fsp("brl_lock_windows", timediff,
1668 static bool smb_time_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1669 struct messaging_context *msg_ctx,
1670 struct byte_range_lock *br_lck,
1671 const struct lock_struct *plock)
1674 struct timespec ts1,ts2;
1677 clock_gettime_mono(&ts1);
1678 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1680 clock_gettime_mono(&ts2);
1681 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1683 if (timediff > audit_timeout) {
1684 smb_time_audit_log_fsp("brl_unlock_windows", timediff,
1691 static bool smb_time_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1692 struct byte_range_lock *br_lck,
1693 struct lock_struct *plock)
1696 struct timespec ts1,ts2;
1699 clock_gettime_mono(&ts1);
1700 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
1701 clock_gettime_mono(&ts2);
1702 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1704 if (timediff > audit_timeout) {
1705 smb_time_audit_log_fsp("brl_cancel_windows", timediff,
1712 static bool smb_time_audit_strict_lock(struct vfs_handle_struct *handle,
1713 struct files_struct *fsp,
1714 struct lock_struct *plock)
1717 struct timespec ts1,ts2;
1720 clock_gettime_mono(&ts1);
1721 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1722 clock_gettime_mono(&ts2);
1723 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1725 if (timediff > audit_timeout) {
1726 smb_time_audit_log_fsp("strict_lock", timediff, fsp);
1732 static void smb_time_audit_strict_unlock(struct vfs_handle_struct *handle,
1733 struct files_struct *fsp,
1734 struct lock_struct *plock)
1736 struct timespec ts1,ts2;
1739 clock_gettime_mono(&ts1);
1740 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
1741 clock_gettime_mono(&ts2);
1742 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1744 if (timediff > audit_timeout) {
1745 smb_time_audit_log_fsp("strict_unlock", timediff, fsp);
1749 static NTSTATUS smb_time_audit_translate_name(struct vfs_handle_struct *handle,
1751 enum vfs_translate_direction direction,
1752 TALLOC_CTX *mem_ctx,
1756 struct timespec ts1,ts2;
1759 clock_gettime_mono(&ts1);
1760 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1762 clock_gettime_mono(&ts2);
1763 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1765 if (timediff > audit_timeout) {
1766 smb_time_audit_log_fname("translate_name", timediff, name);
1772 static NTSTATUS smb_time_audit_fsctl(struct vfs_handle_struct *handle,
1773 struct files_struct *fsp,
1777 const uint8_t *_in_data,
1779 uint8_t **_out_data,
1780 uint32_t max_out_len,
1784 struct timespec ts1,ts2;
1787 clock_gettime_mono(&ts1);
1788 result = SMB_VFS_NEXT_FSCTL(handle,
1798 clock_gettime_mono(&ts2);
1799 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1801 if (timediff > audit_timeout) {
1802 smb_time_audit_log_fsp("fsctl", timediff, fsp);
1808 static NTSTATUS smb_time_get_dos_attributes(struct vfs_handle_struct *handle,
1809 struct smb_filename *smb_fname,
1813 struct timespec ts1,ts2;
1816 clock_gettime_mono(&ts1);
1817 result = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
1820 clock_gettime_mono(&ts2);
1821 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1823 if (timediff > audit_timeout) {
1824 smb_time_audit_log_fname("get_dos_attributes",
1826 smb_fname->base_name);
1832 static NTSTATUS smb_time_fget_dos_attributes(struct vfs_handle_struct *handle,
1833 struct files_struct *fsp,
1837 struct timespec ts1,ts2;
1840 clock_gettime_mono(&ts1);
1841 result = SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
1844 clock_gettime_mono(&ts2);
1845 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1847 if (timediff > audit_timeout) {
1848 smb_time_audit_log_fsp("fget_dos_attributes", timediff, fsp);
1854 static NTSTATUS smb_time_set_dos_attributes(struct vfs_handle_struct *handle,
1855 const struct smb_filename *smb_fname,
1859 struct timespec ts1,ts2;
1862 clock_gettime_mono(&ts1);
1863 result = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
1866 clock_gettime_mono(&ts2);
1867 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1869 if (timediff > audit_timeout) {
1870 smb_time_audit_log_fname("set_dos_attributes",
1872 smb_fname->base_name);
1878 static NTSTATUS smb_time_fset_dos_attributes(struct vfs_handle_struct *handle,
1879 struct files_struct *fsp,
1883 struct timespec ts1,ts2;
1886 clock_gettime_mono(&ts1);
1887 result = SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
1890 clock_gettime_mono(&ts2);
1891 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1893 if (timediff > audit_timeout) {
1894 smb_time_audit_log_fsp("fset_dos_attributes", timediff, fsp);
1900 struct time_audit_cc_state {
1901 struct timespec ts_send;
1902 struct vfs_handle_struct *handle;
1905 static void smb_time_audit_copy_chunk_done(struct tevent_req *subreq);
1907 static struct tevent_req *smb_time_audit_copy_chunk_send(struct vfs_handle_struct *handle,
1908 TALLOC_CTX *mem_ctx,
1909 struct tevent_context *ev,
1910 struct files_struct *src_fsp,
1912 struct files_struct *dest_fsp,
1917 struct tevent_req *req;
1918 struct tevent_req *subreq;
1919 struct time_audit_cc_state *cc_state;
1921 req = tevent_req_create(mem_ctx, &cc_state, struct time_audit_cc_state);
1926 cc_state->handle = handle;
1927 clock_gettime_mono(&cc_state->ts_send);
1928 subreq = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, cc_state, ev,
1930 dest_fsp, dest_off, num, flags);
1931 if (tevent_req_nomem(subreq, req)) {
1932 return tevent_req_post(req, ev);
1935 tevent_req_set_callback(subreq, smb_time_audit_copy_chunk_done, req);
1939 static void smb_time_audit_copy_chunk_done(struct tevent_req *subreq)
1941 struct tevent_req *req = tevent_req_callback_data(
1942 subreq, struct tevent_req);
1943 struct time_audit_cc_state *cc_state
1944 = tevent_req_data(req, struct time_audit_cc_state);
1947 status = SMB_VFS_NEXT_COPY_CHUNK_RECV(cc_state->handle,
1950 TALLOC_FREE(subreq);
1951 if (tevent_req_nterror(req, status)) {
1954 tevent_req_done(req);
1957 static NTSTATUS smb_time_audit_copy_chunk_recv(struct vfs_handle_struct *handle,
1958 struct tevent_req *req,
1961 struct time_audit_cc_state *cc_state
1962 = tevent_req_data(req, struct time_audit_cc_state);
1963 struct timespec ts_recv;
1967 clock_gettime_mono(&ts_recv);
1968 timediff = nsec_time_diff(&ts_recv, &cc_state->ts_send)*1.0e-9;
1969 if (timediff > audit_timeout) {
1970 smb_time_audit_log("copy_chunk", timediff);
1973 *copied = cc_state->copied;
1974 if (tevent_req_is_nterror(req, &status)) {
1975 tevent_req_received(req);
1979 tevent_req_received(req);
1980 return NT_STATUS_OK;
1983 static NTSTATUS smb_time_audit_get_compression(vfs_handle_struct *handle,
1984 TALLOC_CTX *mem_ctx,
1985 struct files_struct *fsp,
1986 struct smb_filename *smb_fname,
1987 uint16_t *_compression_fmt)
1990 struct timespec ts1,ts2;
1993 clock_gettime_mono(&ts1);
1994 result = SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
1996 clock_gettime_mono(&ts2);
1997 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
1999 if (timediff > audit_timeout) {
2001 smb_time_audit_log_fsp("get_compression",
2004 smb_time_audit_log_smb_fname("get_compression",
2005 timediff, smb_fname);
2012 static NTSTATUS smb_time_audit_set_compression(vfs_handle_struct *handle,
2013 TALLOC_CTX *mem_ctx,
2014 struct files_struct *fsp,
2015 uint16_t compression_fmt)
2018 struct timespec ts1,ts2;
2021 clock_gettime_mono(&ts1);
2022 result = SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
2024 clock_gettime_mono(&ts2);
2025 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2027 if (timediff > audit_timeout) {
2028 smb_time_audit_log_fsp("set_compression", timediff, fsp);
2034 static NTSTATUS smb_time_audit_readdir_attr(struct vfs_handle_struct *handle,
2035 const struct smb_filename *fname,
2036 TALLOC_CTX *mem_ctx,
2037 struct readdir_attr_data **pattr_data)
2040 struct timespec ts1,ts2;
2043 clock_gettime_mono(&ts1);
2044 status = SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
2045 clock_gettime_mono(&ts2);
2046 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2048 if (timediff > audit_timeout) {
2049 smb_time_audit_log_smb_fname("readdir_attr", timediff, fname);
2055 static NTSTATUS smb_time_audit_fget_nt_acl(vfs_handle_struct *handle,
2057 uint32_t security_info,
2058 TALLOC_CTX *mem_ctx,
2059 struct security_descriptor **ppdesc)
2062 struct timespec ts1,ts2;
2065 clock_gettime_mono(&ts1);
2066 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info,
2068 clock_gettime_mono(&ts2);
2069 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2071 if (timediff > audit_timeout) {
2072 smb_time_audit_log_fsp("fget_nt_acl", timediff, fsp);
2078 static NTSTATUS smb_time_audit_get_nt_acl(vfs_handle_struct *handle,
2079 const struct smb_filename *smb_fname,
2080 uint32_t security_info,
2081 TALLOC_CTX *mem_ctx,
2082 struct security_descriptor **ppdesc)
2085 struct timespec ts1,ts2;
2088 clock_gettime_mono(&ts1);
2089 result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info,
2091 clock_gettime_mono(&ts2);
2092 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2094 if (timediff > audit_timeout) {
2095 smb_time_audit_log_fname("get_nt_acl",
2097 smb_fname->base_name);
2103 static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
2105 uint32_t security_info_sent,
2106 const struct security_descriptor *psd)
2109 struct timespec ts1,ts2;
2112 clock_gettime_mono(&ts1);
2113 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent,
2115 clock_gettime_mono(&ts2);
2116 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2118 if (timediff > audit_timeout) {
2119 smb_time_audit_log_fsp("fset_nt_acl", timediff, fsp);
2125 static NTSTATUS smb_time_audit_audit_file(struct vfs_handle_struct *handle,
2126 struct smb_filename *smb_fname,
2127 struct security_acl *sacl,
2128 uint32_t access_requested,
2129 uint32_t access_denied)
2132 struct timespec ts1,ts2;
2135 clock_gettime_mono(&ts1);
2136 result = SMB_VFS_NEXT_AUDIT_FILE(handle,
2141 clock_gettime_mono(&ts2);
2142 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2144 if (timediff > audit_timeout) {
2145 smb_time_audit_log_fname("audit_file",
2147 smb_fname->base_name);
2155 static int smb_time_audit_chmod_acl(vfs_handle_struct *handle,
2156 const struct smb_filename *smb_fname,
2160 struct timespec ts1,ts2;
2163 clock_gettime_mono(&ts1);
2164 result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
2165 clock_gettime_mono(&ts2);
2166 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2168 if (timediff > audit_timeout) {
2169 smb_time_audit_log_fname("chmod_acl",
2171 smb_fname->base_name);
2177 static int smb_time_audit_fchmod_acl(vfs_handle_struct *handle,
2178 files_struct *fsp, mode_t mode)
2181 struct timespec ts1,ts2;
2184 clock_gettime_mono(&ts1);
2185 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
2186 clock_gettime_mono(&ts2);
2187 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2189 if (timediff > audit_timeout) {
2190 smb_time_audit_log_fsp("fchmod_acl", timediff, fsp);
2196 static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
2197 const struct smb_filename *smb_fname,
2198 SMB_ACL_TYPE_T type,
2199 TALLOC_CTX *mem_ctx)
2202 struct timespec ts1,ts2;
2205 clock_gettime_mono(&ts1);
2206 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
2208 clock_gettime_mono(&ts2);
2209 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2211 if (timediff > audit_timeout) {
2212 smb_time_audit_log_fname("sys_acl_get_file", timediff,
2213 smb_fname->base_name);
2219 static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
2221 TALLOC_CTX *mem_ctx)
2224 struct timespec ts1,ts2;
2227 clock_gettime_mono(&ts1);
2228 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
2229 clock_gettime_mono(&ts2);
2230 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2232 if (timediff > audit_timeout) {
2233 smb_time_audit_log_fsp("sys_acl_get_fd", timediff, fsp);
2240 static int smb_time_audit_sys_acl_blob_get_file(vfs_handle_struct *handle,
2241 const struct smb_filename *smb_fname,
2242 TALLOC_CTX *mem_ctx,
2243 char **blob_description,
2247 struct timespec ts1,ts2;
2250 clock_gettime_mono(&ts1);
2251 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname,
2252 mem_ctx, blob_description, blob);
2253 clock_gettime_mono(&ts2);
2254 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2256 if (timediff > audit_timeout) {
2257 smb_time_audit_log("sys_acl_blob_get_file", timediff);
2263 static int smb_time_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
2265 TALLOC_CTX *mem_ctx,
2266 char **blob_description,
2270 struct timespec ts1,ts2;
2273 clock_gettime_mono(&ts1);
2274 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob);
2275 clock_gettime_mono(&ts2);
2276 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2278 if (timediff > audit_timeout) {
2279 smb_time_audit_log("sys_acl_blob_get_fd", timediff);
2285 static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
2286 const struct smb_filename *smb_fname,
2287 SMB_ACL_TYPE_T acltype,
2291 struct timespec ts1,ts2;
2294 clock_gettime_mono(&ts1);
2295 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
2297 clock_gettime_mono(&ts2);
2298 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2300 if (timediff > audit_timeout) {
2301 smb_time_audit_log_fname("sys_acl_set_file", timediff,
2302 smb_fname->base_name);
2308 static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
2313 struct timespec ts1,ts2;
2316 clock_gettime_mono(&ts1);
2317 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
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_fsp("sys_acl_set_fd", timediff, fsp);
2328 static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
2329 const struct smb_filename *smb_fname)
2332 struct timespec ts1,ts2;
2335 clock_gettime_mono(&ts1);
2336 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_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_fname("sys_acl_delete_def_file", timediff,
2342 smb_fname->base_name);
2348 static ssize_t smb_time_audit_getxattr(struct vfs_handle_struct *handle,
2349 const struct smb_filename *smb_fname,
2355 struct timespec ts1,ts2;
2358 clock_gettime_mono(&ts1);
2359 result = SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
2360 clock_gettime_mono(&ts2);
2361 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2363 if (timediff > audit_timeout) {
2364 smb_time_audit_log_fname("getxattr", timediff,
2365 smb_fname->base_name);
2371 static ssize_t smb_time_audit_fgetxattr(struct vfs_handle_struct *handle,
2372 struct files_struct *fsp,
2373 const char *name, void *value,
2377 struct timespec ts1,ts2;
2380 clock_gettime_mono(&ts1);
2381 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
2382 clock_gettime_mono(&ts2);
2383 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2385 if (timediff > audit_timeout) {
2386 smb_time_audit_log_fsp("fgetxattr", timediff, fsp);
2392 static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
2393 const struct smb_filename *smb_fname,
2398 struct timespec ts1,ts2;
2401 clock_gettime_mono(&ts1);
2402 result = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
2403 clock_gettime_mono(&ts2);
2404 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2406 if (timediff > audit_timeout) {
2407 smb_time_audit_log_fname("listxattr", timediff,
2408 smb_fname->base_name);
2414 static ssize_t smb_time_audit_flistxattr(struct vfs_handle_struct *handle,
2415 struct files_struct *fsp, char *list,
2419 struct timespec ts1,ts2;
2422 clock_gettime_mono(&ts1);
2423 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2424 clock_gettime_mono(&ts2);
2425 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2427 if (timediff > audit_timeout) {
2428 smb_time_audit_log_fsp("flistxattr", timediff, fsp);
2434 static int smb_time_audit_removexattr(struct vfs_handle_struct *handle,
2435 const struct smb_filename *smb_fname,
2439 struct timespec ts1,ts2;
2442 clock_gettime_mono(&ts1);
2443 result = SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
2444 clock_gettime_mono(&ts2);
2445 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2447 if (timediff > audit_timeout) {
2448 smb_time_audit_log_fname("removexattr", timediff,
2449 smb_fname->base_name);
2455 static int smb_time_audit_fremovexattr(struct vfs_handle_struct *handle,
2456 struct files_struct *fsp,
2460 struct timespec ts1,ts2;
2463 clock_gettime_mono(&ts1);
2464 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2465 clock_gettime_mono(&ts2);
2466 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2468 if (timediff > audit_timeout) {
2469 smb_time_audit_log_fsp("fremovexattr", timediff, fsp);
2475 static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
2476 const struct smb_filename *smb_fname,
2483 struct timespec ts1,ts2;
2486 clock_gettime_mono(&ts1);
2487 result = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value, size,
2489 clock_gettime_mono(&ts2);
2490 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2492 if (timediff > audit_timeout) {
2493 smb_time_audit_log_fname("setxattr", timediff,
2494 smb_fname->base_name);
2500 static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle,
2501 struct files_struct *fsp, const char *name,
2502 const void *value, size_t size, int flags)
2505 struct timespec ts1,ts2;
2508 clock_gettime_mono(&ts1);
2509 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2510 clock_gettime_mono(&ts2);
2511 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2513 if (timediff > audit_timeout) {
2514 smb_time_audit_log_fsp("fsetxattr", timediff, fsp);
2520 static bool smb_time_audit_aio_force(struct vfs_handle_struct *handle,
2521 struct files_struct *fsp)
2524 struct timespec ts1,ts2;
2527 clock_gettime_mono(&ts1);
2528 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2529 clock_gettime_mono(&ts2);
2530 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2532 if (timediff > audit_timeout) {
2533 smb_time_audit_log_fsp("aio_force", timediff, fsp);
2539 static NTSTATUS smb_time_audit_durable_cookie(struct vfs_handle_struct *handle,
2540 struct files_struct *fsp,
2541 TALLOC_CTX *mem_ctx,
2545 struct timespec ts1,ts2;
2548 clock_gettime_mono(&ts1);
2549 result = SMB_VFS_NEXT_DURABLE_COOKIE(handle, fsp, mem_ctx, cookie);
2550 clock_gettime_mono(&ts2);
2551 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2553 if (timediff > audit_timeout) {
2554 smb_time_audit_log_fsp("durable_cookie", timediff, fsp);
2560 static NTSTATUS smb_time_audit_durable_disconnect(struct vfs_handle_struct *handle,
2561 struct files_struct *fsp,
2562 const DATA_BLOB old_cookie,
2563 TALLOC_CTX *mem_ctx,
2564 DATA_BLOB *new_cookie)
2567 struct timespec ts1,ts2;
2570 clock_gettime_mono(&ts1);
2571 result = SMB_VFS_NEXT_DURABLE_DISCONNECT(handle, fsp, old_cookie,
2572 mem_ctx, new_cookie);
2573 clock_gettime_mono(&ts2);
2574 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2576 if (timediff > audit_timeout) {
2577 smb_time_audit_log_fsp("durable_disconnect", timediff, fsp);
2583 static NTSTATUS smb_time_audit_durable_reconnect(struct vfs_handle_struct *handle,
2584 struct smb_request *smb1req,
2585 struct smbXsrv_open *op,
2586 const DATA_BLOB old_cookie,
2587 TALLOC_CTX *mem_ctx,
2588 struct files_struct **fsp,
2589 DATA_BLOB *new_cookie)
2592 struct timespec ts1,ts2;
2595 clock_gettime_mono(&ts1);
2596 result = SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie,
2597 mem_ctx, fsp, new_cookie);
2598 clock_gettime_mono(&ts2);
2599 timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
2601 if (timediff > audit_timeout) {
2602 smb_time_audit_log("durable_reconnect", timediff);
2608 /* VFS operations */
2610 static struct vfs_fn_pointers vfs_time_audit_fns = {
2611 .connect_fn = smb_time_audit_connect,
2612 .disconnect_fn = smb_time_audit_disconnect,
2613 .disk_free_fn = smb_time_audit_disk_free,
2614 .get_quota_fn = smb_time_audit_get_quota,
2615 .set_quota_fn = smb_time_audit_set_quota,
2616 .get_shadow_copy_data_fn = smb_time_audit_get_shadow_copy_data,
2617 .statvfs_fn = smb_time_audit_statvfs,
2618 .fs_capabilities_fn = smb_time_audit_fs_capabilities,
2619 .get_dfs_referrals_fn = smb_time_audit_get_dfs_referrals,
2620 .opendir_fn = smb_time_audit_opendir,
2621 .fdopendir_fn = smb_time_audit_fdopendir,
2622 .readdir_fn = smb_time_audit_readdir,
2623 .seekdir_fn = smb_time_audit_seekdir,
2624 .telldir_fn = smb_time_audit_telldir,
2625 .rewind_dir_fn = smb_time_audit_rewinddir,
2626 .mkdir_fn = smb_time_audit_mkdir,
2627 .rmdir_fn = smb_time_audit_rmdir,
2628 .closedir_fn = smb_time_audit_closedir,
2629 .init_search_op_fn = smb_time_audit_init_search_op,
2630 .open_fn = smb_time_audit_open,
2631 .create_file_fn = smb_time_audit_create_file,
2632 .close_fn = smb_time_audit_close,
2633 .read_fn = smb_time_audit_read,
2634 .pread_fn = smb_time_audit_pread,
2635 .pread_send_fn = smb_time_audit_pread_send,
2636 .pread_recv_fn = smb_time_audit_pread_recv,
2637 .write_fn = smb_time_audit_write,
2638 .pwrite_fn = smb_time_audit_pwrite,
2639 .pwrite_send_fn = smb_time_audit_pwrite_send,
2640 .pwrite_recv_fn = smb_time_audit_pwrite_recv,
2641 .lseek_fn = smb_time_audit_lseek,
2642 .sendfile_fn = smb_time_audit_sendfile,
2643 .recvfile_fn = smb_time_audit_recvfile,
2644 .rename_fn = smb_time_audit_rename,
2645 .fsync_fn = smb_time_audit_fsync,
2646 .fsync_send_fn = smb_time_audit_fsync_send,
2647 .fsync_recv_fn = smb_time_audit_fsync_recv,
2648 .stat_fn = smb_time_audit_stat,
2649 .fstat_fn = smb_time_audit_fstat,
2650 .lstat_fn = smb_time_audit_lstat,
2651 .get_alloc_size_fn = smb_time_audit_get_alloc_size,
2652 .unlink_fn = smb_time_audit_unlink,
2653 .chmod_fn = smb_time_audit_chmod,
2654 .fchmod_fn = smb_time_audit_fchmod,
2655 .chown_fn = smb_time_audit_chown,
2656 .fchown_fn = smb_time_audit_fchown,
2657 .lchown_fn = smb_time_audit_lchown,
2658 .chdir_fn = smb_time_audit_chdir,
2659 .getwd_fn = smb_time_audit_getwd,
2660 .ntimes_fn = smb_time_audit_ntimes,
2661 .ftruncate_fn = smb_time_audit_ftruncate,
2662 .fallocate_fn = smb_time_audit_fallocate,
2663 .lock_fn = smb_time_audit_lock,
2664 .kernel_flock_fn = smb_time_audit_kernel_flock,
2665 .linux_setlease_fn = smb_time_audit_linux_setlease,
2666 .getlock_fn = smb_time_audit_getlock,
2667 .symlink_fn = smb_time_audit_symlink,
2668 .readlink_fn = smb_time_audit_readlink,
2669 .link_fn = smb_time_audit_link,
2670 .mknod_fn = smb_time_audit_mknod,
2671 .realpath_fn = smb_time_audit_realpath,
2672 .chflags_fn = smb_time_audit_chflags,
2673 .file_id_create_fn = smb_time_audit_file_id_create,
2674 .copy_chunk_send_fn = smb_time_audit_copy_chunk_send,
2675 .copy_chunk_recv_fn = smb_time_audit_copy_chunk_recv,
2676 .get_compression_fn = smb_time_audit_get_compression,
2677 .set_compression_fn = smb_time_audit_set_compression,
2678 .snap_check_path_fn = smb_time_audit_snap_check_path,
2679 .snap_create_fn = smb_time_audit_snap_create,
2680 .snap_delete_fn = smb_time_audit_snap_delete,
2681 .streaminfo_fn = smb_time_audit_streaminfo,
2682 .get_real_filename_fn = smb_time_audit_get_real_filename,
2683 .connectpath_fn = smb_time_audit_connectpath,
2684 .brl_lock_windows_fn = smb_time_audit_brl_lock_windows,
2685 .brl_unlock_windows_fn = smb_time_audit_brl_unlock_windows,
2686 .brl_cancel_windows_fn = smb_time_audit_brl_cancel_windows,
2687 .strict_lock_fn = smb_time_audit_strict_lock,
2688 .strict_unlock_fn = smb_time_audit_strict_unlock,
2689 .translate_name_fn = smb_time_audit_translate_name,
2690 .fsctl_fn = smb_time_audit_fsctl,
2691 .get_dos_attributes_fn = smb_time_get_dos_attributes,
2692 .fget_dos_attributes_fn = smb_time_fget_dos_attributes,
2693 .set_dos_attributes_fn = smb_time_set_dos_attributes,
2694 .fset_dos_attributes_fn = smb_time_fset_dos_attributes,
2695 .fget_nt_acl_fn = smb_time_audit_fget_nt_acl,
2696 .get_nt_acl_fn = smb_time_audit_get_nt_acl,
2697 .fset_nt_acl_fn = smb_time_audit_fset_nt_acl,
2698 .audit_file_fn = smb_time_audit_audit_file,
2699 .chmod_acl_fn = smb_time_audit_chmod_acl,
2700 .fchmod_acl_fn = smb_time_audit_fchmod_acl,
2701 .sys_acl_get_file_fn = smb_time_audit_sys_acl_get_file,
2702 .sys_acl_get_fd_fn = smb_time_audit_sys_acl_get_fd,
2703 .sys_acl_blob_get_file_fn = smb_time_audit_sys_acl_blob_get_file,
2704 .sys_acl_blob_get_fd_fn = smb_time_audit_sys_acl_blob_get_fd,
2705 .sys_acl_set_file_fn = smb_time_audit_sys_acl_set_file,
2706 .sys_acl_set_fd_fn = smb_time_audit_sys_acl_set_fd,
2707 .sys_acl_delete_def_file_fn = smb_time_audit_sys_acl_delete_def_file,
2708 .getxattr_fn = smb_time_audit_getxattr,
2709 .fgetxattr_fn = smb_time_audit_fgetxattr,
2710 .listxattr_fn = smb_time_audit_listxattr,
2711 .flistxattr_fn = smb_time_audit_flistxattr,
2712 .removexattr_fn = smb_time_audit_removexattr,
2713 .fremovexattr_fn = smb_time_audit_fremovexattr,
2714 .setxattr_fn = smb_time_audit_setxattr,
2715 .fsetxattr_fn = smb_time_audit_fsetxattr,
2716 .aio_force_fn = smb_time_audit_aio_force,
2717 .durable_cookie_fn = smb_time_audit_durable_cookie,
2718 .durable_disconnect_fn = smb_time_audit_durable_disconnect,
2719 .durable_reconnect_fn = smb_time_audit_durable_reconnect,
2720 .readdir_attr_fn = smb_time_audit_readdir_attr,
2724 NTSTATUS vfs_time_audit_init(TALLOC_CTX *);
2725 NTSTATUS vfs_time_audit_init(TALLOC_CTX *ctx)
2727 smb_vfs_assert_all_fns(&vfs_time_audit_fns, "time_audit");
2729 audit_timeout = (double)lp_parm_int(-1, "time_audit", "timeout",
2731 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "time_audit",
2732 &vfs_time_audit_fns);