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_SNAP_CHECK_PATH,
101 SMB_VFS_OP_SNAP_CREATE,
102 SMB_VFS_OP_SNAP_DELETE,
104 /* Directory operations */
107 SMB_VFS_OP_FDOPENDIR,
111 SMB_VFS_OP_REWINDDIR,
115 SMB_VFS_OP_INIT_SEARCH_OP,
117 /* File operations */
120 SMB_VFS_OP_CREATE_FILE,
124 SMB_VFS_OP_PREAD_SEND,
125 SMB_VFS_OP_PREAD_RECV,
128 SMB_VFS_OP_PWRITE_SEND,
129 SMB_VFS_OP_PWRITE_RECV,
135 SMB_VFS_OP_FSYNC_SEND,
136 SMB_VFS_OP_FSYNC_RECV,
140 SMB_VFS_OP_GET_ALLOC_SIZE,
150 SMB_VFS_OP_FTRUNCATE,
151 SMB_VFS_OP_FALLOCATE,
153 SMB_VFS_OP_KERNEL_FLOCK,
154 SMB_VFS_OP_LINUX_SETLEASE,
162 SMB_VFS_OP_FILE_ID_CREATE,
163 SMB_VFS_OP_STREAMINFO,
164 SMB_VFS_OP_GET_REAL_FILENAME,
165 SMB_VFS_OP_CONNECTPATH,
166 SMB_VFS_OP_BRL_LOCK_WINDOWS,
167 SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
168 SMB_VFS_OP_BRL_CANCEL_WINDOWS,
169 SMB_VFS_OP_STRICT_LOCK,
170 SMB_VFS_OP_STRICT_UNLOCK,
171 SMB_VFS_OP_TRANSLATE_NAME,
172 SMB_VFS_OP_COPY_CHUNK_SEND,
173 SMB_VFS_OP_COPY_CHUNK_RECV,
174 SMB_VFS_OP_GET_COMPRESSION,
175 SMB_VFS_OP_SET_COMPRESSION,
176 SMB_VFS_OP_READDIR_ATTR,
178 /* NT ACL operations. */
180 SMB_VFS_OP_FGET_NT_ACL,
181 SMB_VFS_OP_GET_NT_ACL,
182 SMB_VFS_OP_FSET_NT_ACL,
184 /* POSIX ACL operations. */
186 SMB_VFS_OP_CHMOD_ACL,
187 SMB_VFS_OP_FCHMOD_ACL,
189 SMB_VFS_OP_SYS_ACL_GET_FILE,
190 SMB_VFS_OP_SYS_ACL_GET_FD,
191 SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE,
192 SMB_VFS_OP_SYS_ACL_BLOB_GET_FD,
193 SMB_VFS_OP_SYS_ACL_SET_FILE,
194 SMB_VFS_OP_SYS_ACL_SET_FD,
195 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
199 SMB_VFS_OP_FGETXATTR,
200 SMB_VFS_OP_LISTXATTR,
201 SMB_VFS_OP_FLISTXATTR,
202 SMB_VFS_OP_REMOVEXATTR,
203 SMB_VFS_OP_FREMOVEXATTR,
205 SMB_VFS_OP_FSETXATTR,
208 SMB_VFS_OP_AIO_FORCE,
210 /* offline operations */
211 SMB_VFS_OP_IS_OFFLINE,
212 SMB_VFS_OP_SET_OFFLINE,
214 /* This should always be last enum value */
219 /* The following array *must* be in the same order as defined in vfs_op_type */
225 { SMB_VFS_OP_CONNECT, "connect" },
226 { SMB_VFS_OP_DISCONNECT, "disconnect" },
227 { SMB_VFS_OP_DISK_FREE, "disk_free" },
228 { SMB_VFS_OP_GET_QUOTA, "get_quota" },
229 { SMB_VFS_OP_SET_QUOTA, "set_quota" },
230 { SMB_VFS_OP_GET_SHADOW_COPY_DATA, "get_shadow_copy_data" },
231 { SMB_VFS_OP_STATVFS, "statvfs" },
232 { SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" },
233 { SMB_VFS_OP_SNAP_CHECK_PATH, "snap_check_path" },
234 { SMB_VFS_OP_SNAP_CREATE, "snap_create" },
235 { SMB_VFS_OP_SNAP_DELETE, "snap_delete" },
236 { SMB_VFS_OP_OPENDIR, "opendir" },
237 { SMB_VFS_OP_FDOPENDIR, "fdopendir" },
238 { SMB_VFS_OP_READDIR, "readdir" },
239 { SMB_VFS_OP_SEEKDIR, "seekdir" },
240 { SMB_VFS_OP_TELLDIR, "telldir" },
241 { SMB_VFS_OP_REWINDDIR, "rewinddir" },
242 { SMB_VFS_OP_MKDIR, "mkdir" },
243 { SMB_VFS_OP_RMDIR, "rmdir" },
244 { SMB_VFS_OP_CLOSEDIR, "closedir" },
245 { SMB_VFS_OP_INIT_SEARCH_OP, "init_search_op" },
246 { SMB_VFS_OP_OPEN, "open" },
247 { SMB_VFS_OP_CREATE_FILE, "create_file" },
248 { SMB_VFS_OP_CLOSE, "close" },
249 { SMB_VFS_OP_READ, "read" },
250 { SMB_VFS_OP_PREAD, "pread" },
251 { SMB_VFS_OP_PREAD_SEND, "pread_send" },
252 { SMB_VFS_OP_PREAD_RECV, "pread_recv" },
253 { SMB_VFS_OP_WRITE, "write" },
254 { SMB_VFS_OP_PWRITE, "pwrite" },
255 { SMB_VFS_OP_PWRITE_SEND, "pwrite_send" },
256 { SMB_VFS_OP_PWRITE_RECV, "pwrite_recv" },
257 { SMB_VFS_OP_LSEEK, "lseek" },
258 { SMB_VFS_OP_SENDFILE, "sendfile" },
259 { SMB_VFS_OP_RECVFILE, "recvfile" },
260 { SMB_VFS_OP_RENAME, "rename" },
261 { SMB_VFS_OP_FSYNC, "fsync" },
262 { SMB_VFS_OP_FSYNC_SEND, "fsync_send" },
263 { SMB_VFS_OP_FSYNC_RECV, "fsync_recv" },
264 { SMB_VFS_OP_STAT, "stat" },
265 { SMB_VFS_OP_FSTAT, "fstat" },
266 { SMB_VFS_OP_LSTAT, "lstat" },
267 { SMB_VFS_OP_GET_ALLOC_SIZE, "get_alloc_size" },
268 { SMB_VFS_OP_UNLINK, "unlink" },
269 { SMB_VFS_OP_CHMOD, "chmod" },
270 { SMB_VFS_OP_FCHMOD, "fchmod" },
271 { SMB_VFS_OP_CHOWN, "chown" },
272 { SMB_VFS_OP_FCHOWN, "fchown" },
273 { SMB_VFS_OP_LCHOWN, "lchown" },
274 { SMB_VFS_OP_CHDIR, "chdir" },
275 { SMB_VFS_OP_GETWD, "getwd" },
276 { SMB_VFS_OP_NTIMES, "ntimes" },
277 { SMB_VFS_OP_FTRUNCATE, "ftruncate" },
278 { SMB_VFS_OP_FALLOCATE,"fallocate" },
279 { SMB_VFS_OP_LOCK, "lock" },
280 { SMB_VFS_OP_KERNEL_FLOCK, "kernel_flock" },
281 { SMB_VFS_OP_LINUX_SETLEASE, "linux_setlease" },
282 { SMB_VFS_OP_GETLOCK, "getlock" },
283 { SMB_VFS_OP_SYMLINK, "symlink" },
284 { SMB_VFS_OP_READLINK, "readlink" },
285 { SMB_VFS_OP_LINK, "link" },
286 { SMB_VFS_OP_MKNOD, "mknod" },
287 { SMB_VFS_OP_REALPATH, "realpath" },
288 { SMB_VFS_OP_CHFLAGS, "chflags" },
289 { SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
290 { SMB_VFS_OP_STREAMINFO, "streaminfo" },
291 { SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
292 { SMB_VFS_OP_CONNECTPATH, "connectpath" },
293 { SMB_VFS_OP_BRL_LOCK_WINDOWS, "brl_lock_windows" },
294 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS, "brl_unlock_windows" },
295 { SMB_VFS_OP_BRL_CANCEL_WINDOWS, "brl_cancel_windows" },
296 { SMB_VFS_OP_STRICT_LOCK, "strict_lock" },
297 { SMB_VFS_OP_STRICT_UNLOCK, "strict_unlock" },
298 { SMB_VFS_OP_TRANSLATE_NAME, "translate_name" },
299 { SMB_VFS_OP_COPY_CHUNK_SEND, "copy_chunk_send" },
300 { SMB_VFS_OP_COPY_CHUNK_RECV, "copy_chunk_recv" },
301 { SMB_VFS_OP_GET_COMPRESSION, "get_compression" },
302 { SMB_VFS_OP_SET_COMPRESSION, "set_compression" },
303 { SMB_VFS_OP_READDIR_ATTR, "readdir_attr" },
304 { SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" },
305 { SMB_VFS_OP_GET_NT_ACL, "get_nt_acl" },
306 { SMB_VFS_OP_FSET_NT_ACL, "fset_nt_acl" },
307 { SMB_VFS_OP_CHMOD_ACL, "chmod_acl" },
308 { SMB_VFS_OP_FCHMOD_ACL, "fchmod_acl" },
309 { SMB_VFS_OP_SYS_ACL_GET_FILE, "sys_acl_get_file" },
310 { SMB_VFS_OP_SYS_ACL_GET_FD, "sys_acl_get_fd" },
311 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, "sys_acl_blob_get_file" },
312 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, "sys_acl_blob_get_fd" },
313 { SMB_VFS_OP_SYS_ACL_SET_FILE, "sys_acl_set_file" },
314 { SMB_VFS_OP_SYS_ACL_SET_FD, "sys_acl_set_fd" },
315 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, "sys_acl_delete_def_file" },
316 { SMB_VFS_OP_GETXATTR, "getxattr" },
317 { SMB_VFS_OP_FGETXATTR, "fgetxattr" },
318 { SMB_VFS_OP_LISTXATTR, "listxattr" },
319 { SMB_VFS_OP_FLISTXATTR, "flistxattr" },
320 { SMB_VFS_OP_REMOVEXATTR, "removexattr" },
321 { SMB_VFS_OP_FREMOVEXATTR, "fremovexattr" },
322 { SMB_VFS_OP_SETXATTR, "setxattr" },
323 { SMB_VFS_OP_FSETXATTR, "fsetxattr" },
324 { SMB_VFS_OP_AIO_FORCE, "aio_force" },
325 { SMB_VFS_OP_IS_OFFLINE, "is_offline" },
326 { SMB_VFS_OP_SET_OFFLINE, "set_offline" },
327 { SMB_VFS_OP_LAST, NULL }
330 static int audit_syslog_facility(vfs_handle_struct *handle)
332 static const struct enum_list enum_log_facilities[] = {
333 { LOG_USER, "USER" },
334 { LOG_LOCAL0, "LOCAL0" },
335 { LOG_LOCAL1, "LOCAL1" },
336 { LOG_LOCAL2, "LOCAL2" },
337 { LOG_LOCAL3, "LOCAL3" },
338 { LOG_LOCAL4, "LOCAL4" },
339 { LOG_LOCAL5, "LOCAL5" },
340 { LOG_LOCAL6, "LOCAL6" },
341 { LOG_LOCAL7, "LOCAL7" },
347 facility = lp_parm_enum(SNUM(handle->conn), "full_audit", "facility", enum_log_facilities, LOG_USER);
352 static int audit_syslog_priority(vfs_handle_struct *handle)
354 static const struct enum_list enum_log_priorities[] = {
355 { LOG_EMERG, "EMERG" },
356 { LOG_ALERT, "ALERT" },
357 { LOG_CRIT, "CRIT" },
359 { LOG_WARNING, "WARNING" },
360 { LOG_NOTICE, "NOTICE" },
361 { LOG_INFO, "INFO" },
362 { LOG_DEBUG, "DEBUG" },
368 priority = lp_parm_enum(SNUM(handle->conn), "full_audit", "priority",
369 enum_log_priorities, LOG_NOTICE);
370 if (priority == -1) {
371 priority = LOG_WARNING;
377 static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
382 prefix = talloc_strdup(ctx,
383 lp_parm_const_string(SNUM(conn), "full_audit",
388 result = talloc_sub_advanced(ctx,
389 lp_servicename(talloc_tos(), SNUM(conn)),
390 conn->session_info->unix_info->unix_name,
392 conn->session_info->unix_token->gid,
393 conn->session_info->unix_info->sanitized_username,
394 conn->session_info->info->domain_name,
400 static bool log_success(struct vfs_full_audit_private_data *pd, vfs_op_type op)
402 if (pd->success_ops == NULL) {
406 return bitmap_query(pd->success_ops, op);
409 static bool log_failure(struct vfs_full_audit_private_data *pd, vfs_op_type op)
411 if (pd->failure_ops == NULL)
414 return bitmap_query(pd->failure_ops, op);
417 static struct bitmap *init_bitmap(TALLOC_CTX *mem_ctx, const char **ops)
425 bm = bitmap_talloc(mem_ctx, SMB_VFS_OP_LAST);
427 DEBUG(0, ("Could not alloc bitmap -- "
428 "defaulting to logging everything\n"));
432 for (; *ops != NULL; ops += 1) {
437 if (strequal(*ops, "all")) {
438 for (i=0; i<SMB_VFS_OP_LAST; i++) {
444 if (strequal(*ops, "none")) {
454 for (i=0; i<SMB_VFS_OP_LAST; i++) {
455 if ((vfs_op_names[i].name == NULL)
456 || (vfs_op_names[i].type != i)) {
457 smb_panic("vfs_full_audit.c: name table not "
458 "in sync with vfs_op_type enums\n");
460 if (strequal(op, vfs_op_names[i].name)) {
469 if (i == SMB_VFS_OP_LAST) {
470 DEBUG(0, ("Could not find opname %s, logging all\n",
479 static const char *audit_opname(vfs_op_type op)
481 if (op >= SMB_VFS_OP_LAST)
482 return "INVALID VFS OP";
483 return vfs_op_names[op].name;
486 static TALLOC_CTX *tmp_do_log_ctx;
488 * Get us a temporary talloc context usable just for DEBUG arguments
490 static TALLOC_CTX *do_log_ctx(void)
492 if (tmp_do_log_ctx == NULL) {
493 tmp_do_log_ctx = talloc_named_const(NULL, 0, "do_log_ctx");
495 return tmp_do_log_ctx;
498 static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
499 const char *format, ...)
501 struct vfs_full_audit_private_data *pd;
503 char *audit_pre = NULL;
507 SMB_VFS_HANDLE_GET_DATA(handle, pd,
508 struct vfs_full_audit_private_data,
511 if (success && (!log_success(pd, op)))
514 if (!success && (!log_failure(pd, op)))
518 fstrcpy(err_msg, "ok");
520 fstr_sprintf(err_msg, "fail (%s)", strerror(errno));
522 va_start(ap, format);
523 op_msg = talloc_vasprintf(talloc_tos(), format, ap);
530 audit_pre = audit_prefix(talloc_tos(), handle->conn);
536 * Specify the facility to interoperate with other syslog
537 * callers (smbd for example).
539 priority = pd->syslog_priority | pd->syslog_facility;
541 syslog(priority, "%s|%s|%s|%s\n",
542 audit_pre ? audit_pre : "",
543 audit_opname(op), err_msg, op_msg);
545 DEBUG(1, ("%s|%s|%s|%s\n",
546 audit_pre ? audit_pre : "",
547 audit_opname(op), err_msg, op_msg));
550 TALLOC_FREE(audit_pre);
552 TALLOC_FREE(tmp_do_log_ctx);
556 * Return a string using the do_log_ctx()
558 static const char *smb_fname_str_do_log(const struct smb_filename *smb_fname)
563 if (smb_fname == NULL) {
566 status = get_full_smb_filename(do_log_ctx(), smb_fname, &fname);
567 if (!NT_STATUS_IS_OK(status)) {
574 * Return an fsp debug string using the do_log_ctx()
576 static const char *fsp_str_do_log(const struct files_struct *fsp)
578 return smb_fname_str_do_log(fsp->fsp_name);
581 /* Implementation of vfs_ops. Pass everything on to the default
582 operation but log event first. */
584 static int smb_full_audit_connect(vfs_handle_struct *handle,
585 const char *svc, const char *user)
588 struct vfs_full_audit_private_data *pd = NULL;
590 result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
595 pd = talloc_zero(handle, struct vfs_full_audit_private_data);
597 SMB_VFS_NEXT_DISCONNECT(handle);
601 pd->syslog_facility = audit_syslog_facility(handle);
602 if (pd->syslog_facility == -1) {
603 DEBUG(1, ("%s: Unknown facility %s\n", __func__,
604 lp_parm_const_string(SNUM(handle->conn),
605 "full_audit", "facility",
607 SMB_VFS_NEXT_DISCONNECT(handle);
611 pd->syslog_priority = audit_syslog_priority(handle);
613 pd->log_secdesc = lp_parm_bool(SNUM(handle->conn),
614 "full_audit", "log_secdesc", false);
616 pd->do_syslog = lp_parm_bool(SNUM(handle->conn),
617 "full_audit", "syslog", true);
621 openlog("smbd_audit", 0, pd->syslog_facility);
625 pd->success_ops = init_bitmap(
626 pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
628 pd->failure_ops = init_bitmap(
629 pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
632 /* Store the private data. */
633 SMB_VFS_HANDLE_SET_DATA(handle, pd, NULL,
634 struct vfs_full_audit_private_data, return -1);
636 do_log(SMB_VFS_OP_CONNECT, True, handle,
642 static void smb_full_audit_disconnect(vfs_handle_struct *handle)
644 SMB_VFS_NEXT_DISCONNECT(handle);
646 do_log(SMB_VFS_OP_DISCONNECT, True, handle,
647 "%s", lp_servicename(talloc_tos(), SNUM(handle->conn)));
649 /* The bitmaps will be disconnected when the private
653 static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
654 const char *path, uint64_t *bsize,
655 uint64_t *dfree, uint64_t *dsize)
659 result = SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
661 /* Don't have a reasonable notion of failure here */
663 do_log(SMB_VFS_OP_DISK_FREE, True, handle, "%s", path);
668 static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
669 const char *path, enum SMB_QUOTA_TYPE qtype,
670 unid_t id, SMB_DISK_QUOTA *qt)
674 result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
676 do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s", path);
681 static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
682 enum SMB_QUOTA_TYPE qtype, unid_t id,
687 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
689 do_log(SMB_VFS_OP_SET_QUOTA, (result >= 0), handle, "");
694 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
695 struct files_struct *fsp,
696 struct shadow_copy_data *shadow_copy_data,
701 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
703 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA, (result >= 0), handle, "");
708 static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
710 struct vfs_statvfs_struct *statbuf)
714 result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
716 do_log(SMB_VFS_OP_STATVFS, (result >= 0), handle, "");
721 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
725 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
727 do_log(SMB_VFS_OP_FS_CAPABILITIES, true, handle, "");
732 static NTSTATUS smb_full_audit_snap_check_path(struct vfs_handle_struct *handle,
734 const char *service_path,
739 status = SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
741 do_log(SMB_VFS_OP_SNAP_CHECK_PATH, NT_STATUS_IS_OK(status),
747 static NTSTATUS smb_full_audit_snap_create(struct vfs_handle_struct *handle,
749 const char *base_volume,
757 status = SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
758 rw, base_path, snap_path);
759 do_log(SMB_VFS_OP_SNAP_CREATE, NT_STATUS_IS_OK(status), handle, "");
764 static NTSTATUS smb_full_audit_snap_delete(struct vfs_handle_struct *handle,
771 status = SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path,
773 do_log(SMB_VFS_OP_SNAP_DELETE, NT_STATUS_IS_OK(status), handle, "");
778 static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
779 const struct smb_filename *smb_fname,
785 result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
787 do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
788 smb_fname->base_name);
793 static DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
794 files_struct *fsp, const char *mask, uint32_t attr)
798 result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
800 do_log(SMB_VFS_OP_FDOPENDIR, (result != NULL), handle, "%s",
801 fsp_str_do_log(fsp));
806 static struct dirent *smb_full_audit_readdir(vfs_handle_struct *handle,
807 DIR *dirp, SMB_STRUCT_STAT *sbuf)
809 struct dirent *result;
811 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
813 /* This operation has no reasonable error condition
814 * (End of dir is also failure), so always succeed.
816 do_log(SMB_VFS_OP_READDIR, True, handle, "");
821 static void smb_full_audit_seekdir(vfs_handle_struct *handle,
822 DIR *dirp, long offset)
824 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
826 do_log(SMB_VFS_OP_SEEKDIR, True, handle, "");
829 static long smb_full_audit_telldir(vfs_handle_struct *handle,
834 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
836 do_log(SMB_VFS_OP_TELLDIR, True, handle, "");
841 static void smb_full_audit_rewinddir(vfs_handle_struct *handle,
844 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
846 do_log(SMB_VFS_OP_REWINDDIR, True, handle, "");
849 static int smb_full_audit_mkdir(vfs_handle_struct *handle,
850 const struct smb_filename *smb_fname, mode_t mode)
854 result = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
856 do_log(SMB_VFS_OP_MKDIR, (result >= 0), handle, "%s",
857 smb_fname->base_name);
862 static int smb_full_audit_rmdir(vfs_handle_struct *handle,
863 const struct smb_filename *smb_fname)
867 result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
869 do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s",
870 smb_fname->base_name);
875 static int smb_full_audit_closedir(vfs_handle_struct *handle,
880 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
882 do_log(SMB_VFS_OP_CLOSEDIR, (result >= 0), handle, "");
887 static void smb_full_audit_init_search_op(vfs_handle_struct *handle,
890 SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
892 do_log(SMB_VFS_OP_INIT_SEARCH_OP, True, handle, "");
895 static int smb_full_audit_open(vfs_handle_struct *handle,
896 struct smb_filename *smb_fname,
897 files_struct *fsp, int flags, mode_t mode)
901 result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
903 do_log(SMB_VFS_OP_OPEN, (result >= 0), handle, "%s|%s",
904 ((flags & O_WRONLY) || (flags & O_RDWR))?"w":"r",
905 smb_fname_str_do_log(smb_fname));
910 static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
911 struct smb_request *req,
912 uint16_t root_dir_fid,
913 struct smb_filename *smb_fname,
914 uint32_t access_mask,
915 uint32_t share_access,
916 uint32_t create_disposition,
917 uint32_t create_options,
918 uint32_t file_attributes,
919 uint32_t oplock_request,
920 struct smb2_lease *lease,
921 uint64_t allocation_size,
922 uint32_t private_flags,
923 struct security_descriptor *sd,
924 struct ea_list *ea_list,
925 files_struct **result_fsp,
927 const struct smb2_create_blobs *in_context_blobs,
928 struct smb2_create_blobs *out_context_blobs)
931 const char* str_create_disposition;
933 switch (create_disposition) {
935 str_create_disposition = "supersede";
937 case FILE_OVERWRITE_IF:
938 str_create_disposition = "overwrite_if";
941 str_create_disposition = "open";
944 str_create_disposition = "overwrite";
947 str_create_disposition = "create";
950 str_create_disposition = "open_if";
953 str_create_disposition = "unknown";
956 result = SMB_VFS_NEXT_CREATE_FILE(
959 root_dir_fid, /* root_dir_fid */
960 smb_fname, /* fname */
961 access_mask, /* access_mask */
962 share_access, /* share_access */
963 create_disposition, /* create_disposition*/
964 create_options, /* create_options */
965 file_attributes, /* file_attributes */
966 oplock_request, /* oplock_request */
968 allocation_size, /* allocation_size */
971 ea_list, /* ea_list */
972 result_fsp, /* result */
974 in_context_blobs, out_context_blobs); /* create context */
976 do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
977 "0x%x|%s|%s|%s", access_mask,
978 create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
979 str_create_disposition, smb_fname_str_do_log(smb_fname));
984 static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
988 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
990 do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s",
991 fsp_str_do_log(fsp));
996 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
997 void *data, size_t n)
1001 result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
1003 do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s",
1004 fsp_str_do_log(fsp));
1009 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
1010 void *data, size_t n, off_t offset)
1014 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
1016 do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s",
1017 fsp_str_do_log(fsp));
1022 struct smb_full_audit_pread_state {
1023 vfs_handle_struct *handle;
1026 struct vfs_aio_state vfs_aio_state;
1029 static void smb_full_audit_pread_done(struct tevent_req *subreq);
1031 static struct tevent_req *smb_full_audit_pread_send(
1032 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1033 struct tevent_context *ev, struct files_struct *fsp,
1034 void *data, size_t n, off_t offset)
1036 struct tevent_req *req, *subreq;
1037 struct smb_full_audit_pread_state *state;
1039 req = tevent_req_create(mem_ctx, &state,
1040 struct smb_full_audit_pread_state);
1042 do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
1043 fsp_str_do_log(fsp));
1046 state->handle = handle;
1049 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
1051 if (tevent_req_nomem(subreq, req)) {
1052 do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
1053 fsp_str_do_log(fsp));
1054 return tevent_req_post(req, ev);
1056 tevent_req_set_callback(subreq, smb_full_audit_pread_done, req);
1058 do_log(SMB_VFS_OP_PREAD_SEND, true, handle, "%s", fsp_str_do_log(fsp));
1062 static void smb_full_audit_pread_done(struct tevent_req *subreq)
1064 struct tevent_req *req = tevent_req_callback_data(
1065 subreq, struct tevent_req);
1066 struct smb_full_audit_pread_state *state = tevent_req_data(
1067 req, struct smb_full_audit_pread_state);
1069 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
1070 TALLOC_FREE(subreq);
1071 tevent_req_done(req);
1074 static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
1075 struct vfs_aio_state *vfs_aio_state)
1077 struct smb_full_audit_pread_state *state = tevent_req_data(
1078 req, struct smb_full_audit_pread_state);
1080 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1081 do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
1082 fsp_str_do_log(state->fsp));
1086 do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
1087 fsp_str_do_log(state->fsp));
1089 *vfs_aio_state = state->vfs_aio_state;
1093 static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
1094 const void *data, size_t n)
1098 result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
1100 do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s",
1101 fsp_str_do_log(fsp));
1106 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
1107 const void *data, size_t n,
1112 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
1114 do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s",
1115 fsp_str_do_log(fsp));
1120 struct smb_full_audit_pwrite_state {
1121 vfs_handle_struct *handle;
1124 struct vfs_aio_state vfs_aio_state;
1127 static void smb_full_audit_pwrite_done(struct tevent_req *subreq);
1129 static struct tevent_req *smb_full_audit_pwrite_send(
1130 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1131 struct tevent_context *ev, struct files_struct *fsp,
1132 const void *data, size_t n, off_t offset)
1134 struct tevent_req *req, *subreq;
1135 struct smb_full_audit_pwrite_state *state;
1137 req = tevent_req_create(mem_ctx, &state,
1138 struct smb_full_audit_pwrite_state);
1140 do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
1141 fsp_str_do_log(fsp));
1144 state->handle = handle;
1147 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
1149 if (tevent_req_nomem(subreq, req)) {
1150 do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
1151 fsp_str_do_log(fsp));
1152 return tevent_req_post(req, ev);
1154 tevent_req_set_callback(subreq, smb_full_audit_pwrite_done, req);
1156 do_log(SMB_VFS_OP_PWRITE_SEND, true, handle, "%s",
1157 fsp_str_do_log(fsp));
1161 static void smb_full_audit_pwrite_done(struct tevent_req *subreq)
1163 struct tevent_req *req = tevent_req_callback_data(
1164 subreq, struct tevent_req);
1165 struct smb_full_audit_pwrite_state *state = tevent_req_data(
1166 req, struct smb_full_audit_pwrite_state);
1168 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
1169 TALLOC_FREE(subreq);
1170 tevent_req_done(req);
1173 static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req,
1174 struct vfs_aio_state *vfs_aio_state)
1176 struct smb_full_audit_pwrite_state *state = tevent_req_data(
1177 req, struct smb_full_audit_pwrite_state);
1179 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1180 do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
1181 fsp_str_do_log(state->fsp));
1185 do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
1186 fsp_str_do_log(state->fsp));
1188 *vfs_aio_state = state->vfs_aio_state;
1192 static off_t smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
1193 off_t offset, int whence)
1197 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
1199 do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
1200 "%s", fsp_str_do_log(fsp));
1205 static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
1206 files_struct *fromfsp,
1207 const DATA_BLOB *hdr, off_t offset,
1212 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
1214 do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
1215 "%s", fsp_str_do_log(fromfsp));
1220 static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
1221 files_struct *tofsp,
1227 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
1229 do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
1230 "%s", fsp_str_do_log(tofsp));
1235 static int smb_full_audit_rename(vfs_handle_struct *handle,
1236 const struct smb_filename *smb_fname_src,
1237 const struct smb_filename *smb_fname_dst)
1241 result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
1243 do_log(SMB_VFS_OP_RENAME, (result >= 0), handle, "%s|%s",
1244 smb_fname_str_do_log(smb_fname_src),
1245 smb_fname_str_do_log(smb_fname_dst));
1250 static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
1254 result = SMB_VFS_NEXT_FSYNC(handle, fsp);
1256 do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s",
1257 fsp_str_do_log(fsp));
1262 struct smb_full_audit_fsync_state {
1263 vfs_handle_struct *handle;
1266 struct vfs_aio_state vfs_aio_state;
1269 static void smb_full_audit_fsync_done(struct tevent_req *subreq);
1271 static struct tevent_req *smb_full_audit_fsync_send(
1272 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1273 struct tevent_context *ev, struct files_struct *fsp)
1275 struct tevent_req *req, *subreq;
1276 struct smb_full_audit_fsync_state *state;
1278 req = tevent_req_create(mem_ctx, &state,
1279 struct smb_full_audit_fsync_state);
1281 do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
1282 fsp_str_do_log(fsp));
1285 state->handle = handle;
1288 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
1289 if (tevent_req_nomem(subreq, req)) {
1290 do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
1291 fsp_str_do_log(fsp));
1292 return tevent_req_post(req, ev);
1294 tevent_req_set_callback(subreq, smb_full_audit_fsync_done, req);
1296 do_log(SMB_VFS_OP_FSYNC_SEND, true, handle, "%s", fsp_str_do_log(fsp));
1300 static void smb_full_audit_fsync_done(struct tevent_req *subreq)
1302 struct tevent_req *req = tevent_req_callback_data(
1303 subreq, struct tevent_req);
1304 struct smb_full_audit_fsync_state *state = tevent_req_data(
1305 req, struct smb_full_audit_fsync_state);
1307 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
1308 TALLOC_FREE(subreq);
1309 tevent_req_done(req);
1312 static int smb_full_audit_fsync_recv(struct tevent_req *req,
1313 struct vfs_aio_state *vfs_aio_state)
1315 struct smb_full_audit_fsync_state *state = tevent_req_data(
1316 req, struct smb_full_audit_fsync_state);
1318 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1319 do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
1320 fsp_str_do_log(state->fsp));
1324 do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
1325 fsp_str_do_log(state->fsp));
1327 *vfs_aio_state = state->vfs_aio_state;
1331 static int smb_full_audit_stat(vfs_handle_struct *handle,
1332 struct smb_filename *smb_fname)
1336 result = SMB_VFS_NEXT_STAT(handle, smb_fname);
1338 do_log(SMB_VFS_OP_STAT, (result >= 0), handle, "%s",
1339 smb_fname_str_do_log(smb_fname));
1344 static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
1345 SMB_STRUCT_STAT *sbuf)
1349 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
1351 do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s",
1352 fsp_str_do_log(fsp));
1357 static int smb_full_audit_lstat(vfs_handle_struct *handle,
1358 struct smb_filename *smb_fname)
1362 result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
1364 do_log(SMB_VFS_OP_LSTAT, (result >= 0), handle, "%s",
1365 smb_fname_str_do_log(smb_fname));
1370 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
1371 files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
1375 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
1377 do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result != (uint64_t)-1), handle,
1383 static int smb_full_audit_unlink(vfs_handle_struct *handle,
1384 const struct smb_filename *smb_fname)
1388 result = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
1390 do_log(SMB_VFS_OP_UNLINK, (result >= 0), handle, "%s",
1391 smb_fname_str_do_log(smb_fname));
1396 static int smb_full_audit_chmod(vfs_handle_struct *handle,
1397 const char *path, mode_t mode)
1401 result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
1403 do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o", path, mode);
1408 static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
1413 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
1415 do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
1416 "%s|%o", fsp_str_do_log(fsp), mode);
1421 static int smb_full_audit_chown(vfs_handle_struct *handle,
1422 const char *path, uid_t uid, gid_t gid)
1426 result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
1428 do_log(SMB_VFS_OP_CHOWN, (result >= 0), handle, "%s|%ld|%ld",
1429 path, (long int)uid, (long int)gid);
1434 static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
1435 uid_t uid, gid_t gid)
1439 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
1441 do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
1442 fsp_str_do_log(fsp), (long int)uid, (long int)gid);
1447 static int smb_full_audit_lchown(vfs_handle_struct *handle,
1448 const char *path, uid_t uid, gid_t gid)
1452 result = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
1454 do_log(SMB_VFS_OP_LCHOWN, (result >= 0), handle, "%s|%ld|%ld",
1455 path, (long int)uid, (long int)gid);
1460 static int smb_full_audit_chdir(vfs_handle_struct *handle,
1465 result = SMB_VFS_NEXT_CHDIR(handle, path);
1467 do_log(SMB_VFS_OP_CHDIR, (result >= 0), handle, "chdir|%s", path);
1472 static char *smb_full_audit_getwd(vfs_handle_struct *handle)
1476 result = SMB_VFS_NEXT_GETWD(handle);
1478 do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s",
1479 result == NULL? "" : result);
1484 static int smb_full_audit_ntimes(vfs_handle_struct *handle,
1485 const struct smb_filename *smb_fname,
1486 struct smb_file_time *ft)
1490 result = SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
1492 do_log(SMB_VFS_OP_NTIMES, (result >= 0), handle, "%s",
1493 smb_fname_str_do_log(smb_fname));
1498 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
1503 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
1505 do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
1506 "%s", fsp_str_do_log(fsp));
1511 static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp,
1518 result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
1520 do_log(SMB_VFS_OP_FALLOCATE, (result >= 0), handle,
1521 "%s", fsp_str_do_log(fsp));
1526 static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
1527 int op, off_t offset, off_t count, int type)
1531 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
1533 do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp_str_do_log(fsp));
1538 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
1539 struct files_struct *fsp,
1540 uint32_t share_mode, uint32_t access_mask)
1544 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
1546 do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
1547 fsp_str_do_log(fsp));
1552 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
1557 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
1559 do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
1560 fsp_str_do_log(fsp));
1565 static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
1566 off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
1570 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
1572 do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp_str_do_log(fsp));
1577 static int smb_full_audit_symlink(vfs_handle_struct *handle,
1578 const char *oldpath, const char *newpath)
1582 result = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
1584 do_log(SMB_VFS_OP_SYMLINK, (result >= 0), handle,
1585 "%s|%s", oldpath, newpath);
1590 static int smb_full_audit_readlink(vfs_handle_struct *handle,
1591 const char *path, char *buf, size_t bufsiz)
1595 result = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
1597 do_log(SMB_VFS_OP_READLINK, (result >= 0), handle, "%s", path);
1602 static int smb_full_audit_link(vfs_handle_struct *handle,
1603 const char *oldpath, const char *newpath)
1607 result = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
1609 do_log(SMB_VFS_OP_LINK, (result >= 0), handle,
1610 "%s|%s", oldpath, newpath);
1615 static int smb_full_audit_mknod(vfs_handle_struct *handle,
1616 const char *pathname, mode_t mode, SMB_DEV_T dev)
1620 result = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
1622 do_log(SMB_VFS_OP_MKNOD, (result >= 0), handle, "%s", pathname);
1627 static char *smb_full_audit_realpath(vfs_handle_struct *handle,
1632 result = SMB_VFS_NEXT_REALPATH(handle, path);
1634 do_log(SMB_VFS_OP_REALPATH, (result != NULL), handle, "%s", path);
1639 static int smb_full_audit_chflags(vfs_handle_struct *handle,
1640 const char *path, unsigned int flags)
1644 result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
1646 do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s", path);
1651 static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
1652 const SMB_STRUCT_STAT *sbuf)
1654 struct file_id id_zero;
1655 struct file_id result;
1657 ZERO_STRUCT(id_zero);
1659 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1661 do_log(SMB_VFS_OP_FILE_ID_CREATE,
1662 !file_id_equal(&id_zero, &result),
1663 handle, "%s", file_id_string_tos(&result));
1668 static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
1669 struct files_struct *fsp,
1671 TALLOC_CTX *mem_ctx,
1672 unsigned int *pnum_streams,
1673 struct stream_struct **pstreams)
1677 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
1678 pnum_streams, pstreams);
1680 do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle,
1686 static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
1689 TALLOC_CTX *mem_ctx,
1694 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1697 do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle,
1698 "%s/%s->%s", path, name, (result == 0) ? "" : *found_name);
1703 static const char *smb_full_audit_connectpath(vfs_handle_struct *handle,
1708 result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
1710 do_log(SMB_VFS_OP_CONNECTPATH, result != NULL, handle,
1716 static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1717 struct byte_range_lock *br_lck,
1718 struct lock_struct *plock,
1723 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1726 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle,
1727 "%s:%llu-%llu. type=%d. blocking=%d",
1728 fsp_str_do_log(brl_fsp(br_lck)),
1729 plock->start, plock->size, plock->lock_type, blocking_lock);
1734 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1735 struct messaging_context *msg_ctx,
1736 struct byte_range_lock *br_lck,
1737 const struct lock_struct *plock)
1741 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1744 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS, (result == 0), handle,
1745 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
1747 plock->size, plock->lock_type);
1752 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1753 struct byte_range_lock *br_lck,
1754 struct lock_struct *plock)
1758 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
1760 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS, (result == 0), handle,
1761 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
1763 plock->size, plock->lock_type);
1768 static bool smb_full_audit_strict_lock(struct vfs_handle_struct *handle,
1769 struct files_struct *fsp,
1770 struct lock_struct *plock)
1774 result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
1776 do_log(SMB_VFS_OP_STRICT_LOCK, result, handle,
1777 "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
1778 plock->size, plock->lock_type);
1783 static void smb_full_audit_strict_unlock(struct vfs_handle_struct *handle,
1784 struct files_struct *fsp,
1785 struct lock_struct *plock)
1787 SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
1789 do_log(SMB_VFS_OP_STRICT_UNLOCK, true, handle,
1790 "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
1791 plock->size, plock->lock_type);
1794 static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle,
1796 enum vfs_translate_direction direction,
1797 TALLOC_CTX *mem_ctx,
1802 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1805 do_log(SMB_VFS_OP_TRANSLATE_NAME, NT_STATUS_IS_OK(result), handle, "");
1810 static struct tevent_req *smb_full_audit_copy_chunk_send(struct vfs_handle_struct *handle,
1811 TALLOC_CTX *mem_ctx,
1812 struct tevent_context *ev,
1813 struct files_struct *src_fsp,
1815 struct files_struct *dest_fsp,
1819 struct tevent_req *req;
1821 req = SMB_VFS_NEXT_COPY_CHUNK_SEND(handle, mem_ctx, ev, src_fsp,
1822 src_off, dest_fsp, dest_off, num);
1824 do_log(SMB_VFS_OP_COPY_CHUNK_SEND, req, handle, "");
1829 static NTSTATUS smb_full_audit_copy_chunk_recv(struct vfs_handle_struct *handle,
1830 struct tevent_req *req,
1835 result = SMB_VFS_NEXT_COPY_CHUNK_RECV(handle, req, copied);
1837 do_log(SMB_VFS_OP_COPY_CHUNK_RECV, NT_STATUS_IS_OK(result), handle, "");
1842 static NTSTATUS smb_full_audit_get_compression(vfs_handle_struct *handle,
1843 TALLOC_CTX *mem_ctx,
1844 struct files_struct *fsp,
1845 struct smb_filename *smb_fname,
1846 uint16_t *_compression_fmt)
1850 result = SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
1853 do_log(SMB_VFS_OP_GET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
1855 (fsp ? fsp_str_do_log(fsp) : smb_fname_str_do_log(smb_fname)));
1860 static NTSTATUS smb_full_audit_set_compression(vfs_handle_struct *handle,
1861 TALLOC_CTX *mem_ctx,
1862 struct files_struct *fsp,
1863 uint16_t compression_fmt)
1867 result = SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
1870 do_log(SMB_VFS_OP_SET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
1871 "%s", fsp_str_do_log(fsp));
1876 static NTSTATUS smb_full_audit_readdir_attr(struct vfs_handle_struct *handle,
1877 const struct smb_filename *fname,
1878 TALLOC_CTX *mem_ctx,
1879 struct readdir_attr_data **pattr_data)
1883 status = SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
1885 do_log(SMB_VFS_OP_READDIR_ATTR, NT_STATUS_IS_OK(status), handle, "%s",
1886 smb_fname_str_do_log(fname));
1891 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1892 uint32_t security_info,
1893 TALLOC_CTX *mem_ctx,
1894 struct security_descriptor **ppdesc)
1898 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info,
1901 do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
1902 "%s", fsp_str_do_log(fsp));
1907 static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
1908 const struct smb_filename *smb_fname,
1909 uint32_t security_info,
1910 TALLOC_CTX *mem_ctx,
1911 struct security_descriptor **ppdesc)
1915 result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info,
1918 do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
1919 "%s", smb_fname_str_do_log(smb_fname));
1924 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
1925 uint32_t security_info_sent,
1926 const struct security_descriptor *psd)
1928 struct vfs_full_audit_private_data *pd;
1932 SMB_VFS_HANDLE_GET_DATA(handle, pd,
1933 struct vfs_full_audit_private_data,
1934 return NT_STATUS_INTERNAL_ERROR);
1936 if (pd->log_secdesc) {
1937 sd = sddl_encode(talloc_tos(), psd, get_global_sam_sid());
1940 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
1942 do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle,
1943 "%s [%s]", fsp_str_do_log(fsp), sd ? sd : "");
1950 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
1951 const char *path, mode_t mode)
1955 result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
1957 do_log(SMB_VFS_OP_CHMOD_ACL, (result >= 0), handle,
1958 "%s|%o", path, mode);
1963 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
1968 result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
1970 do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle,
1971 "%s|%o", fsp_str_do_log(fsp), mode);
1976 static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
1978 SMB_ACL_TYPE_T type,
1979 TALLOC_CTX *mem_ctx)
1983 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type, mem_ctx);
1985 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
1991 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
1992 files_struct *fsp, TALLOC_CTX *mem_ctx)
1996 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
1998 do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
1999 "%s", fsp_str_do_log(fsp));
2004 static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct *handle,
2006 TALLOC_CTX *mem_ctx,
2007 char **blob_description,
2012 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, path_p, mem_ctx, blob_description, blob);
2014 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, (result >= 0), handle,
2020 static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
2022 TALLOC_CTX *mem_ctx,
2023 char **blob_description,
2028 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob);
2030 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, (result >= 0), handle,
2031 "%s", fsp_str_do_log(fsp));
2036 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
2038 const char *name, SMB_ACL_TYPE_T acltype,
2043 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
2046 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE, (result >= 0), handle,
2052 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
2057 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
2059 do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
2060 "%s", fsp_str_do_log(fsp));
2065 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
2071 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
2073 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, (result >= 0), handle,
2079 static ssize_t smb_full_audit_getxattr(struct vfs_handle_struct *handle,
2081 const char *name, void *value, size_t size)
2085 result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
2087 do_log(SMB_VFS_OP_GETXATTR, (result >= 0), handle,
2088 "%s|%s", path, name);
2093 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
2094 struct files_struct *fsp,
2095 const char *name, void *value, size_t size)
2099 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
2101 do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
2102 "%s|%s", fsp_str_do_log(fsp), name);
2107 static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
2108 const char *path, char *list, size_t size)
2112 result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
2114 do_log(SMB_VFS_OP_LISTXATTR, (result >= 0), handle, "%s", path);
2119 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
2120 struct files_struct *fsp, char *list,
2125 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2127 do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
2128 "%s", fsp_str_do_log(fsp));
2133 static int smb_full_audit_removexattr(struct vfs_handle_struct *handle,
2139 result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
2141 do_log(SMB_VFS_OP_REMOVEXATTR, (result >= 0), handle,
2142 "%s|%s", path, name);
2147 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
2148 struct files_struct *fsp,
2153 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2155 do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
2156 "%s|%s", fsp_str_do_log(fsp), name);
2161 static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
2163 const char *name, const void *value, size_t size,
2168 result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
2171 do_log(SMB_VFS_OP_SETXATTR, (result >= 0), handle,
2172 "%s|%s", path, name);
2177 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
2178 struct files_struct *fsp, const char *name,
2179 const void *value, size_t size, int flags)
2183 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2185 do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
2186 "%s|%s", fsp_str_do_log(fsp), name);
2191 static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
2192 struct files_struct *fsp)
2196 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2197 do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
2198 "%s", fsp_str_do_log(fsp));
2203 static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
2204 const struct smb_filename *fname,
2205 SMB_STRUCT_STAT *sbuf)
2209 result = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
2210 do_log(SMB_VFS_OP_IS_OFFLINE, result, handle, "%s",
2211 smb_fname_str_do_log(fname));
2215 static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
2216 const struct smb_filename *fname)
2220 result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
2221 do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s",
2222 smb_fname_str_do_log(fname));
2226 static struct vfs_fn_pointers vfs_full_audit_fns = {
2228 /* Disk operations */
2230 .connect_fn = smb_full_audit_connect,
2231 .disconnect_fn = smb_full_audit_disconnect,
2232 .disk_free_fn = smb_full_audit_disk_free,
2233 .get_quota_fn = smb_full_audit_get_quota,
2234 .set_quota_fn = smb_full_audit_set_quota,
2235 .get_shadow_copy_data_fn = smb_full_audit_get_shadow_copy_data,
2236 .statvfs_fn = smb_full_audit_statvfs,
2237 .fs_capabilities_fn = smb_full_audit_fs_capabilities,
2238 .snap_check_path_fn = smb_full_audit_snap_check_path,
2239 .snap_create_fn = smb_full_audit_snap_create,
2240 .snap_delete_fn = smb_full_audit_snap_delete,
2241 .opendir_fn = smb_full_audit_opendir,
2242 .fdopendir_fn = smb_full_audit_fdopendir,
2243 .readdir_fn = smb_full_audit_readdir,
2244 .seekdir_fn = smb_full_audit_seekdir,
2245 .telldir_fn = smb_full_audit_telldir,
2246 .rewind_dir_fn = smb_full_audit_rewinddir,
2247 .mkdir_fn = smb_full_audit_mkdir,
2248 .rmdir_fn = smb_full_audit_rmdir,
2249 .closedir_fn = smb_full_audit_closedir,
2250 .init_search_op_fn = smb_full_audit_init_search_op,
2251 .open_fn = smb_full_audit_open,
2252 .create_file_fn = smb_full_audit_create_file,
2253 .close_fn = smb_full_audit_close,
2254 .read_fn = smb_full_audit_read,
2255 .pread_fn = smb_full_audit_pread,
2256 .pread_send_fn = smb_full_audit_pread_send,
2257 .pread_recv_fn = smb_full_audit_pread_recv,
2258 .write_fn = smb_full_audit_write,
2259 .pwrite_fn = smb_full_audit_pwrite,
2260 .pwrite_send_fn = smb_full_audit_pwrite_send,
2261 .pwrite_recv_fn = smb_full_audit_pwrite_recv,
2262 .lseek_fn = smb_full_audit_lseek,
2263 .sendfile_fn = smb_full_audit_sendfile,
2264 .recvfile_fn = smb_full_audit_recvfile,
2265 .rename_fn = smb_full_audit_rename,
2266 .fsync_fn = smb_full_audit_fsync,
2267 .fsync_send_fn = smb_full_audit_fsync_send,
2268 .fsync_recv_fn = smb_full_audit_fsync_recv,
2269 .stat_fn = smb_full_audit_stat,
2270 .fstat_fn = smb_full_audit_fstat,
2271 .lstat_fn = smb_full_audit_lstat,
2272 .get_alloc_size_fn = smb_full_audit_get_alloc_size,
2273 .unlink_fn = smb_full_audit_unlink,
2274 .chmod_fn = smb_full_audit_chmod,
2275 .fchmod_fn = smb_full_audit_fchmod,
2276 .chown_fn = smb_full_audit_chown,
2277 .fchown_fn = smb_full_audit_fchown,
2278 .lchown_fn = smb_full_audit_lchown,
2279 .chdir_fn = smb_full_audit_chdir,
2280 .getwd_fn = smb_full_audit_getwd,
2281 .ntimes_fn = smb_full_audit_ntimes,
2282 .ftruncate_fn = smb_full_audit_ftruncate,
2283 .fallocate_fn = smb_full_audit_fallocate,
2284 .lock_fn = smb_full_audit_lock,
2285 .kernel_flock_fn = smb_full_audit_kernel_flock,
2286 .linux_setlease_fn = smb_full_audit_linux_setlease,
2287 .getlock_fn = smb_full_audit_getlock,
2288 .symlink_fn = smb_full_audit_symlink,
2289 .readlink_fn = smb_full_audit_readlink,
2290 .link_fn = smb_full_audit_link,
2291 .mknod_fn = smb_full_audit_mknod,
2292 .realpath_fn = smb_full_audit_realpath,
2293 .chflags_fn = smb_full_audit_chflags,
2294 .file_id_create_fn = smb_full_audit_file_id_create,
2295 .streaminfo_fn = smb_full_audit_streaminfo,
2296 .get_real_filename_fn = smb_full_audit_get_real_filename,
2297 .connectpath_fn = smb_full_audit_connectpath,
2298 .brl_lock_windows_fn = smb_full_audit_brl_lock_windows,
2299 .brl_unlock_windows_fn = smb_full_audit_brl_unlock_windows,
2300 .brl_cancel_windows_fn = smb_full_audit_brl_cancel_windows,
2301 .strict_lock_fn = smb_full_audit_strict_lock,
2302 .strict_unlock_fn = smb_full_audit_strict_unlock,
2303 .translate_name_fn = smb_full_audit_translate_name,
2304 .copy_chunk_send_fn = smb_full_audit_copy_chunk_send,
2305 .copy_chunk_recv_fn = smb_full_audit_copy_chunk_recv,
2306 .get_compression_fn = smb_full_audit_get_compression,
2307 .set_compression_fn = smb_full_audit_set_compression,
2308 .readdir_attr_fn = smb_full_audit_readdir_attr,
2309 .fget_nt_acl_fn = smb_full_audit_fget_nt_acl,
2310 .get_nt_acl_fn = smb_full_audit_get_nt_acl,
2311 .fset_nt_acl_fn = smb_full_audit_fset_nt_acl,
2312 .chmod_acl_fn = smb_full_audit_chmod_acl,
2313 .fchmod_acl_fn = smb_full_audit_fchmod_acl,
2314 .sys_acl_get_file_fn = smb_full_audit_sys_acl_get_file,
2315 .sys_acl_get_fd_fn = smb_full_audit_sys_acl_get_fd,
2316 .sys_acl_blob_get_file_fn = smb_full_audit_sys_acl_blob_get_file,
2317 .sys_acl_blob_get_fd_fn = smb_full_audit_sys_acl_blob_get_fd,
2318 .sys_acl_set_file_fn = smb_full_audit_sys_acl_set_file,
2319 .sys_acl_set_fd_fn = smb_full_audit_sys_acl_set_fd,
2320 .sys_acl_delete_def_file_fn = smb_full_audit_sys_acl_delete_def_file,
2321 .getxattr_fn = smb_full_audit_getxattr,
2322 .fgetxattr_fn = smb_full_audit_fgetxattr,
2323 .listxattr_fn = smb_full_audit_listxattr,
2324 .flistxattr_fn = smb_full_audit_flistxattr,
2325 .removexattr_fn = smb_full_audit_removexattr,
2326 .fremovexattr_fn = smb_full_audit_fremovexattr,
2327 .setxattr_fn = smb_full_audit_setxattr,
2328 .fsetxattr_fn = smb_full_audit_fsetxattr,
2329 .aio_force_fn = smb_full_audit_aio_force,
2330 .is_offline_fn = smb_full_audit_is_offline,
2331 .set_offline_fn = smb_full_audit_set_offline,
2335 NTSTATUS vfs_full_audit_init(void)
2337 NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
2338 "full_audit", &vfs_full_audit_fns);
2340 if (!NT_STATUS_IS_OK(ret))
2343 vfs_full_audit_debug_level = debug_add_class("full_audit");
2344 if (vfs_full_audit_debug_level == -1) {
2345 vfs_full_audit_debug_level = DBGC_VFS;
2346 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2349 DEBUG(10, ("vfs_full_audit: Debug class number of "
2350 "'full_audit': %d\n", vfs_full_audit_debug_level));