2 * Auditing VFS module for samba. Log selected file operations to syslog
5 * Copyright (C) Tim Potter, 1999-2000
6 * Copyright (C) Alexander Bokovoy, 2002
7 * Copyright (C) John H Terpstra, 2003
8 * Copyright (C) Stefan (metze) Metzmacher, 2003
9 * Copyright (C) Volker Lendecke, 2004
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <http://www.gnu.org/licenses/>.
26 * This module implements parseable logging for all Samba VFS operations.
28 * You use it as follows:
32 * vfs objects = full_audit
33 * full_audit:prefix = %u|%I
34 * full_audit:success = open opendir
35 * full_audit:failure = all
37 * vfs op can be "all" which means log all operations.
38 * vfs op can be "none" which means no logging.
40 * This leads to syslog entries of the form:
41 * smbd_audit: nobody|192.168.234.1|opendir|ok|.
42 * smbd_audit: nobody|192.168.234.1|open|fail (File not found)|r|x.txt
44 * where "nobody" is the connected username and "192.168.234.1" is the
45 * client's IP address.
49 * prefix: A macro expansion template prepended to the syslog entry.
51 * success: A list of VFS operations for which a successful completion should
52 * be logged. Defaults to no logging at all. The special operation "all" logs
53 * - you guessed it - everything.
55 * failure: A list of VFS operations for which failure to complete should be
56 * logged. Defaults to logging everything.
61 #include "system/filesys.h"
62 #include "system/syslog.h"
63 #include "smbd/smbd.h"
64 #include "../librpc/gen_ndr/ndr_netlogon.h"
67 #include "lib/param/loadparm.h"
68 #include "lib/util/bitmap.h"
69 #include "lib/util/tevent_unix.h"
70 #include "libcli/security/sddl.h"
71 #include "passdb/machine_sid.h"
73 static int vfs_full_audit_debug_level
= DBGC_VFS
;
75 struct vfs_full_audit_private_data
{
76 struct bitmap
*success_ops
;
77 struct bitmap
*failure_ops
;
85 #define DBGC_CLASS vfs_full_audit_debug_level
87 typedef enum _vfs_op_type
{
92 SMB_VFS_OP_CONNECT
= 0,
93 SMB_VFS_OP_DISCONNECT
,
97 SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
99 SMB_VFS_OP_FS_CAPABILITIES
,
101 /* Directory operations */
104 SMB_VFS_OP_FDOPENDIR
,
108 SMB_VFS_OP_REWINDDIR
,
112 SMB_VFS_OP_INIT_SEARCH_OP
,
114 /* File operations */
117 SMB_VFS_OP_CREATE_FILE
,
121 SMB_VFS_OP_PREAD_SEND
,
122 SMB_VFS_OP_PREAD_RECV
,
125 SMB_VFS_OP_PWRITE_SEND
,
126 SMB_VFS_OP_PWRITE_RECV
,
132 SMB_VFS_OP_FSYNC_SEND
,
133 SMB_VFS_OP_FSYNC_RECV
,
137 SMB_VFS_OP_GET_ALLOC_SIZE
,
147 SMB_VFS_OP_FTRUNCATE
,
148 SMB_VFS_OP_FALLOCATE
,
150 SMB_VFS_OP_KERNEL_FLOCK
,
151 SMB_VFS_OP_LINUX_SETLEASE
,
158 SMB_VFS_OP_NOTIFY_WATCH
,
160 SMB_VFS_OP_FILE_ID_CREATE
,
161 SMB_VFS_OP_STREAMINFO
,
162 SMB_VFS_OP_GET_REAL_FILENAME
,
163 SMB_VFS_OP_CONNECTPATH
,
164 SMB_VFS_OP_BRL_LOCK_WINDOWS
,
165 SMB_VFS_OP_BRL_UNLOCK_WINDOWS
,
166 SMB_VFS_OP_BRL_CANCEL_WINDOWS
,
167 SMB_VFS_OP_STRICT_LOCK
,
168 SMB_VFS_OP_STRICT_UNLOCK
,
169 SMB_VFS_OP_TRANSLATE_NAME
,
170 SMB_VFS_OP_COPY_CHUNK_SEND
,
171 SMB_VFS_OP_COPY_CHUNK_RECV
,
172 SMB_VFS_OP_GET_COMPRESSION
,
173 SMB_VFS_OP_SET_COMPRESSION
,
175 /* NT ACL operations. */
177 SMB_VFS_OP_FGET_NT_ACL
,
178 SMB_VFS_OP_GET_NT_ACL
,
179 SMB_VFS_OP_FSET_NT_ACL
,
181 /* POSIX ACL operations. */
183 SMB_VFS_OP_CHMOD_ACL
,
184 SMB_VFS_OP_FCHMOD_ACL
,
186 SMB_VFS_OP_SYS_ACL_GET_FILE
,
187 SMB_VFS_OP_SYS_ACL_GET_FD
,
188 SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE
,
189 SMB_VFS_OP_SYS_ACL_BLOB_GET_FD
,
190 SMB_VFS_OP_SYS_ACL_SET_FILE
,
191 SMB_VFS_OP_SYS_ACL_SET_FD
,
192 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
196 SMB_VFS_OP_FGETXATTR
,
197 SMB_VFS_OP_LISTXATTR
,
198 SMB_VFS_OP_FLISTXATTR
,
199 SMB_VFS_OP_REMOVEXATTR
,
200 SMB_VFS_OP_FREMOVEXATTR
,
202 SMB_VFS_OP_FSETXATTR
,
205 SMB_VFS_OP_AIO_FORCE
,
207 /* offline operations */
208 SMB_VFS_OP_IS_OFFLINE
,
209 SMB_VFS_OP_SET_OFFLINE
,
211 /* This should always be last enum value */
216 /* The following array *must* be in the same order as defined in vfs_op_type */
222 { SMB_VFS_OP_CONNECT
, "connect" },
223 { SMB_VFS_OP_DISCONNECT
, "disconnect" },
224 { SMB_VFS_OP_DISK_FREE
, "disk_free" },
225 { SMB_VFS_OP_GET_QUOTA
, "get_quota" },
226 { SMB_VFS_OP_SET_QUOTA
, "set_quota" },
227 { SMB_VFS_OP_GET_SHADOW_COPY_DATA
, "get_shadow_copy_data" },
228 { SMB_VFS_OP_STATVFS
, "statvfs" },
229 { SMB_VFS_OP_FS_CAPABILITIES
, "fs_capabilities" },
230 { SMB_VFS_OP_OPENDIR
, "opendir" },
231 { SMB_VFS_OP_FDOPENDIR
, "fdopendir" },
232 { SMB_VFS_OP_READDIR
, "readdir" },
233 { SMB_VFS_OP_SEEKDIR
, "seekdir" },
234 { SMB_VFS_OP_TELLDIR
, "telldir" },
235 { SMB_VFS_OP_REWINDDIR
, "rewinddir" },
236 { SMB_VFS_OP_MKDIR
, "mkdir" },
237 { SMB_VFS_OP_RMDIR
, "rmdir" },
238 { SMB_VFS_OP_CLOSEDIR
, "closedir" },
239 { SMB_VFS_OP_INIT_SEARCH_OP
, "init_search_op" },
240 { SMB_VFS_OP_OPEN
, "open" },
241 { SMB_VFS_OP_CREATE_FILE
, "create_file" },
242 { SMB_VFS_OP_CLOSE
, "close" },
243 { SMB_VFS_OP_READ
, "read" },
244 { SMB_VFS_OP_PREAD
, "pread" },
245 { SMB_VFS_OP_PREAD_SEND
, "pread_send" },
246 { SMB_VFS_OP_PREAD_RECV
, "pread_recv" },
247 { SMB_VFS_OP_WRITE
, "write" },
248 { SMB_VFS_OP_PWRITE
, "pwrite" },
249 { SMB_VFS_OP_PWRITE_SEND
, "pwrite_send" },
250 { SMB_VFS_OP_PWRITE_RECV
, "pwrite_recv" },
251 { SMB_VFS_OP_LSEEK
, "lseek" },
252 { SMB_VFS_OP_SENDFILE
, "sendfile" },
253 { SMB_VFS_OP_RECVFILE
, "recvfile" },
254 { SMB_VFS_OP_RENAME
, "rename" },
255 { SMB_VFS_OP_FSYNC
, "fsync" },
256 { SMB_VFS_OP_FSYNC_SEND
, "fsync_send" },
257 { SMB_VFS_OP_FSYNC_RECV
, "fsync_recv" },
258 { SMB_VFS_OP_STAT
, "stat" },
259 { SMB_VFS_OP_FSTAT
, "fstat" },
260 { SMB_VFS_OP_LSTAT
, "lstat" },
261 { SMB_VFS_OP_GET_ALLOC_SIZE
, "get_alloc_size" },
262 { SMB_VFS_OP_UNLINK
, "unlink" },
263 { SMB_VFS_OP_CHMOD
, "chmod" },
264 { SMB_VFS_OP_FCHMOD
, "fchmod" },
265 { SMB_VFS_OP_CHOWN
, "chown" },
266 { SMB_VFS_OP_FCHOWN
, "fchown" },
267 { SMB_VFS_OP_LCHOWN
, "lchown" },
268 { SMB_VFS_OP_CHDIR
, "chdir" },
269 { SMB_VFS_OP_GETWD
, "getwd" },
270 { SMB_VFS_OP_NTIMES
, "ntimes" },
271 { SMB_VFS_OP_FTRUNCATE
, "ftruncate" },
272 { SMB_VFS_OP_FALLOCATE
,"fallocate" },
273 { SMB_VFS_OP_LOCK
, "lock" },
274 { SMB_VFS_OP_KERNEL_FLOCK
, "kernel_flock" },
275 { SMB_VFS_OP_LINUX_SETLEASE
, "linux_setlease" },
276 { SMB_VFS_OP_GETLOCK
, "getlock" },
277 { SMB_VFS_OP_SYMLINK
, "symlink" },
278 { SMB_VFS_OP_READLINK
, "readlink" },
279 { SMB_VFS_OP_LINK
, "link" },
280 { SMB_VFS_OP_MKNOD
, "mknod" },
281 { SMB_VFS_OP_REALPATH
, "realpath" },
282 { SMB_VFS_OP_NOTIFY_WATCH
, "notify_watch" },
283 { SMB_VFS_OP_CHFLAGS
, "chflags" },
284 { SMB_VFS_OP_FILE_ID_CREATE
, "file_id_create" },
285 { SMB_VFS_OP_STREAMINFO
, "streaminfo" },
286 { SMB_VFS_OP_GET_REAL_FILENAME
, "get_real_filename" },
287 { SMB_VFS_OP_CONNECTPATH
, "connectpath" },
288 { SMB_VFS_OP_BRL_LOCK_WINDOWS
, "brl_lock_windows" },
289 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, "brl_unlock_windows" },
290 { SMB_VFS_OP_BRL_CANCEL_WINDOWS
, "brl_cancel_windows" },
291 { SMB_VFS_OP_STRICT_LOCK
, "strict_lock" },
292 { SMB_VFS_OP_STRICT_UNLOCK
, "strict_unlock" },
293 { SMB_VFS_OP_TRANSLATE_NAME
, "translate_name" },
294 { SMB_VFS_OP_COPY_CHUNK_SEND
, "copy_chunk_send" },
295 { SMB_VFS_OP_COPY_CHUNK_RECV
, "copy_chunk_recv" },
296 { SMB_VFS_OP_GET_COMPRESSION
, "get_compression" },
297 { SMB_VFS_OP_SET_COMPRESSION
, "set_compression" },
298 { SMB_VFS_OP_FGET_NT_ACL
, "fget_nt_acl" },
299 { SMB_VFS_OP_GET_NT_ACL
, "get_nt_acl" },
300 { SMB_VFS_OP_FSET_NT_ACL
, "fset_nt_acl" },
301 { SMB_VFS_OP_CHMOD_ACL
, "chmod_acl" },
302 { SMB_VFS_OP_FCHMOD_ACL
, "fchmod_acl" },
303 { SMB_VFS_OP_SYS_ACL_GET_FILE
, "sys_acl_get_file" },
304 { SMB_VFS_OP_SYS_ACL_GET_FD
, "sys_acl_get_fd" },
305 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE
, "sys_acl_blob_get_file" },
306 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FD
, "sys_acl_blob_get_fd" },
307 { SMB_VFS_OP_SYS_ACL_SET_FILE
, "sys_acl_set_file" },
308 { SMB_VFS_OP_SYS_ACL_SET_FD
, "sys_acl_set_fd" },
309 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, "sys_acl_delete_def_file" },
310 { SMB_VFS_OP_GETXATTR
, "getxattr" },
311 { SMB_VFS_OP_FGETXATTR
, "fgetxattr" },
312 { SMB_VFS_OP_LISTXATTR
, "listxattr" },
313 { SMB_VFS_OP_FLISTXATTR
, "flistxattr" },
314 { SMB_VFS_OP_REMOVEXATTR
, "removexattr" },
315 { SMB_VFS_OP_FREMOVEXATTR
, "fremovexattr" },
316 { SMB_VFS_OP_SETXATTR
, "setxattr" },
317 { SMB_VFS_OP_FSETXATTR
, "fsetxattr" },
318 { SMB_VFS_OP_AIO_FORCE
, "aio_force" },
319 { SMB_VFS_OP_IS_OFFLINE
, "is_offline" },
320 { SMB_VFS_OP_SET_OFFLINE
, "set_offline" },
321 { SMB_VFS_OP_LAST
, NULL
}
324 static int audit_syslog_facility(vfs_handle_struct
*handle
)
326 static const struct enum_list enum_log_facilities
[] = {
327 { LOG_USER
, "USER" },
328 { LOG_LOCAL0
, "LOCAL0" },
329 { LOG_LOCAL1
, "LOCAL1" },
330 { LOG_LOCAL2
, "LOCAL2" },
331 { LOG_LOCAL3
, "LOCAL3" },
332 { LOG_LOCAL4
, "LOCAL4" },
333 { LOG_LOCAL5
, "LOCAL5" },
334 { LOG_LOCAL6
, "LOCAL6" },
335 { LOG_LOCAL7
, "LOCAL7" },
341 facility
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "facility", enum_log_facilities
, LOG_USER
);
346 static int audit_syslog_priority(vfs_handle_struct
*handle
)
348 static const struct enum_list enum_log_priorities
[] = {
349 { LOG_EMERG
, "EMERG" },
350 { LOG_ALERT
, "ALERT" },
351 { LOG_CRIT
, "CRIT" },
353 { LOG_WARNING
, "WARNING" },
354 { LOG_NOTICE
, "NOTICE" },
355 { LOG_INFO
, "INFO" },
356 { LOG_DEBUG
, "DEBUG" },
362 priority
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "priority",
363 enum_log_priorities
, LOG_NOTICE
);
364 if (priority
== -1) {
365 priority
= LOG_WARNING
;
371 static char *audit_prefix(TALLOC_CTX
*ctx
, connection_struct
*conn
)
376 prefix
= talloc_strdup(ctx
,
377 lp_parm_const_string(SNUM(conn
), "full_audit",
382 result
= talloc_sub_advanced(ctx
,
383 lp_servicename(talloc_tos(), SNUM(conn
)),
384 conn
->session_info
->unix_info
->unix_name
,
386 conn
->session_info
->unix_token
->gid
,
387 conn
->session_info
->unix_info
->sanitized_username
,
388 conn
->session_info
->info
->domain_name
,
394 static bool log_success(struct vfs_full_audit_private_data
*pd
, vfs_op_type op
)
396 if (pd
->success_ops
== NULL
) {
400 return bitmap_query(pd
->success_ops
, op
);
403 static bool log_failure(struct vfs_full_audit_private_data
*pd
, vfs_op_type op
)
405 if (pd
->failure_ops
== NULL
)
408 return bitmap_query(pd
->failure_ops
, op
);
411 static struct bitmap
*init_bitmap(TALLOC_CTX
*mem_ctx
, const char **ops
)
419 bm
= bitmap_talloc(mem_ctx
, SMB_VFS_OP_LAST
);
421 DEBUG(0, ("Could not alloc bitmap -- "
422 "defaulting to logging everything\n"));
426 for (; *ops
!= NULL
; ops
+= 1) {
431 if (strequal(*ops
, "all")) {
432 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
438 if (strequal(*ops
, "none")) {
448 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
449 if ((vfs_op_names
[i
].name
== NULL
)
450 || (vfs_op_names
[i
].type
!= i
)) {
451 smb_panic("vfs_full_audit.c: name table not "
452 "in sync with vfs_op_type enums\n");
454 if (strequal(op
, vfs_op_names
[i
].name
)) {
463 if (i
== SMB_VFS_OP_LAST
) {
464 DEBUG(0, ("Could not find opname %s, logging all\n",
473 static const char *audit_opname(vfs_op_type op
)
475 if (op
>= SMB_VFS_OP_LAST
)
476 return "INVALID VFS OP";
477 return vfs_op_names
[op
].name
;
480 static TALLOC_CTX
*tmp_do_log_ctx
;
482 * Get us a temporary talloc context usable just for DEBUG arguments
484 static TALLOC_CTX
*do_log_ctx(void)
486 if (tmp_do_log_ctx
== NULL
) {
487 tmp_do_log_ctx
= talloc_named_const(NULL
, 0, "do_log_ctx");
489 return tmp_do_log_ctx
;
492 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
493 const char *format
, ...)
495 struct vfs_full_audit_private_data
*pd
;
497 char *audit_pre
= NULL
;
501 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
502 struct vfs_full_audit_private_data
,
505 if (success
&& (!log_success(pd
, op
)))
508 if (!success
&& (!log_failure(pd
, op
)))
512 fstrcpy(err_msg
, "ok");
514 fstr_sprintf(err_msg
, "fail (%s)", strerror(errno
));
516 va_start(ap
, format
);
517 op_msg
= talloc_vasprintf(talloc_tos(), format
, ap
);
524 audit_pre
= audit_prefix(talloc_tos(), handle
->conn
);
530 * Specify the facility to interoperate with other syslog
531 * callers (smbd for example).
533 priority
= pd
->syslog_priority
| pd
->syslog_facility
;
535 syslog(priority
, "%s|%s|%s|%s\n",
536 audit_pre
? audit_pre
: "",
537 audit_opname(op
), err_msg
, op_msg
);
539 DEBUG(1, ("%s|%s|%s|%s\n",
540 audit_pre
? audit_pre
: "",
541 audit_opname(op
), err_msg
, op_msg
));
544 TALLOC_FREE(audit_pre
);
546 TALLOC_FREE(tmp_do_log_ctx
);
550 * Return a string using the do_log_ctx()
552 static const char *smb_fname_str_do_log(const struct smb_filename
*smb_fname
)
557 if (smb_fname
== NULL
) {
560 status
= get_full_smb_filename(do_log_ctx(), smb_fname
, &fname
);
561 if (!NT_STATUS_IS_OK(status
)) {
568 * Return an fsp debug string using the do_log_ctx()
570 static const char *fsp_str_do_log(const struct files_struct
*fsp
)
572 return smb_fname_str_do_log(fsp
->fsp_name
);
575 /* Implementation of vfs_ops. Pass everything on to the default
576 operation but log event first. */
578 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
579 const char *svc
, const char *user
)
582 struct vfs_full_audit_private_data
*pd
= NULL
;
584 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
589 pd
= talloc_zero(handle
, struct vfs_full_audit_private_data
);
591 SMB_VFS_NEXT_DISCONNECT(handle
);
595 pd
->syslog_facility
= audit_syslog_facility(handle
);
596 if (pd
->syslog_facility
== -1) {
597 DEBUG(1, ("%s: Unknown facility %s\n", __func__
,
598 lp_parm_const_string(SNUM(handle
->conn
),
599 "full_audit", "facility",
601 SMB_VFS_NEXT_DISCONNECT(handle
);
605 pd
->syslog_priority
= audit_syslog_priority(handle
);
607 pd
->log_secdesc
= lp_parm_bool(SNUM(handle
->conn
),
608 "full_audit", "log_secdesc", false);
610 pd
->do_syslog
= lp_parm_bool(SNUM(handle
->conn
),
611 "full_audit", "syslog", true);
615 openlog("smbd_audit", 0, pd
->syslog_facility
);
619 pd
->success_ops
= init_bitmap(
620 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
622 pd
->failure_ops
= init_bitmap(
623 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
626 /* Store the private data. */
627 SMB_VFS_HANDLE_SET_DATA(handle
, pd
, NULL
,
628 struct vfs_full_audit_private_data
, return -1);
630 do_log(SMB_VFS_OP_CONNECT
, True
, handle
,
636 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
)
638 SMB_VFS_NEXT_DISCONNECT(handle
);
640 do_log(SMB_VFS_OP_DISCONNECT
, True
, handle
,
641 "%s", lp_servicename(talloc_tos(), SNUM(handle
->conn
)));
643 /* The bitmaps will be disconnected when the private
647 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
649 bool small_query
, uint64_t *bsize
,
650 uint64_t *dfree
, uint64_t *dsize
)
654 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
657 /* Don't have a reasonable notion of failure here */
659 do_log(SMB_VFS_OP_DISK_FREE
, True
, handle
, "%s", path
);
664 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
665 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
670 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
672 do_log(SMB_VFS_OP_GET_QUOTA
, (result
>= 0), handle
, "");
678 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
679 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
684 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
686 do_log(SMB_VFS_OP_SET_QUOTA
, (result
>= 0), handle
, "");
691 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
692 struct files_struct
*fsp
,
693 struct shadow_copy_data
*shadow_copy_data
,
698 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
, labels
);
700 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA
, (result
>= 0), handle
, "");
705 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
707 struct vfs_statvfs_struct
*statbuf
)
711 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
713 do_log(SMB_VFS_OP_STATVFS
, (result
>= 0), handle
, "");
718 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
, enum timestamp_set_resolution
*p_ts_res
)
722 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
724 do_log(SMB_VFS_OP_FS_CAPABILITIES
, true, handle
, "");
729 static DIR *smb_full_audit_opendir(vfs_handle_struct
*handle
,
730 const char *fname
, const char *mask
, uint32 attr
)
734 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
736 do_log(SMB_VFS_OP_OPENDIR
, (result
!= NULL
), handle
, "%s", fname
);
741 static DIR *smb_full_audit_fdopendir(vfs_handle_struct
*handle
,
742 files_struct
*fsp
, const char *mask
, uint32 attr
)
746 result
= SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
748 do_log(SMB_VFS_OP_FDOPENDIR
, (result
!= NULL
), handle
, "%s",
749 fsp_str_do_log(fsp
));
754 static struct dirent
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
755 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
757 struct dirent
*result
;
759 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
761 /* This operation has no reasonable error condition
762 * (End of dir is also failure), so always succeed.
764 do_log(SMB_VFS_OP_READDIR
, True
, handle
, "");
769 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
770 DIR *dirp
, long offset
)
772 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
774 do_log(SMB_VFS_OP_SEEKDIR
, True
, handle
, "");
777 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
782 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
784 do_log(SMB_VFS_OP_TELLDIR
, True
, handle
, "");
789 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
792 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
794 do_log(SMB_VFS_OP_REWINDDIR
, True
, handle
, "");
797 static int smb_full_audit_mkdir(vfs_handle_struct
*handle
,
798 const char *path
, mode_t mode
)
802 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
804 do_log(SMB_VFS_OP_MKDIR
, (result
>= 0), handle
, "%s", path
);
809 static int smb_full_audit_rmdir(vfs_handle_struct
*handle
,
814 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
816 do_log(SMB_VFS_OP_RMDIR
, (result
>= 0), handle
, "%s", path
);
821 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
826 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
828 do_log(SMB_VFS_OP_CLOSEDIR
, (result
>= 0), handle
, "");
833 static void smb_full_audit_init_search_op(vfs_handle_struct
*handle
,
836 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
838 do_log(SMB_VFS_OP_INIT_SEARCH_OP
, True
, handle
, "");
841 static int smb_full_audit_open(vfs_handle_struct
*handle
,
842 struct smb_filename
*smb_fname
,
843 files_struct
*fsp
, int flags
, mode_t mode
)
847 result
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
849 do_log(SMB_VFS_OP_OPEN
, (result
>= 0), handle
, "%s|%s",
850 ((flags
& O_WRONLY
) || (flags
& O_RDWR
))?"w":"r",
851 smb_fname_str_do_log(smb_fname
));
856 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
857 struct smb_request
*req
,
858 uint16_t root_dir_fid
,
859 struct smb_filename
*smb_fname
,
860 uint32_t access_mask
,
861 uint32_t share_access
,
862 uint32_t create_disposition
,
863 uint32_t create_options
,
864 uint32_t file_attributes
,
865 uint32_t oplock_request
,
866 struct smb2_lease
*lease
,
867 uint64_t allocation_size
,
868 uint32_t private_flags
,
869 struct security_descriptor
*sd
,
870 struct ea_list
*ea_list
,
871 files_struct
**result_fsp
,
875 const char* str_create_disposition
;
877 switch (create_disposition
) {
879 str_create_disposition
= "supersede";
881 case FILE_OVERWRITE_IF
:
882 str_create_disposition
= "overwrite_if";
885 str_create_disposition
= "open";
888 str_create_disposition
= "overwrite";
891 str_create_disposition
= "create";
894 str_create_disposition
= "open_if";
897 str_create_disposition
= "unknown";
900 result
= SMB_VFS_NEXT_CREATE_FILE(
903 root_dir_fid
, /* root_dir_fid */
904 smb_fname
, /* fname */
905 access_mask
, /* access_mask */
906 share_access
, /* share_access */
907 create_disposition
, /* create_disposition*/
908 create_options
, /* create_options */
909 file_attributes
, /* file_attributes */
910 oplock_request
, /* oplock_request */
912 allocation_size
, /* allocation_size */
915 ea_list
, /* ea_list */
916 result_fsp
, /* result */
919 do_log(SMB_VFS_OP_CREATE_FILE
, (NT_STATUS_IS_OK(result
)), handle
,
920 "0x%x|%s|%s|%s", access_mask
,
921 create_options
& FILE_DIRECTORY_FILE
? "dir" : "file",
922 str_create_disposition
, smb_fname_str_do_log(smb_fname
));
927 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
931 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
933 do_log(SMB_VFS_OP_CLOSE
, (result
>= 0), handle
, "%s",
934 fsp_str_do_log(fsp
));
939 static ssize_t
smb_full_audit_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
940 void *data
, size_t n
)
944 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
946 do_log(SMB_VFS_OP_READ
, (result
>= 0), handle
, "%s",
947 fsp_str_do_log(fsp
));
952 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
953 void *data
, size_t n
, off_t offset
)
957 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
959 do_log(SMB_VFS_OP_PREAD
, (result
>= 0), handle
, "%s",
960 fsp_str_do_log(fsp
));
965 struct smb_full_audit_pread_state
{
966 vfs_handle_struct
*handle
;
972 static void smb_full_audit_pread_done(struct tevent_req
*subreq
);
974 static struct tevent_req
*smb_full_audit_pread_send(
975 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
976 struct tevent_context
*ev
, struct files_struct
*fsp
,
977 void *data
, size_t n
, off_t offset
)
979 struct tevent_req
*req
, *subreq
;
980 struct smb_full_audit_pread_state
*state
;
982 req
= tevent_req_create(mem_ctx
, &state
,
983 struct smb_full_audit_pread_state
);
985 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
986 fsp_str_do_log(fsp
));
989 state
->handle
= handle
;
992 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
994 if (tevent_req_nomem(subreq
, req
)) {
995 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
996 fsp_str_do_log(fsp
));
997 return tevent_req_post(req
, ev
);
999 tevent_req_set_callback(subreq
, smb_full_audit_pread_done
, req
);
1001 do_log(SMB_VFS_OP_PREAD_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1005 static void smb_full_audit_pread_done(struct tevent_req
*subreq
)
1007 struct tevent_req
*req
= tevent_req_callback_data(
1008 subreq
, struct tevent_req
);
1009 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1010 req
, struct smb_full_audit_pread_state
);
1012 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
1013 TALLOC_FREE(subreq
);
1014 tevent_req_done(req
);
1017 static ssize_t
smb_full_audit_pread_recv(struct tevent_req
*req
, int *err
)
1019 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1020 req
, struct smb_full_audit_pread_state
);
1022 if (tevent_req_is_unix_error(req
, err
)) {
1023 do_log(SMB_VFS_OP_PREAD_RECV
, false, state
->handle
, "%s",
1024 fsp_str_do_log(state
->fsp
));
1028 do_log(SMB_VFS_OP_PREAD_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1029 fsp_str_do_log(state
->fsp
));
1035 static ssize_t
smb_full_audit_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
1036 const void *data
, size_t n
)
1040 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
1042 do_log(SMB_VFS_OP_WRITE
, (result
>= 0), handle
, "%s",
1043 fsp_str_do_log(fsp
));
1048 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
1049 const void *data
, size_t n
,
1054 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
1056 do_log(SMB_VFS_OP_PWRITE
, (result
>= 0), handle
, "%s",
1057 fsp_str_do_log(fsp
));
1062 struct smb_full_audit_pwrite_state
{
1063 vfs_handle_struct
*handle
;
1069 static void smb_full_audit_pwrite_done(struct tevent_req
*subreq
);
1071 static struct tevent_req
*smb_full_audit_pwrite_send(
1072 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1073 struct tevent_context
*ev
, struct files_struct
*fsp
,
1074 const void *data
, size_t n
, off_t offset
)
1076 struct tevent_req
*req
, *subreq
;
1077 struct smb_full_audit_pwrite_state
*state
;
1079 req
= tevent_req_create(mem_ctx
, &state
,
1080 struct smb_full_audit_pwrite_state
);
1082 do_log(SMB_VFS_OP_PWRITE_SEND
, false, handle
, "%s",
1083 fsp_str_do_log(fsp
));
1086 state
->handle
= handle
;
1089 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
1091 if (tevent_req_nomem(subreq
, req
)) {
1092 do_log(SMB_VFS_OP_PWRITE_SEND
, false, handle
, "%s",
1093 fsp_str_do_log(fsp
));
1094 return tevent_req_post(req
, ev
);
1096 tevent_req_set_callback(subreq
, smb_full_audit_pwrite_done
, req
);
1098 do_log(SMB_VFS_OP_PWRITE_SEND
, true, handle
, "%s",
1099 fsp_str_do_log(fsp
));
1103 static void smb_full_audit_pwrite_done(struct tevent_req
*subreq
)
1105 struct tevent_req
*req
= tevent_req_callback_data(
1106 subreq
, struct tevent_req
);
1107 struct smb_full_audit_pwrite_state
*state
= tevent_req_data(
1108 req
, struct smb_full_audit_pwrite_state
);
1110 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
1111 TALLOC_FREE(subreq
);
1112 tevent_req_done(req
);
1115 static ssize_t
smb_full_audit_pwrite_recv(struct tevent_req
*req
, int *err
)
1117 struct smb_full_audit_pwrite_state
*state
= tevent_req_data(
1118 req
, struct smb_full_audit_pwrite_state
);
1120 if (tevent_req_is_unix_error(req
, err
)) {
1121 do_log(SMB_VFS_OP_PWRITE_RECV
, false, state
->handle
, "%s",
1122 fsp_str_do_log(state
->fsp
));
1126 do_log(SMB_VFS_OP_PWRITE_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1127 fsp_str_do_log(state
->fsp
));
1133 static off_t
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
1134 off_t offset
, int whence
)
1138 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
1140 do_log(SMB_VFS_OP_LSEEK
, (result
!= (ssize_t
)-1), handle
,
1141 "%s", fsp_str_do_log(fsp
));
1146 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
1147 files_struct
*fromfsp
,
1148 const DATA_BLOB
*hdr
, off_t offset
,
1153 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
1155 do_log(SMB_VFS_OP_SENDFILE
, (result
>= 0), handle
,
1156 "%s", fsp_str_do_log(fromfsp
));
1161 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
1162 files_struct
*tofsp
,
1168 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
1170 do_log(SMB_VFS_OP_RECVFILE
, (result
>= 0), handle
,
1171 "%s", fsp_str_do_log(tofsp
));
1176 static int smb_full_audit_rename(vfs_handle_struct
*handle
,
1177 const struct smb_filename
*smb_fname_src
,
1178 const struct smb_filename
*smb_fname_dst
)
1182 result
= SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
1184 do_log(SMB_VFS_OP_RENAME
, (result
>= 0), handle
, "%s|%s",
1185 smb_fname_str_do_log(smb_fname_src
),
1186 smb_fname_str_do_log(smb_fname_dst
));
1191 static int smb_full_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
1195 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
1197 do_log(SMB_VFS_OP_FSYNC
, (result
>= 0), handle
, "%s",
1198 fsp_str_do_log(fsp
));
1203 struct smb_full_audit_fsync_state
{
1204 vfs_handle_struct
*handle
;
1210 static void smb_full_audit_fsync_done(struct tevent_req
*subreq
);
1212 static struct tevent_req
*smb_full_audit_fsync_send(
1213 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1214 struct tevent_context
*ev
, struct files_struct
*fsp
)
1216 struct tevent_req
*req
, *subreq
;
1217 struct smb_full_audit_fsync_state
*state
;
1219 req
= tevent_req_create(mem_ctx
, &state
,
1220 struct smb_full_audit_fsync_state
);
1222 do_log(SMB_VFS_OP_FSYNC_SEND
, false, handle
, "%s",
1223 fsp_str_do_log(fsp
));
1226 state
->handle
= handle
;
1229 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
1230 if (tevent_req_nomem(subreq
, req
)) {
1231 do_log(SMB_VFS_OP_FSYNC_SEND
, false, handle
, "%s",
1232 fsp_str_do_log(fsp
));
1233 return tevent_req_post(req
, ev
);
1235 tevent_req_set_callback(subreq
, smb_full_audit_fsync_done
, req
);
1237 do_log(SMB_VFS_OP_FSYNC_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1241 static void smb_full_audit_fsync_done(struct tevent_req
*subreq
)
1243 struct tevent_req
*req
= tevent_req_callback_data(
1244 subreq
, struct tevent_req
);
1245 struct smb_full_audit_fsync_state
*state
= tevent_req_data(
1246 req
, struct smb_full_audit_fsync_state
);
1248 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
1249 TALLOC_FREE(subreq
);
1250 tevent_req_done(req
);
1253 static int smb_full_audit_fsync_recv(struct tevent_req
*req
, int *err
)
1255 struct smb_full_audit_fsync_state
*state
= tevent_req_data(
1256 req
, struct smb_full_audit_fsync_state
);
1258 if (tevent_req_is_unix_error(req
, err
)) {
1259 do_log(SMB_VFS_OP_FSYNC_RECV
, false, state
->handle
, "%s",
1260 fsp_str_do_log(state
->fsp
));
1264 do_log(SMB_VFS_OP_FSYNC_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1265 fsp_str_do_log(state
->fsp
));
1271 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
1272 struct smb_filename
*smb_fname
)
1276 result
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
1278 do_log(SMB_VFS_OP_STAT
, (result
>= 0), handle
, "%s",
1279 smb_fname_str_do_log(smb_fname
));
1284 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1285 SMB_STRUCT_STAT
*sbuf
)
1289 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1291 do_log(SMB_VFS_OP_FSTAT
, (result
>= 0), handle
, "%s",
1292 fsp_str_do_log(fsp
));
1297 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
1298 struct smb_filename
*smb_fname
)
1302 result
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
1304 do_log(SMB_VFS_OP_LSTAT
, (result
>= 0), handle
, "%s",
1305 smb_fname_str_do_log(smb_fname
));
1310 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
1311 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
1315 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1317 do_log(SMB_VFS_OP_GET_ALLOC_SIZE
, (result
!= (uint64_t)-1), handle
,
1323 static int smb_full_audit_unlink(vfs_handle_struct
*handle
,
1324 const struct smb_filename
*smb_fname
)
1328 result
= SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
1330 do_log(SMB_VFS_OP_UNLINK
, (result
>= 0), handle
, "%s",
1331 smb_fname_str_do_log(smb_fname
));
1336 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
1337 const char *path
, mode_t mode
)
1341 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1343 do_log(SMB_VFS_OP_CHMOD
, (result
>= 0), handle
, "%s|%o", path
, mode
);
1348 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1353 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1355 do_log(SMB_VFS_OP_FCHMOD
, (result
>= 0), handle
,
1356 "%s|%o", fsp_str_do_log(fsp
), mode
);
1361 static int smb_full_audit_chown(vfs_handle_struct
*handle
,
1362 const char *path
, uid_t uid
, gid_t gid
)
1366 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1368 do_log(SMB_VFS_OP_CHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1369 path
, (long int)uid
, (long int)gid
);
1374 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1375 uid_t uid
, gid_t gid
)
1379 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1381 do_log(SMB_VFS_OP_FCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1382 fsp_str_do_log(fsp
), (long int)uid
, (long int)gid
);
1387 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
1388 const char *path
, uid_t uid
, gid_t gid
)
1392 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1394 do_log(SMB_VFS_OP_LCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1395 path
, (long int)uid
, (long int)gid
);
1400 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
1405 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
1407 do_log(SMB_VFS_OP_CHDIR
, (result
>= 0), handle
, "chdir|%s", path
);
1412 static char *smb_full_audit_getwd(vfs_handle_struct
*handle
)
1416 result
= SMB_VFS_NEXT_GETWD(handle
);
1418 do_log(SMB_VFS_OP_GETWD
, (result
!= NULL
), handle
, "%s",
1419 result
== NULL
? "" : result
);
1424 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
1425 const struct smb_filename
*smb_fname
,
1426 struct smb_file_time
*ft
)
1430 result
= SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
1432 do_log(SMB_VFS_OP_NTIMES
, (result
>= 0), handle
, "%s",
1433 smb_fname_str_do_log(smb_fname
));
1438 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1443 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1445 do_log(SMB_VFS_OP_FTRUNCATE
, (result
>= 0), handle
,
1446 "%s", fsp_str_do_log(fsp
));
1451 static int smb_full_audit_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1452 enum vfs_fallocate_mode mode
,
1458 result
= SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1460 do_log(SMB_VFS_OP_FALLOCATE
, (result
>= 0), handle
,
1461 "%s", fsp_str_do_log(fsp
));
1466 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1467 int op
, off_t offset
, off_t count
, int type
)
1471 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1473 do_log(SMB_VFS_OP_LOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1478 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1479 struct files_struct
*fsp
,
1480 uint32 share_mode
, uint32 access_mask
)
1484 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
1486 do_log(SMB_VFS_OP_KERNEL_FLOCK
, (result
>= 0), handle
, "%s",
1487 fsp_str_do_log(fsp
));
1492 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1497 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1499 do_log(SMB_VFS_OP_LINUX_SETLEASE
, (result
>= 0), handle
, "%s",
1500 fsp_str_do_log(fsp
));
1505 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1506 off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
)
1510 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
1512 do_log(SMB_VFS_OP_GETLOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1517 static int smb_full_audit_symlink(vfs_handle_struct
*handle
,
1518 const char *oldpath
, const char *newpath
)
1522 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1524 do_log(SMB_VFS_OP_SYMLINK
, (result
>= 0), handle
,
1525 "%s|%s", oldpath
, newpath
);
1530 static int smb_full_audit_readlink(vfs_handle_struct
*handle
,
1531 const char *path
, char *buf
, size_t bufsiz
)
1535 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1537 do_log(SMB_VFS_OP_READLINK
, (result
>= 0), handle
, "%s", path
);
1542 static int smb_full_audit_link(vfs_handle_struct
*handle
,
1543 const char *oldpath
, const char *newpath
)
1547 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
1549 do_log(SMB_VFS_OP_LINK
, (result
>= 0), handle
,
1550 "%s|%s", oldpath
, newpath
);
1555 static int smb_full_audit_mknod(vfs_handle_struct
*handle
,
1556 const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1560 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1562 do_log(SMB_VFS_OP_MKNOD
, (result
>= 0), handle
, "%s", pathname
);
1567 static char *smb_full_audit_realpath(vfs_handle_struct
*handle
,
1572 result
= SMB_VFS_NEXT_REALPATH(handle
, path
);
1574 do_log(SMB_VFS_OP_REALPATH
, (result
!= NULL
), handle
, "%s", path
);
1579 static NTSTATUS
smb_full_audit_notify_watch(struct vfs_handle_struct
*handle
,
1580 struct sys_notify_context
*ctx
,
1583 uint32_t *subdir_filter
,
1584 void (*callback
)(struct sys_notify_context
*ctx
,
1586 struct notify_event
*ev
),
1587 void *private_data
, void *handle_p
)
1591 result
= SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
1592 filter
, subdir_filter
, callback
,
1593 private_data
, handle_p
);
1595 do_log(SMB_VFS_OP_NOTIFY_WATCH
, NT_STATUS_IS_OK(result
), handle
, "");
1600 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
1601 const char *path
, unsigned int flags
)
1605 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1607 do_log(SMB_VFS_OP_CHFLAGS
, (result
!= 0), handle
, "%s", path
);
1612 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
1613 const SMB_STRUCT_STAT
*sbuf
)
1615 struct file_id id_zero
;
1616 struct file_id result
;
1618 ZERO_STRUCT(id_zero
);
1620 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1622 do_log(SMB_VFS_OP_FILE_ID_CREATE
,
1623 !file_id_equal(&id_zero
, &result
),
1624 handle
, "%s", file_id_string_tos(&result
));
1629 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
1630 struct files_struct
*fsp
,
1632 TALLOC_CTX
*mem_ctx
,
1633 unsigned int *pnum_streams
,
1634 struct stream_struct
**pstreams
)
1638 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1639 pnum_streams
, pstreams
);
1641 do_log(SMB_VFS_OP_STREAMINFO
, NT_STATUS_IS_OK(result
), handle
,
1647 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1650 TALLOC_CTX
*mem_ctx
,
1655 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
1658 do_log(SMB_VFS_OP_GET_REAL_FILENAME
, (result
== 0), handle
,
1659 "%s/%s->%s", path
, name
, (result
== 0) ? "" : *found_name
);
1664 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
1669 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1671 do_log(SMB_VFS_OP_CONNECTPATH
, result
!= NULL
, handle
,
1677 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1678 struct byte_range_lock
*br_lck
,
1679 struct lock_struct
*plock
,
1684 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1687 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS
, NT_STATUS_IS_OK(result
), handle
,
1688 "%s:%llu-%llu. type=%d. blocking=%d",
1689 fsp_str_do_log(brl_fsp(br_lck
)),
1690 plock
->start
, plock
->size
, plock
->lock_type
, blocking_lock
);
1695 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1696 struct messaging_context
*msg_ctx
,
1697 struct byte_range_lock
*br_lck
,
1698 const struct lock_struct
*plock
)
1702 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1705 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, (result
== 0), handle
,
1706 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck
)),
1708 plock
->size
, plock
->lock_type
);
1713 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1714 struct byte_range_lock
*br_lck
,
1715 struct lock_struct
*plock
)
1719 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
);
1721 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS
, (result
== 0), handle
,
1722 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck
)),
1724 plock
->size
, plock
->lock_type
);
1729 static bool smb_full_audit_strict_lock(struct vfs_handle_struct
*handle
,
1730 struct files_struct
*fsp
,
1731 struct lock_struct
*plock
)
1735 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1737 do_log(SMB_VFS_OP_STRICT_LOCK
, result
, handle
,
1738 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1739 plock
->size
, plock
->lock_type
);
1744 static void smb_full_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1745 struct files_struct
*fsp
,
1746 struct lock_struct
*plock
)
1748 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1750 do_log(SMB_VFS_OP_STRICT_UNLOCK
, true, handle
,
1751 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1752 plock
->size
, plock
->lock_type
);
1755 static NTSTATUS
smb_full_audit_translate_name(struct vfs_handle_struct
*handle
,
1757 enum vfs_translate_direction direction
,
1758 TALLOC_CTX
*mem_ctx
,
1763 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
1766 do_log(SMB_VFS_OP_TRANSLATE_NAME
, NT_STATUS_IS_OK(result
), handle
, "");
1771 static struct tevent_req
*smb_full_audit_copy_chunk_send(struct vfs_handle_struct
*handle
,
1772 TALLOC_CTX
*mem_ctx
,
1773 struct tevent_context
*ev
,
1774 struct files_struct
*src_fsp
,
1776 struct files_struct
*dest_fsp
,
1780 struct tevent_req
*req
;
1782 req
= SMB_VFS_NEXT_COPY_CHUNK_SEND(handle
, mem_ctx
, ev
, src_fsp
,
1783 src_off
, dest_fsp
, dest_off
, num
);
1785 do_log(SMB_VFS_OP_COPY_CHUNK_SEND
, req
, handle
, "");
1790 static NTSTATUS
smb_full_audit_copy_chunk_recv(struct vfs_handle_struct
*handle
,
1791 struct tevent_req
*req
,
1796 result
= SMB_VFS_NEXT_COPY_CHUNK_RECV(handle
, req
, copied
);
1798 do_log(SMB_VFS_OP_COPY_CHUNK_RECV
, NT_STATUS_IS_OK(result
), handle
, "");
1803 static NTSTATUS
smb_full_audit_get_compression(vfs_handle_struct
*handle
,
1804 TALLOC_CTX
*mem_ctx
,
1805 struct files_struct
*fsp
,
1806 struct smb_filename
*smb_fname
,
1807 uint16_t *_compression_fmt
)
1811 result
= SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
1814 do_log(SMB_VFS_OP_GET_COMPRESSION
, NT_STATUS_IS_OK(result
), handle
,
1816 (fsp
? fsp_str_do_log(fsp
) : smb_fname_str_do_log(smb_fname
)));
1821 static NTSTATUS
smb_full_audit_set_compression(vfs_handle_struct
*handle
,
1822 TALLOC_CTX
*mem_ctx
,
1823 struct files_struct
*fsp
,
1824 uint16_t compression_fmt
)
1828 result
= SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
1831 do_log(SMB_VFS_OP_SET_COMPRESSION
, NT_STATUS_IS_OK(result
), handle
,
1832 "%s", fsp_str_do_log(fsp
));
1837 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1838 uint32 security_info
,
1839 TALLOC_CTX
*mem_ctx
,
1840 struct security_descriptor
**ppdesc
)
1844 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
,
1847 do_log(SMB_VFS_OP_FGET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1848 "%s", fsp_str_do_log(fsp
));
1853 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
1855 uint32 security_info
,
1856 TALLOC_CTX
*mem_ctx
,
1857 struct security_descriptor
**ppdesc
)
1861 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
,
1864 do_log(SMB_VFS_OP_GET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1870 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1871 uint32 security_info_sent
,
1872 const struct security_descriptor
*psd
)
1874 struct vfs_full_audit_private_data
*pd
;
1878 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
1879 struct vfs_full_audit_private_data
,
1880 return NT_STATUS_INTERNAL_ERROR
);
1882 if (pd
->log_secdesc
) {
1883 sd
= sddl_encode(talloc_tos(), psd
, get_global_sam_sid());
1886 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
1888 do_log(SMB_VFS_OP_FSET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1889 "%s [%s]", fsp_str_do_log(fsp
), sd
? sd
: "");
1896 static int smb_full_audit_chmod_acl(vfs_handle_struct
*handle
,
1897 const char *path
, mode_t mode
)
1901 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1903 do_log(SMB_VFS_OP_CHMOD_ACL
, (result
>= 0), handle
,
1904 "%s|%o", path
, mode
);
1909 static int smb_full_audit_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1914 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1916 do_log(SMB_VFS_OP_FCHMOD_ACL
, (result
>= 0), handle
,
1917 "%s|%o", fsp_str_do_log(fsp
), mode
);
1922 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1924 SMB_ACL_TYPE_T type
,
1925 TALLOC_CTX
*mem_ctx
)
1929 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
, mem_ctx
);
1931 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE
, (result
!= NULL
), handle
,
1937 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
1938 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
1942 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
1944 do_log(SMB_VFS_OP_SYS_ACL_GET_FD
, (result
!= NULL
), handle
,
1945 "%s", fsp_str_do_log(fsp
));
1950 static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
1952 TALLOC_CTX
*mem_ctx
,
1953 char **blob_description
,
1958 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, path_p
, mem_ctx
, blob_description
, blob
);
1960 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE
, (result
>= 0), handle
,
1966 static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
1968 TALLOC_CTX
*mem_ctx
,
1969 char **blob_description
,
1974 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
, blob_description
, blob
);
1976 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD
, (result
>= 0), handle
,
1977 "%s", fsp_str_do_log(fsp
));
1982 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
1984 const char *name
, SMB_ACL_TYPE_T acltype
,
1989 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
1992 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE
, (result
>= 0), handle
,
1998 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
2003 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
2005 do_log(SMB_VFS_OP_SYS_ACL_SET_FD
, (result
>= 0), handle
,
2006 "%s", fsp_str_do_log(fsp
));
2011 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
2017 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
2019 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, (result
>= 0), handle
,
2025 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
2027 const char *name
, void *value
, size_t size
)
2031 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
2033 do_log(SMB_VFS_OP_GETXATTR
, (result
>= 0), handle
,
2034 "%s|%s", path
, name
);
2039 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2040 struct files_struct
*fsp
,
2041 const char *name
, void *value
, size_t size
)
2045 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2047 do_log(SMB_VFS_OP_FGETXATTR
, (result
>= 0), handle
,
2048 "%s|%s", fsp_str_do_log(fsp
), name
);
2053 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
2054 const char *path
, char *list
, size_t size
)
2058 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
2060 do_log(SMB_VFS_OP_LISTXATTR
, (result
>= 0), handle
, "%s", path
);
2065 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
2066 struct files_struct
*fsp
, char *list
,
2071 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
2073 do_log(SMB_VFS_OP_FLISTXATTR
, (result
>= 0), handle
,
2074 "%s", fsp_str_do_log(fsp
));
2079 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
2085 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2087 do_log(SMB_VFS_OP_REMOVEXATTR
, (result
>= 0), handle
,
2088 "%s|%s", path
, name
);
2093 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2094 struct files_struct
*fsp
,
2099 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2101 do_log(SMB_VFS_OP_FREMOVEXATTR
, (result
>= 0), handle
,
2102 "%s|%s", fsp_str_do_log(fsp
), name
);
2107 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
2109 const char *name
, const void *value
, size_t size
,
2114 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
2117 do_log(SMB_VFS_OP_SETXATTR
, (result
>= 0), handle
,
2118 "%s|%s", path
, name
);
2123 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2124 struct files_struct
*fsp
, const char *name
,
2125 const void *value
, size_t size
, int flags
)
2129 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2131 do_log(SMB_VFS_OP_FSETXATTR
, (result
>= 0), handle
,
2132 "%s|%s", fsp_str_do_log(fsp
), name
);
2137 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
2138 struct files_struct
*fsp
)
2142 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2143 do_log(SMB_VFS_OP_AIO_FORCE
, result
, handle
,
2144 "%s", fsp_str_do_log(fsp
));
2149 static bool smb_full_audit_is_offline(struct vfs_handle_struct
*handle
,
2150 const struct smb_filename
*fname
,
2151 SMB_STRUCT_STAT
*sbuf
)
2155 result
= SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
2156 do_log(SMB_VFS_OP_IS_OFFLINE
, result
, handle
, "%s",
2157 smb_fname_str_do_log(fname
));
2161 static int smb_full_audit_set_offline(struct vfs_handle_struct
*handle
,
2162 const struct smb_filename
*fname
)
2166 result
= SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
2167 do_log(SMB_VFS_OP_SET_OFFLINE
, result
>= 0, handle
, "%s",
2168 smb_fname_str_do_log(fname
));
2172 static struct vfs_fn_pointers vfs_full_audit_fns
= {
2174 /* Disk operations */
2176 .connect_fn
= smb_full_audit_connect
,
2177 .disconnect_fn
= smb_full_audit_disconnect
,
2178 .disk_free_fn
= smb_full_audit_disk_free
,
2179 .get_quota_fn
= smb_full_audit_get_quota
,
2180 .set_quota_fn
= smb_full_audit_set_quota
,
2181 .get_shadow_copy_data_fn
= smb_full_audit_get_shadow_copy_data
,
2182 .statvfs_fn
= smb_full_audit_statvfs
,
2183 .fs_capabilities_fn
= smb_full_audit_fs_capabilities
,
2184 .opendir_fn
= smb_full_audit_opendir
,
2185 .fdopendir_fn
= smb_full_audit_fdopendir
,
2186 .readdir_fn
= smb_full_audit_readdir
,
2187 .seekdir_fn
= smb_full_audit_seekdir
,
2188 .telldir_fn
= smb_full_audit_telldir
,
2189 .rewind_dir_fn
= smb_full_audit_rewinddir
,
2190 .mkdir_fn
= smb_full_audit_mkdir
,
2191 .rmdir_fn
= smb_full_audit_rmdir
,
2192 .closedir_fn
= smb_full_audit_closedir
,
2193 .init_search_op_fn
= smb_full_audit_init_search_op
,
2194 .open_fn
= smb_full_audit_open
,
2195 .create_file_fn
= smb_full_audit_create_file
,
2196 .close_fn
= smb_full_audit_close
,
2197 .read_fn
= smb_full_audit_read
,
2198 .pread_fn
= smb_full_audit_pread
,
2199 .pread_send_fn
= smb_full_audit_pread_send
,
2200 .pread_recv_fn
= smb_full_audit_pread_recv
,
2201 .write_fn
= smb_full_audit_write
,
2202 .pwrite_fn
= smb_full_audit_pwrite
,
2203 .pwrite_send_fn
= smb_full_audit_pwrite_send
,
2204 .pwrite_recv_fn
= smb_full_audit_pwrite_recv
,
2205 .lseek_fn
= smb_full_audit_lseek
,
2206 .sendfile_fn
= smb_full_audit_sendfile
,
2207 .recvfile_fn
= smb_full_audit_recvfile
,
2208 .rename_fn
= smb_full_audit_rename
,
2209 .fsync_fn
= smb_full_audit_fsync
,
2210 .fsync_send_fn
= smb_full_audit_fsync_send
,
2211 .fsync_recv_fn
= smb_full_audit_fsync_recv
,
2212 .stat_fn
= smb_full_audit_stat
,
2213 .fstat_fn
= smb_full_audit_fstat
,
2214 .lstat_fn
= smb_full_audit_lstat
,
2215 .get_alloc_size_fn
= smb_full_audit_get_alloc_size
,
2216 .unlink_fn
= smb_full_audit_unlink
,
2217 .chmod_fn
= smb_full_audit_chmod
,
2218 .fchmod_fn
= smb_full_audit_fchmod
,
2219 .chown_fn
= smb_full_audit_chown
,
2220 .fchown_fn
= smb_full_audit_fchown
,
2221 .lchown_fn
= smb_full_audit_lchown
,
2222 .chdir_fn
= smb_full_audit_chdir
,
2223 .getwd_fn
= smb_full_audit_getwd
,
2224 .ntimes_fn
= smb_full_audit_ntimes
,
2225 .ftruncate_fn
= smb_full_audit_ftruncate
,
2226 .fallocate_fn
= smb_full_audit_fallocate
,
2227 .lock_fn
= smb_full_audit_lock
,
2228 .kernel_flock_fn
= smb_full_audit_kernel_flock
,
2229 .linux_setlease_fn
= smb_full_audit_linux_setlease
,
2230 .getlock_fn
= smb_full_audit_getlock
,
2231 .symlink_fn
= smb_full_audit_symlink
,
2232 .readlink_fn
= smb_full_audit_readlink
,
2233 .link_fn
= smb_full_audit_link
,
2234 .mknod_fn
= smb_full_audit_mknod
,
2235 .realpath_fn
= smb_full_audit_realpath
,
2236 .notify_watch_fn
= smb_full_audit_notify_watch
,
2237 .chflags_fn
= smb_full_audit_chflags
,
2238 .file_id_create_fn
= smb_full_audit_file_id_create
,
2239 .streaminfo_fn
= smb_full_audit_streaminfo
,
2240 .get_real_filename_fn
= smb_full_audit_get_real_filename
,
2241 .connectpath_fn
= smb_full_audit_connectpath
,
2242 .brl_lock_windows_fn
= smb_full_audit_brl_lock_windows
,
2243 .brl_unlock_windows_fn
= smb_full_audit_brl_unlock_windows
,
2244 .brl_cancel_windows_fn
= smb_full_audit_brl_cancel_windows
,
2245 .strict_lock_fn
= smb_full_audit_strict_lock
,
2246 .strict_unlock_fn
= smb_full_audit_strict_unlock
,
2247 .translate_name_fn
= smb_full_audit_translate_name
,
2248 .copy_chunk_send_fn
= smb_full_audit_copy_chunk_send
,
2249 .copy_chunk_recv_fn
= smb_full_audit_copy_chunk_recv
,
2250 .get_compression_fn
= smb_full_audit_get_compression
,
2251 .set_compression_fn
= smb_full_audit_set_compression
,
2252 .fget_nt_acl_fn
= smb_full_audit_fget_nt_acl
,
2253 .get_nt_acl_fn
= smb_full_audit_get_nt_acl
,
2254 .fset_nt_acl_fn
= smb_full_audit_fset_nt_acl
,
2255 .chmod_acl_fn
= smb_full_audit_chmod_acl
,
2256 .fchmod_acl_fn
= smb_full_audit_fchmod_acl
,
2257 .sys_acl_get_file_fn
= smb_full_audit_sys_acl_get_file
,
2258 .sys_acl_get_fd_fn
= smb_full_audit_sys_acl_get_fd
,
2259 .sys_acl_blob_get_file_fn
= smb_full_audit_sys_acl_blob_get_file
,
2260 .sys_acl_blob_get_fd_fn
= smb_full_audit_sys_acl_blob_get_fd
,
2261 .sys_acl_set_file_fn
= smb_full_audit_sys_acl_set_file
,
2262 .sys_acl_set_fd_fn
= smb_full_audit_sys_acl_set_fd
,
2263 .sys_acl_delete_def_file_fn
= smb_full_audit_sys_acl_delete_def_file
,
2264 .getxattr_fn
= smb_full_audit_getxattr
,
2265 .fgetxattr_fn
= smb_full_audit_fgetxattr
,
2266 .listxattr_fn
= smb_full_audit_listxattr
,
2267 .flistxattr_fn
= smb_full_audit_flistxattr
,
2268 .removexattr_fn
= smb_full_audit_removexattr
,
2269 .fremovexattr_fn
= smb_full_audit_fremovexattr
,
2270 .setxattr_fn
= smb_full_audit_setxattr
,
2271 .fsetxattr_fn
= smb_full_audit_fsetxattr
,
2272 .aio_force_fn
= smb_full_audit_aio_force
,
2273 .is_offline_fn
= smb_full_audit_is_offline
,
2274 .set_offline_fn
= smb_full_audit_set_offline
,
2277 NTSTATUS
vfs_full_audit_init(void)
2279 NTSTATUS ret
= smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
2280 "full_audit", &vfs_full_audit_fns
);
2282 if (!NT_STATUS_IS_OK(ret
))
2285 vfs_full_audit_debug_level
= debug_add_class("full_audit");
2286 if (vfs_full_audit_debug_level
== -1) {
2287 vfs_full_audit_debug_level
= DBGC_VFS
;
2288 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2291 DEBUG(10, ("vfs_full_audit: Debug class number of "
2292 "'full_audit': %d\n", vfs_full_audit_debug_level
));