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,
100 SMB_VFS_OP_GET_DFS_REFERRALS,
102 /* Directory operations */
105 SMB_VFS_OP_FDOPENDIR,
109 SMB_VFS_OP_REWINDDIR,
113 SMB_VFS_OP_INIT_SEARCH_OP,
115 /* File operations */
118 SMB_VFS_OP_CREATE_FILE,
122 SMB_VFS_OP_PREAD_SEND,
123 SMB_VFS_OP_PREAD_RECV,
126 SMB_VFS_OP_PWRITE_SEND,
127 SMB_VFS_OP_PWRITE_RECV,
133 SMB_VFS_OP_FSYNC_SEND,
134 SMB_VFS_OP_FSYNC_RECV,
138 SMB_VFS_OP_GET_ALLOC_SIZE,
148 SMB_VFS_OP_FTRUNCATE,
149 SMB_VFS_OP_FALLOCATE,
151 SMB_VFS_OP_KERNEL_FLOCK,
152 SMB_VFS_OP_LINUX_SETLEASE,
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,
171 SMB_VFS_OP_COPY_CHUNK_SEND,
172 SMB_VFS_OP_COPY_CHUNK_RECV,
173 SMB_VFS_OP_GET_COMPRESSION,
174 SMB_VFS_OP_SET_COMPRESSION,
175 SMB_VFS_OP_SNAP_CHECK_PATH,
176 SMB_VFS_OP_SNAP_CREATE,
177 SMB_VFS_OP_SNAP_DELETE,
179 /* DOS attribute operations. */
180 SMB_VFS_OP_GET_DOS_ATTRIBUTES,
181 SMB_VFS_OP_FGET_DOS_ATTRIBUTES,
182 SMB_VFS_OP_SET_DOS_ATTRIBUTES,
183 SMB_VFS_OP_FSET_DOS_ATTRIBUTES,
185 /* NT ACL operations. */
187 SMB_VFS_OP_FGET_NT_ACL,
188 SMB_VFS_OP_GET_NT_ACL,
189 SMB_VFS_OP_FSET_NT_ACL,
190 /* Missing audit_file */
192 /* POSIX ACL operations. */
194 SMB_VFS_OP_CHMOD_ACL,
195 SMB_VFS_OP_FCHMOD_ACL,
197 SMB_VFS_OP_SYS_ACL_GET_FILE,
198 SMB_VFS_OP_SYS_ACL_GET_FD,
199 SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE,
200 SMB_VFS_OP_SYS_ACL_BLOB_GET_FD,
201 SMB_VFS_OP_SYS_ACL_SET_FILE,
202 SMB_VFS_OP_SYS_ACL_SET_FD,
203 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
207 SMB_VFS_OP_FGETXATTR,
208 SMB_VFS_OP_LISTXATTR,
209 SMB_VFS_OP_FLISTXATTR,
210 SMB_VFS_OP_REMOVEXATTR,
211 SMB_VFS_OP_FREMOVEXATTR,
213 SMB_VFS_OP_FSETXATTR,
216 SMB_VFS_OP_AIO_FORCE,
218 /* offline operations */
219 SMB_VFS_OP_IS_OFFLINE,
220 SMB_VFS_OP_SET_OFFLINE,
222 /* Durable handle operations */
229 SMB_VFS_OP_READDIR_ATTR,
231 /* This should always be last enum value */
236 /* The following array *must* be in the same order as defined in vfs_op_type */
242 { SMB_VFS_OP_CONNECT, "connect" },
243 { SMB_VFS_OP_DISCONNECT, "disconnect" },
244 { SMB_VFS_OP_DISK_FREE, "disk_free" },
245 { SMB_VFS_OP_GET_QUOTA, "get_quota" },
246 { SMB_VFS_OP_SET_QUOTA, "set_quota" },
247 { SMB_VFS_OP_GET_SHADOW_COPY_DATA, "get_shadow_copy_data" },
248 { SMB_VFS_OP_STATVFS, "statvfs" },
249 { SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" },
250 { SMB_VFS_OP_GET_DFS_REFERRALS, "get_dfs_referrals" },
251 { SMB_VFS_OP_OPENDIR, "opendir" },
252 { SMB_VFS_OP_FDOPENDIR, "fdopendir" },
253 { SMB_VFS_OP_READDIR, "readdir" },
254 { SMB_VFS_OP_SEEKDIR, "seekdir" },
255 { SMB_VFS_OP_TELLDIR, "telldir" },
256 { SMB_VFS_OP_REWINDDIR, "rewinddir" },
257 { SMB_VFS_OP_MKDIR, "mkdir" },
258 { SMB_VFS_OP_RMDIR, "rmdir" },
259 { SMB_VFS_OP_CLOSEDIR, "closedir" },
260 { SMB_VFS_OP_INIT_SEARCH_OP, "init_search_op" },
261 { SMB_VFS_OP_OPEN, "open" },
262 { SMB_VFS_OP_CREATE_FILE, "create_file" },
263 { SMB_VFS_OP_CLOSE, "close" },
264 { SMB_VFS_OP_READ, "read" },
265 { SMB_VFS_OP_PREAD, "pread" },
266 { SMB_VFS_OP_PREAD_SEND, "pread_send" },
267 { SMB_VFS_OP_PREAD_RECV, "pread_recv" },
268 { SMB_VFS_OP_WRITE, "write" },
269 { SMB_VFS_OP_PWRITE, "pwrite" },
270 { SMB_VFS_OP_PWRITE_SEND, "pwrite_send" },
271 { SMB_VFS_OP_PWRITE_RECV, "pwrite_recv" },
272 { SMB_VFS_OP_LSEEK, "lseek" },
273 { SMB_VFS_OP_SENDFILE, "sendfile" },
274 { SMB_VFS_OP_RECVFILE, "recvfile" },
275 { SMB_VFS_OP_RENAME, "rename" },
276 { SMB_VFS_OP_FSYNC, "fsync" },
277 { SMB_VFS_OP_FSYNC_SEND, "fsync_send" },
278 { SMB_VFS_OP_FSYNC_RECV, "fsync_recv" },
279 { SMB_VFS_OP_STAT, "stat" },
280 { SMB_VFS_OP_FSTAT, "fstat" },
281 { SMB_VFS_OP_LSTAT, "lstat" },
282 { SMB_VFS_OP_GET_ALLOC_SIZE, "get_alloc_size" },
283 { SMB_VFS_OP_UNLINK, "unlink" },
284 { SMB_VFS_OP_CHMOD, "chmod" },
285 { SMB_VFS_OP_FCHMOD, "fchmod" },
286 { SMB_VFS_OP_CHOWN, "chown" },
287 { SMB_VFS_OP_FCHOWN, "fchown" },
288 { SMB_VFS_OP_LCHOWN, "lchown" },
289 { SMB_VFS_OP_CHDIR, "chdir" },
290 { SMB_VFS_OP_GETWD, "getwd" },
291 { SMB_VFS_OP_NTIMES, "ntimes" },
292 { SMB_VFS_OP_FTRUNCATE, "ftruncate" },
293 { SMB_VFS_OP_FALLOCATE,"fallocate" },
294 { SMB_VFS_OP_LOCK, "lock" },
295 { SMB_VFS_OP_KERNEL_FLOCK, "kernel_flock" },
296 { SMB_VFS_OP_LINUX_SETLEASE, "linux_setlease" },
297 { SMB_VFS_OP_GETLOCK, "getlock" },
298 { SMB_VFS_OP_SYMLINK, "symlink" },
299 { SMB_VFS_OP_READLINK, "readlink" },
300 { SMB_VFS_OP_LINK, "link" },
301 { SMB_VFS_OP_MKNOD, "mknod" },
302 { SMB_VFS_OP_REALPATH, "realpath" },
303 { SMB_VFS_OP_CHFLAGS, "chflags" },
304 { SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
305 { SMB_VFS_OP_STREAMINFO, "streaminfo" },
306 { SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
307 { SMB_VFS_OP_CONNECTPATH, "connectpath" },
308 { SMB_VFS_OP_BRL_LOCK_WINDOWS, "brl_lock_windows" },
309 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS, "brl_unlock_windows" },
310 { SMB_VFS_OP_BRL_CANCEL_WINDOWS, "brl_cancel_windows" },
311 { SMB_VFS_OP_STRICT_LOCK, "strict_lock" },
312 { SMB_VFS_OP_STRICT_UNLOCK, "strict_unlock" },
313 { SMB_VFS_OP_TRANSLATE_NAME, "translate_name" },
315 { SMB_VFS_OP_COPY_CHUNK_SEND, "copy_chunk_send" },
316 { SMB_VFS_OP_COPY_CHUNK_RECV, "copy_chunk_recv" },
317 { SMB_VFS_OP_GET_COMPRESSION, "get_compression" },
318 { SMB_VFS_OP_SET_COMPRESSION, "set_compression" },
319 { SMB_VFS_OP_SNAP_CHECK_PATH, "snap_check_path" },
320 { SMB_VFS_OP_SNAP_CREATE, "snap_create" },
321 { SMB_VFS_OP_SNAP_DELETE, "snap_delete" },
322 { SMB_VFS_OP_GET_DOS_ATTRIBUTES, "get_dos_attributes" },
323 { SMB_VFS_OP_FGET_DOS_ATTRIBUTES, "fget_dos_attributes" },
324 { SMB_VFS_OP_SET_DOS_ATTRIBUTES, "set_dos_attributes" },
325 { SMB_VFS_OP_FSET_DOS_ATTRIBUTES, "fset_dos_attributes" },
326 { SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" },
327 { SMB_VFS_OP_GET_NT_ACL, "get_nt_acl" },
328 { SMB_VFS_OP_FSET_NT_ACL, "fset_nt_acl" },
329 /* Missing audit_file */
330 { SMB_VFS_OP_CHMOD_ACL, "chmod_acl" },
331 { SMB_VFS_OP_FCHMOD_ACL, "fchmod_acl" },
332 { SMB_VFS_OP_SYS_ACL_GET_FILE, "sys_acl_get_file" },
333 { SMB_VFS_OP_SYS_ACL_GET_FD, "sys_acl_get_fd" },
334 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, "sys_acl_blob_get_file" },
335 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, "sys_acl_blob_get_fd" },
336 { SMB_VFS_OP_SYS_ACL_SET_FILE, "sys_acl_set_file" },
337 { SMB_VFS_OP_SYS_ACL_SET_FD, "sys_acl_set_fd" },
338 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, "sys_acl_delete_def_file" },
339 { SMB_VFS_OP_GETXATTR, "getxattr" },
340 { SMB_VFS_OP_FGETXATTR, "fgetxattr" },
341 { SMB_VFS_OP_LISTXATTR, "listxattr" },
342 { SMB_VFS_OP_FLISTXATTR, "flistxattr" },
343 { SMB_VFS_OP_REMOVEXATTR, "removexattr" },
344 { SMB_VFS_OP_FREMOVEXATTR, "fremovexattr" },
345 { SMB_VFS_OP_SETXATTR, "setxattr" },
346 { SMB_VFS_OP_FSETXATTR, "fsetxattr" },
347 { SMB_VFS_OP_AIO_FORCE, "aio_force" },
348 { SMB_VFS_OP_IS_OFFLINE, "is_offline" },
349 { SMB_VFS_OP_SET_OFFLINE, "set_offline" },
355 { SMB_VFS_OP_READDIR_ATTR, "readdir_attr" },
356 { SMB_VFS_OP_LAST, NULL }
359 static int audit_syslog_facility(vfs_handle_struct *handle)
361 static const struct enum_list enum_log_facilities[] = {
362 { LOG_USER, "USER" },
363 { LOG_LOCAL0, "LOCAL0" },
364 { LOG_LOCAL1, "LOCAL1" },
365 { LOG_LOCAL2, "LOCAL2" },
366 { LOG_LOCAL3, "LOCAL3" },
367 { LOG_LOCAL4, "LOCAL4" },
368 { LOG_LOCAL5, "LOCAL5" },
369 { LOG_LOCAL6, "LOCAL6" },
370 { LOG_LOCAL7, "LOCAL7" },
376 facility = lp_parm_enum(SNUM(handle->conn), "full_audit", "facility", enum_log_facilities, LOG_USER);
381 static int audit_syslog_priority(vfs_handle_struct *handle)
383 static const struct enum_list enum_log_priorities[] = {
384 { LOG_EMERG, "EMERG" },
385 { LOG_ALERT, "ALERT" },
386 { LOG_CRIT, "CRIT" },
388 { LOG_WARNING, "WARNING" },
389 { LOG_NOTICE, "NOTICE" },
390 { LOG_INFO, "INFO" },
391 { LOG_DEBUG, "DEBUG" },
397 priority = lp_parm_enum(SNUM(handle->conn), "full_audit", "priority",
398 enum_log_priorities, LOG_NOTICE);
399 if (priority == -1) {
400 priority = LOG_WARNING;
406 static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
411 prefix = talloc_strdup(ctx,
412 lp_parm_const_string(SNUM(conn), "full_audit",
417 result = talloc_sub_advanced(ctx,
418 lp_servicename(talloc_tos(), SNUM(conn)),
419 conn->session_info->unix_info->unix_name,
421 conn->session_info->unix_token->gid,
422 conn->session_info->unix_info->sanitized_username,
423 conn->session_info->info->domain_name,
429 static bool log_success(struct vfs_full_audit_private_data *pd, vfs_op_type op)
431 if (pd->success_ops == NULL) {
435 return bitmap_query(pd->success_ops, op);
438 static bool log_failure(struct vfs_full_audit_private_data *pd, vfs_op_type op)
440 if (pd->failure_ops == NULL)
443 return bitmap_query(pd->failure_ops, op);
446 static struct bitmap *init_bitmap(TALLOC_CTX *mem_ctx, const char **ops)
454 bm = bitmap_talloc(mem_ctx, SMB_VFS_OP_LAST);
456 DEBUG(0, ("Could not alloc bitmap -- "
457 "defaulting to logging everything\n"));
461 for (; *ops != NULL; ops += 1) {
466 if (strequal(*ops, "all")) {
467 for (i=0; i<SMB_VFS_OP_LAST; i++) {
473 if (strequal(*ops, "none")) {
483 for (i=0; i<SMB_VFS_OP_LAST; i++) {
484 if ((vfs_op_names[i].name == NULL)
485 || (vfs_op_names[i].type != i)) {
486 smb_panic("vfs_full_audit.c: name table not "
487 "in sync with vfs_op_type enums\n");
489 if (strequal(op, vfs_op_names[i].name)) {
498 if (i == SMB_VFS_OP_LAST) {
499 DEBUG(0, ("Could not find opname %s, logging all\n",
508 static const char *audit_opname(vfs_op_type op)
510 if (op >= SMB_VFS_OP_LAST)
511 return "INVALID VFS OP";
512 return vfs_op_names[op].name;
515 static TALLOC_CTX *tmp_do_log_ctx;
517 * Get us a temporary talloc context usable just for DEBUG arguments
519 static TALLOC_CTX *do_log_ctx(void)
521 if (tmp_do_log_ctx == NULL) {
522 tmp_do_log_ctx = talloc_named_const(NULL, 0, "do_log_ctx");
524 return tmp_do_log_ctx;
527 static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
528 const char *format, ...)
530 struct vfs_full_audit_private_data *pd;
532 char *audit_pre = NULL;
536 SMB_VFS_HANDLE_GET_DATA(handle, pd,
537 struct vfs_full_audit_private_data,
540 if (success && (!log_success(pd, op)))
543 if (!success && (!log_failure(pd, op)))
547 fstrcpy(err_msg, "ok");
549 fstr_sprintf(err_msg, "fail (%s)", strerror(errno));
551 va_start(ap, format);
552 op_msg = talloc_vasprintf(talloc_tos(), format, ap);
559 audit_pre = audit_prefix(talloc_tos(), handle->conn);
565 * Specify the facility to interoperate with other syslog
566 * callers (smbd for example).
568 priority = pd->syslog_priority | pd->syslog_facility;
570 syslog(priority, "%s|%s|%s|%s\n",
571 audit_pre ? audit_pre : "",
572 audit_opname(op), err_msg, op_msg);
574 DEBUG(1, ("%s|%s|%s|%s\n",
575 audit_pre ? audit_pre : "",
576 audit_opname(op), err_msg, op_msg));
579 TALLOC_FREE(audit_pre);
581 TALLOC_FREE(tmp_do_log_ctx);
585 * Return a string using the do_log_ctx()
587 static const char *smb_fname_str_do_log(const struct smb_filename *smb_fname)
592 if (smb_fname == NULL) {
595 status = get_full_smb_filename(do_log_ctx(), smb_fname, &fname);
596 if (!NT_STATUS_IS_OK(status)) {
603 * Return an fsp debug string using the do_log_ctx()
605 static const char *fsp_str_do_log(const struct files_struct *fsp)
607 return smb_fname_str_do_log(fsp->fsp_name);
610 /* Implementation of vfs_ops. Pass everything on to the default
611 operation but log event first. */
613 static int smb_full_audit_connect(vfs_handle_struct *handle,
614 const char *svc, const char *user)
617 struct vfs_full_audit_private_data *pd = NULL;
619 result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
624 pd = talloc_zero(handle, struct vfs_full_audit_private_data);
626 SMB_VFS_NEXT_DISCONNECT(handle);
630 pd->syslog_facility = audit_syslog_facility(handle);
631 if (pd->syslog_facility == -1) {
632 DEBUG(1, ("%s: Unknown facility %s\n", __func__,
633 lp_parm_const_string(SNUM(handle->conn),
634 "full_audit", "facility",
636 SMB_VFS_NEXT_DISCONNECT(handle);
640 pd->syslog_priority = audit_syslog_priority(handle);
642 pd->log_secdesc = lp_parm_bool(SNUM(handle->conn),
643 "full_audit", "log_secdesc", false);
645 pd->do_syslog = lp_parm_bool(SNUM(handle->conn),
646 "full_audit", "syslog", true);
650 openlog("smbd_audit", 0, pd->syslog_facility);
654 pd->success_ops = init_bitmap(
655 pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
657 pd->failure_ops = init_bitmap(
658 pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
661 /* Store the private data. */
662 SMB_VFS_HANDLE_SET_DATA(handle, pd, NULL,
663 struct vfs_full_audit_private_data, return -1);
665 do_log(SMB_VFS_OP_CONNECT, True, handle,
671 static void smb_full_audit_disconnect(vfs_handle_struct *handle)
673 SMB_VFS_NEXT_DISCONNECT(handle);
675 do_log(SMB_VFS_OP_DISCONNECT, True, handle,
676 "%s", lp_servicename(talloc_tos(), SNUM(handle->conn)));
678 /* The bitmaps will be disconnected when the private
682 static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
683 const char *path, uint64_t *bsize,
684 uint64_t *dfree, uint64_t *dsize)
688 result = SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
690 /* Don't have a reasonable notion of failure here */
692 do_log(SMB_VFS_OP_DISK_FREE, True, handle, "%s", path);
697 static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
698 const char *path, enum SMB_QUOTA_TYPE qtype,
699 unid_t id, SMB_DISK_QUOTA *qt)
703 result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
705 do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s", path);
710 static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
711 enum SMB_QUOTA_TYPE qtype, unid_t id,
716 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
718 do_log(SMB_VFS_OP_SET_QUOTA, (result >= 0), handle, "");
723 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
724 struct files_struct *fsp,
725 struct shadow_copy_data *shadow_copy_data,
730 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
732 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA, (result >= 0), handle, "");
737 static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
739 struct vfs_statvfs_struct *statbuf)
743 result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
745 do_log(SMB_VFS_OP_STATVFS, (result >= 0), handle, "");
750 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
754 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
756 do_log(SMB_VFS_OP_FS_CAPABILITIES, true, handle, "");
761 static NTSTATUS smb_full_audit_get_dfs_referrals(
762 struct vfs_handle_struct *handle,
763 struct dfs_GetDFSReferral *r)
767 status = SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
769 do_log(SMB_VFS_OP_GET_DFS_REFERRALS, NT_STATUS_IS_OK(status),
775 static NTSTATUS smb_full_audit_snap_check_path(struct vfs_handle_struct *handle,
777 const char *service_path,
782 status = SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
784 do_log(SMB_VFS_OP_SNAP_CHECK_PATH, NT_STATUS_IS_OK(status),
790 static NTSTATUS smb_full_audit_snap_create(struct vfs_handle_struct *handle,
792 const char *base_volume,
800 status = SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
801 rw, base_path, snap_path);
802 do_log(SMB_VFS_OP_SNAP_CREATE, NT_STATUS_IS_OK(status), handle, "");
807 static NTSTATUS smb_full_audit_snap_delete(struct vfs_handle_struct *handle,
814 status = SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path,
816 do_log(SMB_VFS_OP_SNAP_DELETE, NT_STATUS_IS_OK(status), handle, "");
821 static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
822 const struct smb_filename *smb_fname,
828 result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
830 do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
831 smb_fname->base_name);
836 static DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
837 files_struct *fsp, const char *mask, uint32_t attr)
841 result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
843 do_log(SMB_VFS_OP_FDOPENDIR, (result != NULL), handle, "%s",
844 fsp_str_do_log(fsp));
849 static struct dirent *smb_full_audit_readdir(vfs_handle_struct *handle,
850 DIR *dirp, SMB_STRUCT_STAT *sbuf)
852 struct dirent *result;
854 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
856 /* This operation has no reasonable error condition
857 * (End of dir is also failure), so always succeed.
859 do_log(SMB_VFS_OP_READDIR, True, handle, "");
864 static void smb_full_audit_seekdir(vfs_handle_struct *handle,
865 DIR *dirp, long offset)
867 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
869 do_log(SMB_VFS_OP_SEEKDIR, True, handle, "");
872 static long smb_full_audit_telldir(vfs_handle_struct *handle,
877 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
879 do_log(SMB_VFS_OP_TELLDIR, True, handle, "");
884 static void smb_full_audit_rewinddir(vfs_handle_struct *handle,
887 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
889 do_log(SMB_VFS_OP_REWINDDIR, True, handle, "");
892 static int smb_full_audit_mkdir(vfs_handle_struct *handle,
893 const struct smb_filename *smb_fname, mode_t mode)
897 result = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
899 do_log(SMB_VFS_OP_MKDIR, (result >= 0), handle, "%s",
900 smb_fname->base_name);
905 static int smb_full_audit_rmdir(vfs_handle_struct *handle,
906 const struct smb_filename *smb_fname)
910 result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
912 do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s",
913 smb_fname->base_name);
918 static int smb_full_audit_closedir(vfs_handle_struct *handle,
923 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
925 do_log(SMB_VFS_OP_CLOSEDIR, (result >= 0), handle, "");
930 static void smb_full_audit_init_search_op(vfs_handle_struct *handle,
933 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
935 do_log(SMB_VFS_OP_INIT_SEARCH_OP, True, handle, "");
938 static int smb_full_audit_open(vfs_handle_struct *handle,
939 struct smb_filename *smb_fname,
940 files_struct *fsp, int flags, mode_t mode)
944 result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
946 do_log(SMB_VFS_OP_OPEN, (result >= 0), handle, "%s|%s",
947 ((flags & O_WRONLY) || (flags & O_RDWR))?"w":"r",
948 smb_fname_str_do_log(smb_fname));
953 static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
954 struct smb_request *req,
955 uint16_t root_dir_fid,
956 struct smb_filename *smb_fname,
957 uint32_t access_mask,
958 uint32_t share_access,
959 uint32_t create_disposition,
960 uint32_t create_options,
961 uint32_t file_attributes,
962 uint32_t oplock_request,
963 struct smb2_lease *lease,
964 uint64_t allocation_size,
965 uint32_t private_flags,
966 struct security_descriptor *sd,
967 struct ea_list *ea_list,
968 files_struct **result_fsp,
970 const struct smb2_create_blobs *in_context_blobs,
971 struct smb2_create_blobs *out_context_blobs)
974 const char* str_create_disposition;
976 switch (create_disposition) {
978 str_create_disposition = "supersede";
980 case FILE_OVERWRITE_IF:
981 str_create_disposition = "overwrite_if";
984 str_create_disposition = "open";
987 str_create_disposition = "overwrite";
990 str_create_disposition = "create";
993 str_create_disposition = "open_if";
996 str_create_disposition = "unknown";
999 result = SMB_VFS_NEXT_CREATE_FILE(
1000 handle, /* handle */
1002 root_dir_fid, /* root_dir_fid */
1003 smb_fname, /* fname */
1004 access_mask, /* access_mask */
1005 share_access, /* share_access */
1006 create_disposition, /* create_disposition*/
1007 create_options, /* create_options */
1008 file_attributes, /* file_attributes */
1009 oplock_request, /* oplock_request */
1011 allocation_size, /* allocation_size */
1014 ea_list, /* ea_list */
1015 result_fsp, /* result */
1017 in_context_blobs, out_context_blobs); /* create context */
1019 do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
1020 "0x%x|%s|%s|%s", access_mask,
1021 create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
1022 str_create_disposition, smb_fname_str_do_log(smb_fname));
1027 static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
1031 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
1033 do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s",
1034 fsp_str_do_log(fsp));
1039 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
1040 void *data, size_t n)
1044 result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
1046 do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s",
1047 fsp_str_do_log(fsp));
1052 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
1053 void *data, size_t n, off_t offset)
1057 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
1059 do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s",
1060 fsp_str_do_log(fsp));
1065 struct smb_full_audit_pread_state {
1066 vfs_handle_struct *handle;
1069 struct vfs_aio_state vfs_aio_state;
1072 static void smb_full_audit_pread_done(struct tevent_req *subreq);
1074 static struct tevent_req *smb_full_audit_pread_send(
1075 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1076 struct tevent_context *ev, struct files_struct *fsp,
1077 void *data, size_t n, off_t offset)
1079 struct tevent_req *req, *subreq;
1080 struct smb_full_audit_pread_state *state;
1082 req = tevent_req_create(mem_ctx, &state,
1083 struct smb_full_audit_pread_state);
1085 do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
1086 fsp_str_do_log(fsp));
1089 state->handle = handle;
1092 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
1094 if (tevent_req_nomem(subreq, req)) {
1095 do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
1096 fsp_str_do_log(fsp));
1097 return tevent_req_post(req, ev);
1099 tevent_req_set_callback(subreq, smb_full_audit_pread_done, req);
1101 do_log(SMB_VFS_OP_PREAD_SEND, true, handle, "%s", fsp_str_do_log(fsp));
1105 static void smb_full_audit_pread_done(struct tevent_req *subreq)
1107 struct tevent_req *req = tevent_req_callback_data(
1108 subreq, struct tevent_req);
1109 struct smb_full_audit_pread_state *state = tevent_req_data(
1110 req, struct smb_full_audit_pread_state);
1112 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
1113 TALLOC_FREE(subreq);
1114 tevent_req_done(req);
1117 static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
1118 struct vfs_aio_state *vfs_aio_state)
1120 struct smb_full_audit_pread_state *state = tevent_req_data(
1121 req, struct smb_full_audit_pread_state);
1123 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1124 do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
1125 fsp_str_do_log(state->fsp));
1129 do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
1130 fsp_str_do_log(state->fsp));
1132 *vfs_aio_state = state->vfs_aio_state;
1136 static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
1137 const void *data, size_t n)
1141 result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
1143 do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s",
1144 fsp_str_do_log(fsp));
1149 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
1150 const void *data, size_t n,
1155 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
1157 do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s",
1158 fsp_str_do_log(fsp));
1163 struct smb_full_audit_pwrite_state {
1164 vfs_handle_struct *handle;
1167 struct vfs_aio_state vfs_aio_state;
1170 static void smb_full_audit_pwrite_done(struct tevent_req *subreq);
1172 static struct tevent_req *smb_full_audit_pwrite_send(
1173 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1174 struct tevent_context *ev, struct files_struct *fsp,
1175 const void *data, size_t n, off_t offset)
1177 struct tevent_req *req, *subreq;
1178 struct smb_full_audit_pwrite_state *state;
1180 req = tevent_req_create(mem_ctx, &state,
1181 struct smb_full_audit_pwrite_state);
1183 do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
1184 fsp_str_do_log(fsp));
1187 state->handle = handle;
1190 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
1192 if (tevent_req_nomem(subreq, req)) {
1193 do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
1194 fsp_str_do_log(fsp));
1195 return tevent_req_post(req, ev);
1197 tevent_req_set_callback(subreq, smb_full_audit_pwrite_done, req);
1199 do_log(SMB_VFS_OP_PWRITE_SEND, true, handle, "%s",
1200 fsp_str_do_log(fsp));
1204 static void smb_full_audit_pwrite_done(struct tevent_req *subreq)
1206 struct tevent_req *req = tevent_req_callback_data(
1207 subreq, struct tevent_req);
1208 struct smb_full_audit_pwrite_state *state = tevent_req_data(
1209 req, struct smb_full_audit_pwrite_state);
1211 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
1212 TALLOC_FREE(subreq);
1213 tevent_req_done(req);
1216 static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req,
1217 struct vfs_aio_state *vfs_aio_state)
1219 struct smb_full_audit_pwrite_state *state = tevent_req_data(
1220 req, struct smb_full_audit_pwrite_state);
1222 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1223 do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
1224 fsp_str_do_log(state->fsp));
1228 do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
1229 fsp_str_do_log(state->fsp));
1231 *vfs_aio_state = state->vfs_aio_state;
1235 static off_t smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
1236 off_t offset, int whence)
1240 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
1242 do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
1243 "%s", fsp_str_do_log(fsp));
1248 static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
1249 files_struct *fromfsp,
1250 const DATA_BLOB *hdr, off_t offset,
1255 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
1257 do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
1258 "%s", fsp_str_do_log(fromfsp));
1263 static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
1264 files_struct *tofsp,
1270 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
1272 do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
1273 "%s", fsp_str_do_log(tofsp));
1278 static int smb_full_audit_rename(vfs_handle_struct *handle,
1279 const struct smb_filename *smb_fname_src,
1280 const struct smb_filename *smb_fname_dst)
1284 result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
1286 do_log(SMB_VFS_OP_RENAME, (result >= 0), handle, "%s|%s",
1287 smb_fname_str_do_log(smb_fname_src),
1288 smb_fname_str_do_log(smb_fname_dst));
1293 static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
1297 result = SMB_VFS_NEXT_FSYNC(handle, fsp);
1299 do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s",
1300 fsp_str_do_log(fsp));
1305 struct smb_full_audit_fsync_state {
1306 vfs_handle_struct *handle;
1309 struct vfs_aio_state vfs_aio_state;
1312 static void smb_full_audit_fsync_done(struct tevent_req *subreq);
1314 static struct tevent_req *smb_full_audit_fsync_send(
1315 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1316 struct tevent_context *ev, struct files_struct *fsp)
1318 struct tevent_req *req, *subreq;
1319 struct smb_full_audit_fsync_state *state;
1321 req = tevent_req_create(mem_ctx, &state,
1322 struct smb_full_audit_fsync_state);
1324 do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
1325 fsp_str_do_log(fsp));
1328 state->handle = handle;
1331 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
1332 if (tevent_req_nomem(subreq, req)) {
1333 do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
1334 fsp_str_do_log(fsp));
1335 return tevent_req_post(req, ev);
1337 tevent_req_set_callback(subreq, smb_full_audit_fsync_done, req);
1339 do_log(SMB_VFS_OP_FSYNC_SEND, true, handle, "%s", fsp_str_do_log(fsp));
1343 static void smb_full_audit_fsync_done(struct tevent_req *subreq)
1345 struct tevent_req *req = tevent_req_callback_data(
1346 subreq, struct tevent_req);
1347 struct smb_full_audit_fsync_state *state = tevent_req_data(
1348 req, struct smb_full_audit_fsync_state);
1350 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
1351 TALLOC_FREE(subreq);
1352 tevent_req_done(req);
1355 static int smb_full_audit_fsync_recv(struct tevent_req *req,
1356 struct vfs_aio_state *vfs_aio_state)
1358 struct smb_full_audit_fsync_state *state = tevent_req_data(
1359 req, struct smb_full_audit_fsync_state);
1361 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1362 do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
1363 fsp_str_do_log(state->fsp));
1367 do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
1368 fsp_str_do_log(state->fsp));
1370 *vfs_aio_state = state->vfs_aio_state;
1374 static int smb_full_audit_stat(vfs_handle_struct *handle,
1375 struct smb_filename *smb_fname)
1379 result = SMB_VFS_NEXT_STAT(handle, smb_fname);
1381 do_log(SMB_VFS_OP_STAT, (result >= 0), handle, "%s",
1382 smb_fname_str_do_log(smb_fname));
1387 static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
1388 SMB_STRUCT_STAT *sbuf)
1392 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
1394 do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s",
1395 fsp_str_do_log(fsp));
1400 static int smb_full_audit_lstat(vfs_handle_struct *handle,
1401 struct smb_filename *smb_fname)
1405 result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
1407 do_log(SMB_VFS_OP_LSTAT, (result >= 0), handle, "%s",
1408 smb_fname_str_do_log(smb_fname));
1413 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
1414 files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
1418 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
1420 do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result != (uint64_t)-1), handle,
1426 static int smb_full_audit_unlink(vfs_handle_struct *handle,
1427 const struct smb_filename *smb_fname)
1431 result = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
1433 do_log(SMB_VFS_OP_UNLINK, (result >= 0), handle, "%s",
1434 smb_fname_str_do_log(smb_fname));
1439 static int smb_full_audit_chmod(vfs_handle_struct *handle,
1440 const struct smb_filename *smb_fname,
1445 result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
1447 do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o",
1448 smb_fname->base_name,
1454 static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
1459 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
1461 do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
1462 "%s|%o", fsp_str_do_log(fsp), mode);
1467 static int smb_full_audit_chown(vfs_handle_struct *handle,
1468 const struct smb_filename *smb_fname,
1474 result = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
1476 do_log(SMB_VFS_OP_CHOWN, (result >= 0), handle, "%s|%ld|%ld",
1477 smb_fname->base_name, (long int)uid, (long int)gid);
1482 static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
1483 uid_t uid, gid_t gid)
1487 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
1489 do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
1490 fsp_str_do_log(fsp), (long int)uid, (long int)gid);
1495 static int smb_full_audit_lchown(vfs_handle_struct *handle,
1496 const struct smb_filename *smb_fname,
1502 result = SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
1504 do_log(SMB_VFS_OP_LCHOWN, (result >= 0), handle, "%s|%ld|%ld",
1505 smb_fname->base_name, (long int)uid, (long int)gid);
1510 static int smb_full_audit_chdir(vfs_handle_struct *handle,
1515 result = SMB_VFS_NEXT_CHDIR(handle, path);
1517 do_log(SMB_VFS_OP_CHDIR, (result >= 0), handle, "chdir|%s", path);
1522 static char *smb_full_audit_getwd(vfs_handle_struct *handle)
1526 result = SMB_VFS_NEXT_GETWD(handle);
1528 do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s",
1529 result == NULL? "" : result);
1534 static int smb_full_audit_ntimes(vfs_handle_struct *handle,
1535 const struct smb_filename *smb_fname,
1536 struct smb_file_time *ft)
1540 result = SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
1542 do_log(SMB_VFS_OP_NTIMES, (result >= 0), handle, "%s",
1543 smb_fname_str_do_log(smb_fname));
1548 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
1553 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
1555 do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
1556 "%s", fsp_str_do_log(fsp));
1561 static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp,
1568 result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
1570 do_log(SMB_VFS_OP_FALLOCATE, (result >= 0), handle,
1571 "%s", fsp_str_do_log(fsp));
1576 static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
1577 int op, off_t offset, off_t count, int type)
1581 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
1583 do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp_str_do_log(fsp));
1588 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
1589 struct files_struct *fsp,
1590 uint32_t share_mode, uint32_t access_mask)
1594 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
1596 do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
1597 fsp_str_do_log(fsp));
1602 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
1607 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
1609 do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
1610 fsp_str_do_log(fsp));
1615 static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
1616 off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
1620 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
1622 do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp_str_do_log(fsp));
1627 static int smb_full_audit_symlink(vfs_handle_struct *handle,
1628 const char *oldpath, const char *newpath)
1632 result = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
1634 do_log(SMB_VFS_OP_SYMLINK, (result >= 0), handle,
1635 "%s|%s", oldpath, newpath);
1640 static int smb_full_audit_readlink(vfs_handle_struct *handle,
1641 const char *path, char *buf, size_t bufsiz)
1645 result = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
1647 do_log(SMB_VFS_OP_READLINK, (result >= 0), handle, "%s", path);
1652 static int smb_full_audit_link(vfs_handle_struct *handle,
1653 const char *oldpath, const char *newpath)
1657 result = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
1659 do_log(SMB_VFS_OP_LINK, (result >= 0), handle,
1660 "%s|%s", oldpath, newpath);
1665 static int smb_full_audit_mknod(vfs_handle_struct *handle,
1666 const char *pathname, mode_t mode, SMB_DEV_T dev)
1670 result = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
1672 do_log(SMB_VFS_OP_MKNOD, (result >= 0), handle, "%s", pathname);
1677 static char *smb_full_audit_realpath(vfs_handle_struct *handle,
1682 result = SMB_VFS_NEXT_REALPATH(handle, path);
1684 do_log(SMB_VFS_OP_REALPATH, (result != NULL), handle, "%s", path);
1689 static int smb_full_audit_chflags(vfs_handle_struct *handle,
1690 const char *path, unsigned int flags)
1694 result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
1696 do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s", path);
1701 static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
1702 const SMB_STRUCT_STAT *sbuf)
1704 struct file_id id_zero;
1705 struct file_id result;
1707 ZERO_STRUCT(id_zero);
1709 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1711 do_log(SMB_VFS_OP_FILE_ID_CREATE,
1712 !file_id_equal(&id_zero, &result),
1713 handle, "%s", file_id_string_tos(&result));
1718 static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
1719 struct files_struct *fsp,
1720 const struct smb_filename *smb_fname,
1721 TALLOC_CTX *mem_ctx,
1722 unsigned int *pnum_streams,
1723 struct stream_struct **pstreams)
1727 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
1728 pnum_streams, pstreams);
1730 do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle,
1731 "%s", smb_fname->base_name);
1736 static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
1739 TALLOC_CTX *mem_ctx,
1744 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1747 do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle,
1748 "%s/%s->%s", path, name, (result == 0) ? "" : *found_name);
1753 static const char *smb_full_audit_connectpath(vfs_handle_struct *handle,
1758 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
1760 do_log(SMB_VFS_OP_CONNECTPATH, result != NULL, handle,
1766 static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1767 struct byte_range_lock *br_lck,
1768 struct lock_struct *plock,
1773 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1776 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle,
1777 "%s:%llu-%llu. type=%d. blocking=%d",
1778 fsp_str_do_log(brl_fsp(br_lck)),
1779 plock->start, plock->size, plock->lock_type, blocking_lock);
1784 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1785 struct messaging_context *msg_ctx,
1786 struct byte_range_lock *br_lck,
1787 const struct lock_struct *plock)
1791 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1794 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS, (result == 0), handle,
1795 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
1797 plock->size, plock->lock_type);
1802 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1803 struct byte_range_lock *br_lck,
1804 struct lock_struct *plock)
1808 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
1810 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS, (result == 0), handle,
1811 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
1813 plock->size, plock->lock_type);
1818 static bool smb_full_audit_strict_lock(struct vfs_handle_struct *handle,
1819 struct files_struct *fsp,
1820 struct lock_struct *plock)
1824 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1826 do_log(SMB_VFS_OP_STRICT_LOCK, result, handle,
1827 "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
1828 plock->size, plock->lock_type);
1833 static void smb_full_audit_strict_unlock(struct vfs_handle_struct *handle,
1834 struct files_struct *fsp,
1835 struct lock_struct *plock)
1837 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
1839 do_log(SMB_VFS_OP_STRICT_UNLOCK, true, handle,
1840 "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
1841 plock->size, plock->lock_type);
1844 static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle,
1846 enum vfs_translate_direction direction,
1847 TALLOC_CTX *mem_ctx,
1852 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1855 do_log(SMB_VFS_OP_TRANSLATE_NAME, NT_STATUS_IS_OK(result), handle, "");
1860 static struct tevent_req *smb_full_audit_copy_chunk_send(struct vfs_handle_struct *handle,
1861 TALLOC_CTX *mem_ctx,
1862 struct tevent_context *ev,
1863 struct files_struct *src_fsp,
1865 struct files_struct *dest_fsp,
1869 struct tevent_req *req;
1871 req = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp,
1872 src_off, dest_fsp, dest_off, num);
1874 do_log(SMB_VFS_OP_COPY_CHUNK_SEND, req, handle, "");
1879 static NTSTATUS smb_full_audit_copy_chunk_recv(struct vfs_handle_struct *handle,
1880 struct tevent_req *req,
1885 result = SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied);
1887 do_log(SMB_VFS_OP_COPY_CHUNK_RECV, NT_STATUS_IS_OK(result), handle, "");
1892 static NTSTATUS smb_full_audit_get_compression(vfs_handle_struct *handle,
1893 TALLOC_CTX *mem_ctx,
1894 struct files_struct *fsp,
1895 struct smb_filename *smb_fname,
1896 uint16_t *_compression_fmt)
1900 result = SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
1903 do_log(SMB_VFS_OP_GET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
1905 (fsp ? fsp_str_do_log(fsp) : smb_fname_str_do_log(smb_fname)));
1910 static NTSTATUS smb_full_audit_set_compression(vfs_handle_struct *handle,
1911 TALLOC_CTX *mem_ctx,
1912 struct files_struct *fsp,
1913 uint16_t compression_fmt)
1917 result = SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
1920 do_log(SMB_VFS_OP_SET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
1921 "%s", fsp_str_do_log(fsp));
1926 static NTSTATUS smb_full_audit_readdir_attr(struct vfs_handle_struct *handle,
1927 const struct smb_filename *fname,
1928 TALLOC_CTX *mem_ctx,
1929 struct readdir_attr_data **pattr_data)
1933 status = SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
1935 do_log(SMB_VFS_OP_READDIR_ATTR, NT_STATUS_IS_OK(status), handle, "%s",
1936 smb_fname_str_do_log(fname));
1941 static NTSTATUS smb_full_audit_get_dos_attributes(
1942 struct vfs_handle_struct *handle,
1943 struct smb_filename *smb_fname,
1948 status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
1952 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES,
1953 NT_STATUS_IS_OK(status),
1956 smb_fname_str_do_log(smb_fname));
1961 static NTSTATUS smb_full_audit_fget_dos_attributes(
1962 struct vfs_handle_struct *handle,
1963 struct files_struct *fsp,
1968 status = SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
1972 do_log(SMB_VFS_OP_FGET_DOS_ATTRIBUTES,
1973 NT_STATUS_IS_OK(status),
1976 fsp_str_do_log(fsp));
1981 static NTSTATUS smb_full_audit_set_dos_attributes(
1982 struct vfs_handle_struct *handle,
1983 const struct smb_filename *smb_fname,
1988 status = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
1992 do_log(SMB_VFS_OP_SET_DOS_ATTRIBUTES,
1993 NT_STATUS_IS_OK(status),
1996 smb_fname_str_do_log(smb_fname));
2001 static NTSTATUS smb_full_audit_fset_dos_attributes(
2002 struct vfs_handle_struct *handle,
2003 struct files_struct *fsp,
2008 status = SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
2012 do_log(SMB_VFS_OP_FSET_DOS_ATTRIBUTES,
2013 NT_STATUS_IS_OK(status),
2016 fsp_str_do_log(fsp));
2021 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
2022 uint32_t security_info,
2023 TALLOC_CTX *mem_ctx,
2024 struct security_descriptor **ppdesc)
2028 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info,
2031 do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
2032 "%s", fsp_str_do_log(fsp));
2037 static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
2038 const struct smb_filename *smb_fname,
2039 uint32_t security_info,
2040 TALLOC_CTX *mem_ctx,
2041 struct security_descriptor **ppdesc)
2045 result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info,
2048 do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
2049 "%s", smb_fname_str_do_log(smb_fname));
2054 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
2055 uint32_t security_info_sent,
2056 const struct security_descriptor *psd)
2058 struct vfs_full_audit_private_data *pd;
2062 SMB_VFS_HANDLE_GET_DATA(handle, pd,
2063 struct vfs_full_audit_private_data,
2064 return NT_STATUS_INTERNAL_ERROR);
2066 if (pd->log_secdesc) {
2067 sd = sddl_encode(talloc_tos(), psd, get_global_sam_sid());
2070 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
2072 do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle,
2073 "%s [%s]", fsp_str_do_log(fsp), sd ? sd : "");
2080 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
2081 const struct smb_filename *smb_fname,
2086 result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
2088 do_log(SMB_VFS_OP_CHMOD_ACL, (result >= 0), handle,
2089 "%s|%o", smb_fname->base_name, mode);
2094 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
2099 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
2101 do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle,
2102 "%s|%o", fsp_str_do_log(fsp), mode);
2107 static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
2109 SMB_ACL_TYPE_T type,
2110 TALLOC_CTX *mem_ctx)
2114 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
2116 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
2122 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
2123 files_struct *fsp, TALLOC_CTX *mem_ctx)
2127 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
2129 do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
2130 "%s", fsp_str_do_log(fsp));
2135 static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct *handle,
2137 TALLOC_CTX *mem_ctx,
2138 char **blob_description,
2143 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob);
2145 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, (result >= 0), handle,
2151 static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
2153 TALLOC_CTX *mem_ctx,
2154 char **blob_description,
2159 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob);
2161 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, (result >= 0), handle,
2162 "%s", fsp_str_do_log(fsp));
2167 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
2169 const char *name, SMB_ACL_TYPE_T acltype,
2174 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
2177 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE, (result >= 0), handle,
2183 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
2188 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
2190 do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
2191 "%s", fsp_str_do_log(fsp));
2196 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
2202 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
2204 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, (result >= 0), handle,
2210 static ssize_t smb_full_audit_getxattr(struct vfs_handle_struct *handle,
2212 const char *name, void *value, size_t size)
2216 result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
2218 do_log(SMB_VFS_OP_GETXATTR, (result >= 0), handle,
2219 "%s|%s", path, name);
2224 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
2225 struct files_struct *fsp,
2226 const char *name, void *value, size_t size)
2230 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
2232 do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
2233 "%s|%s", fsp_str_do_log(fsp), name);
2238 static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
2239 const char *path, char *list, size_t size)
2243 result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
2245 do_log(SMB_VFS_OP_LISTXATTR, (result >= 0), handle, "%s", path);
2250 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
2251 struct files_struct *fsp, char *list,
2256 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2258 do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
2259 "%s", fsp_str_do_log(fsp));
2264 static int smb_full_audit_removexattr(struct vfs_handle_struct *handle,
2270 result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
2272 do_log(SMB_VFS_OP_REMOVEXATTR, (result >= 0), handle,
2273 "%s|%s", path, name);
2278 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
2279 struct files_struct *fsp,
2284 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2286 do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
2287 "%s|%s", fsp_str_do_log(fsp), name);
2292 static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
2294 const char *name, const void *value, size_t size,
2299 result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
2302 do_log(SMB_VFS_OP_SETXATTR, (result >= 0), handle,
2303 "%s|%s", path, name);
2308 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
2309 struct files_struct *fsp, const char *name,
2310 const void *value, size_t size, int flags)
2314 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2316 do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
2317 "%s|%s", fsp_str_do_log(fsp), name);
2322 static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
2323 struct files_struct *fsp)
2327 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2328 do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
2329 "%s", fsp_str_do_log(fsp));
2334 static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
2335 const struct smb_filename *fname,
2336 SMB_STRUCT_STAT *sbuf)
2340 result = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
2341 do_log(SMB_VFS_OP_IS_OFFLINE, result, handle, "%s",
2342 smb_fname_str_do_log(fname));
2346 static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
2347 const struct smb_filename *fname)
2351 result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
2352 do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s",
2353 smb_fname_str_do_log(fname));
2357 static struct vfs_fn_pointers vfs_full_audit_fns = {
2359 /* Disk operations */
2361 .connect_fn = smb_full_audit_connect,
2362 .disconnect_fn = smb_full_audit_disconnect,
2363 .disk_free_fn = smb_full_audit_disk_free,
2364 .get_quota_fn = smb_full_audit_get_quota,
2365 .set_quota_fn = smb_full_audit_set_quota,
2366 .get_shadow_copy_data_fn = smb_full_audit_get_shadow_copy_data,
2367 .statvfs_fn = smb_full_audit_statvfs,
2368 .fs_capabilities_fn = smb_full_audit_fs_capabilities,
2369 .get_dfs_referrals_fn = smb_full_audit_get_dfs_referrals,
2370 .opendir_fn = smb_full_audit_opendir,
2371 .fdopendir_fn = smb_full_audit_fdopendir,
2372 .readdir_fn = smb_full_audit_readdir,
2373 .seekdir_fn = smb_full_audit_seekdir,
2374 .telldir_fn = smb_full_audit_telldir,
2375 .rewind_dir_fn = smb_full_audit_rewinddir,
2376 .mkdir_fn = smb_full_audit_mkdir,
2377 .rmdir_fn = smb_full_audit_rmdir,
2378 .closedir_fn = smb_full_audit_closedir,
2379 .init_search_op_fn = smb_full_audit_init_search_op,
2380 .open_fn = smb_full_audit_open,
2381 .create_file_fn = smb_full_audit_create_file,
2382 .close_fn = smb_full_audit_close,
2383 .read_fn = smb_full_audit_read,
2384 .pread_fn = smb_full_audit_pread,
2385 .pread_send_fn = smb_full_audit_pread_send,
2386 .pread_recv_fn = smb_full_audit_pread_recv,
2387 .write_fn = smb_full_audit_write,
2388 .pwrite_fn = smb_full_audit_pwrite,
2389 .pwrite_send_fn = smb_full_audit_pwrite_send,
2390 .pwrite_recv_fn = smb_full_audit_pwrite_recv,
2391 .lseek_fn = smb_full_audit_lseek,
2392 .sendfile_fn = smb_full_audit_sendfile,
2393 .recvfile_fn = smb_full_audit_recvfile,
2394 .rename_fn = smb_full_audit_rename,
2395 .fsync_fn = smb_full_audit_fsync,
2396 .fsync_send_fn = smb_full_audit_fsync_send,
2397 .fsync_recv_fn = smb_full_audit_fsync_recv,
2398 .stat_fn = smb_full_audit_stat,
2399 .fstat_fn = smb_full_audit_fstat,
2400 .lstat_fn = smb_full_audit_lstat,
2401 .get_alloc_size_fn = smb_full_audit_get_alloc_size,
2402 .unlink_fn = smb_full_audit_unlink,
2403 .chmod_fn = smb_full_audit_chmod,
2404 .fchmod_fn = smb_full_audit_fchmod,
2405 .chown_fn = smb_full_audit_chown,
2406 .fchown_fn = smb_full_audit_fchown,
2407 .lchown_fn = smb_full_audit_lchown,
2408 .chdir_fn = smb_full_audit_chdir,
2409 .getwd_fn = smb_full_audit_getwd,
2410 .ntimes_fn = smb_full_audit_ntimes,
2411 .ftruncate_fn = smb_full_audit_ftruncate,
2412 .fallocate_fn = smb_full_audit_fallocate,
2413 .lock_fn = smb_full_audit_lock,
2414 .kernel_flock_fn = smb_full_audit_kernel_flock,
2415 .linux_setlease_fn = smb_full_audit_linux_setlease,
2416 .getlock_fn = smb_full_audit_getlock,
2417 .symlink_fn = smb_full_audit_symlink,
2418 .readlink_fn = smb_full_audit_readlink,
2419 .link_fn = smb_full_audit_link,
2420 .mknod_fn = smb_full_audit_mknod,
2421 .realpath_fn = smb_full_audit_realpath,
2422 .chflags_fn = smb_full_audit_chflags,
2423 .file_id_create_fn = smb_full_audit_file_id_create,
2424 .copy_chunk_send_fn = smb_full_audit_copy_chunk_send,
2425 .copy_chunk_recv_fn = smb_full_audit_copy_chunk_recv,
2426 .get_compression_fn = smb_full_audit_get_compression,
2427 .set_compression_fn = smb_full_audit_set_compression,
2428 .snap_check_path_fn = smb_full_audit_snap_check_path,
2429 .snap_create_fn = smb_full_audit_snap_create,
2430 .snap_delete_fn = smb_full_audit_snap_delete,
2431 .streaminfo_fn = smb_full_audit_streaminfo,
2432 .get_real_filename_fn = smb_full_audit_get_real_filename,
2433 .connectpath_fn = smb_full_audit_connectpath,
2434 .brl_lock_windows_fn = smb_full_audit_brl_lock_windows,
2435 .brl_unlock_windows_fn = smb_full_audit_brl_unlock_windows,
2436 .brl_cancel_windows_fn = smb_full_audit_brl_cancel_windows,
2437 .strict_lock_fn = smb_full_audit_strict_lock,
2438 .strict_unlock_fn = smb_full_audit_strict_unlock,
2439 .translate_name_fn = smb_full_audit_translate_name,
2441 /* Missing fsctl_fn */
2443 .get_dos_attributes_fn = smb_full_audit_get_dos_attributes,
2444 .fget_dos_attributes_fn = smb_full_audit_fget_dos_attributes,
2445 .set_dos_attributes_fn = smb_full_audit_set_dos_attributes,
2446 .fset_dos_attributes_fn = smb_full_audit_fset_dos_attributes,
2447 .fget_nt_acl_fn = smb_full_audit_fget_nt_acl,
2448 .get_nt_acl_fn = smb_full_audit_get_nt_acl,
2449 .fset_nt_acl_fn = smb_full_audit_fset_nt_acl,
2451 /* Missing audit_file_fn */
2453 .chmod_acl_fn = smb_full_audit_chmod_acl,
2454 .fchmod_acl_fn = smb_full_audit_fchmod_acl,
2455 .sys_acl_get_file_fn = smb_full_audit_sys_acl_get_file,
2456 .sys_acl_get_fd_fn = smb_full_audit_sys_acl_get_fd,
2457 .sys_acl_blob_get_file_fn = smb_full_audit_sys_acl_blob_get_file,
2458 .sys_acl_blob_get_fd_fn = smb_full_audit_sys_acl_blob_get_fd,
2459 .sys_acl_set_file_fn = smb_full_audit_sys_acl_set_file,
2460 .sys_acl_set_fd_fn = smb_full_audit_sys_acl_set_fd,
2461 .sys_acl_delete_def_file_fn = smb_full_audit_sys_acl_delete_def_file,
2462 .getxattr_fn = smb_full_audit_getxattr,
2463 .fgetxattr_fn = smb_full_audit_fgetxattr,
2464 .listxattr_fn = smb_full_audit_listxattr,
2465 .flistxattr_fn = smb_full_audit_flistxattr,
2466 .removexattr_fn = smb_full_audit_removexattr,
2467 .fremovexattr_fn = smb_full_audit_fremovexattr,
2468 .setxattr_fn = smb_full_audit_setxattr,
2469 .fsetxattr_fn = smb_full_audit_fsetxattr,
2470 .aio_force_fn = smb_full_audit_aio_force,
2471 .is_offline_fn = smb_full_audit_is_offline,
2472 .set_offline_fn = smb_full_audit_set_offline,
2477 durable_disconnect_fn
2478 durable_reconnect_fn
2480 .readdir_attr_fn = smb_full_audit_readdir_attr
2485 NTSTATUS vfs_full_audit_init(void)
2487 NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
2488 "full_audit", &vfs_full_audit_fns);
2490 if (!NT_STATUS_IS_OK(ret))
2493 vfs_full_audit_debug_level = debug_add_class("full_audit");
2494 if (vfs_full_audit_debug_level == -1) {
2495 vfs_full_audit_debug_level = DBGC_VFS;
2496 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2499 DEBUG(10, ("vfs_full_audit: Debug class number of "
2500 "'full_audit': %d\n", vfs_full_audit_debug_level));