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,
114 /* File operations */
117 SMB_VFS_OP_CREATE_FILE,
121 SMB_VFS_OP_PREAD_SEND,
122 SMB_VFS_OP_PREAD_RECV,
125 SMB_VFS_OP_PWRITE_SEND,
126 SMB_VFS_OP_PWRITE_RECV,
132 SMB_VFS_OP_FSYNC_SEND,
133 SMB_VFS_OP_FSYNC_RECV,
137 SMB_VFS_OP_GET_ALLOC_SIZE,
147 SMB_VFS_OP_FTRUNCATE,
148 SMB_VFS_OP_FALLOCATE,
150 SMB_VFS_OP_KERNEL_FLOCK,
151 SMB_VFS_OP_LINUX_SETLEASE,
159 SMB_VFS_OP_FILE_ID_CREATE,
160 SMB_VFS_OP_STREAMINFO,
161 SMB_VFS_OP_GET_REAL_FILENAME,
162 SMB_VFS_OP_CONNECTPATH,
163 SMB_VFS_OP_BRL_LOCK_WINDOWS,
164 SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
165 SMB_VFS_OP_BRL_CANCEL_WINDOWS,
166 SMB_VFS_OP_STRICT_LOCK_CHECK,
167 SMB_VFS_OP_TRANSLATE_NAME,
169 SMB_VFS_OP_OFFLOAD_READ_SEND,
170 SMB_VFS_OP_OFFLOAD_READ_RECV,
171 SMB_VFS_OP_OFFLOAD_WRITE_SEND,
172 SMB_VFS_OP_OFFLOAD_WRITE_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 SMB_VFS_OP_AUDIT_FILE,
192 /* POSIX ACL operations. */
194 SMB_VFS_OP_FCHMOD_ACL,
196 SMB_VFS_OP_SYS_ACL_GET_FILE,
197 SMB_VFS_OP_SYS_ACL_GET_FD,
198 SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE,
199 SMB_VFS_OP_SYS_ACL_BLOB_GET_FD,
200 SMB_VFS_OP_SYS_ACL_SET_FILE,
201 SMB_VFS_OP_SYS_ACL_SET_FD,
202 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
206 SMB_VFS_OP_FGETXATTR,
207 SMB_VFS_OP_LISTXATTR,
208 SMB_VFS_OP_FLISTXATTR,
209 SMB_VFS_OP_REMOVEXATTR,
210 SMB_VFS_OP_FREMOVEXATTR,
212 SMB_VFS_OP_FSETXATTR,
215 SMB_VFS_OP_AIO_FORCE,
217 /* offline operations */
218 SMB_VFS_OP_IS_OFFLINE,
219 SMB_VFS_OP_SET_OFFLINE,
221 /* Durable handle operations. */
222 SMB_VFS_OP_DURABLE_COOKIE,
223 SMB_VFS_OP_DURABLE_DISCONNECT,
224 SMB_VFS_OP_DURABLE_RECONNECT,
226 SMB_VFS_OP_READDIR_ATTR,
228 /* This should always be last enum value */
233 /* The following array *must* be in the same order as defined in vfs_op_type */
239 { SMB_VFS_OP_CONNECT, "connect" },
240 { SMB_VFS_OP_DISCONNECT, "disconnect" },
241 { SMB_VFS_OP_DISK_FREE, "disk_free" },
242 { SMB_VFS_OP_GET_QUOTA, "get_quota" },
243 { SMB_VFS_OP_SET_QUOTA, "set_quota" },
244 { SMB_VFS_OP_GET_SHADOW_COPY_DATA, "get_shadow_copy_data" },
245 { SMB_VFS_OP_STATVFS, "statvfs" },
246 { SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" },
247 { SMB_VFS_OP_GET_DFS_REFERRALS, "get_dfs_referrals" },
248 { SMB_VFS_OP_OPENDIR, "opendir" },
249 { SMB_VFS_OP_FDOPENDIR, "fdopendir" },
250 { SMB_VFS_OP_READDIR, "readdir" },
251 { SMB_VFS_OP_SEEKDIR, "seekdir" },
252 { SMB_VFS_OP_TELLDIR, "telldir" },
253 { SMB_VFS_OP_REWINDDIR, "rewinddir" },
254 { SMB_VFS_OP_MKDIR, "mkdir" },
255 { SMB_VFS_OP_RMDIR, "rmdir" },
256 { SMB_VFS_OP_CLOSEDIR, "closedir" },
257 { SMB_VFS_OP_OPEN, "open" },
258 { SMB_VFS_OP_CREATE_FILE, "create_file" },
259 { SMB_VFS_OP_CLOSE, "close" },
260 { SMB_VFS_OP_READ, "read" },
261 { SMB_VFS_OP_PREAD, "pread" },
262 { SMB_VFS_OP_PREAD_SEND, "pread_send" },
263 { SMB_VFS_OP_PREAD_RECV, "pread_recv" },
264 { SMB_VFS_OP_WRITE, "write" },
265 { SMB_VFS_OP_PWRITE, "pwrite" },
266 { SMB_VFS_OP_PWRITE_SEND, "pwrite_send" },
267 { SMB_VFS_OP_PWRITE_RECV, "pwrite_recv" },
268 { SMB_VFS_OP_LSEEK, "lseek" },
269 { SMB_VFS_OP_SENDFILE, "sendfile" },
270 { SMB_VFS_OP_RECVFILE, "recvfile" },
271 { SMB_VFS_OP_RENAME, "rename" },
272 { SMB_VFS_OP_FSYNC, "fsync" },
273 { SMB_VFS_OP_FSYNC_SEND, "fsync_send" },
274 { SMB_VFS_OP_FSYNC_RECV, "fsync_recv" },
275 { SMB_VFS_OP_STAT, "stat" },
276 { SMB_VFS_OP_FSTAT, "fstat" },
277 { SMB_VFS_OP_LSTAT, "lstat" },
278 { SMB_VFS_OP_GET_ALLOC_SIZE, "get_alloc_size" },
279 { SMB_VFS_OP_UNLINK, "unlink" },
280 { SMB_VFS_OP_CHMOD, "chmod" },
281 { SMB_VFS_OP_FCHMOD, "fchmod" },
282 { SMB_VFS_OP_CHOWN, "chown" },
283 { SMB_VFS_OP_FCHOWN, "fchown" },
284 { SMB_VFS_OP_LCHOWN, "lchown" },
285 { SMB_VFS_OP_CHDIR, "chdir" },
286 { SMB_VFS_OP_GETWD, "getwd" },
287 { SMB_VFS_OP_NTIMES, "ntimes" },
288 { SMB_VFS_OP_FTRUNCATE, "ftruncate" },
289 { SMB_VFS_OP_FALLOCATE,"fallocate" },
290 { SMB_VFS_OP_LOCK, "lock" },
291 { SMB_VFS_OP_KERNEL_FLOCK, "kernel_flock" },
292 { SMB_VFS_OP_LINUX_SETLEASE, "linux_setlease" },
293 { SMB_VFS_OP_GETLOCK, "getlock" },
294 { SMB_VFS_OP_SYMLINK, "symlink" },
295 { SMB_VFS_OP_READLINK, "readlink" },
296 { SMB_VFS_OP_LINK, "link" },
297 { SMB_VFS_OP_MKNOD, "mknod" },
298 { SMB_VFS_OP_REALPATH, "realpath" },
299 { SMB_VFS_OP_CHFLAGS, "chflags" },
300 { SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
301 { SMB_VFS_OP_STREAMINFO, "streaminfo" },
302 { SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
303 { SMB_VFS_OP_CONNECTPATH, "connectpath" },
304 { SMB_VFS_OP_BRL_LOCK_WINDOWS, "brl_lock_windows" },
305 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS, "brl_unlock_windows" },
306 { SMB_VFS_OP_BRL_CANCEL_WINDOWS, "brl_cancel_windows" },
307 { SMB_VFS_OP_STRICT_LOCK_CHECK, "strict_lock_check" },
308 { SMB_VFS_OP_TRANSLATE_NAME, "translate_name" },
309 { SMB_VFS_OP_FSCTL, "fsctl" },
310 { SMB_VFS_OP_OFFLOAD_READ_SEND, "offload_read_send" },
311 { SMB_VFS_OP_OFFLOAD_READ_RECV, "offload_read_recv" },
312 { SMB_VFS_OP_OFFLOAD_WRITE_SEND, "offload_write_send" },
313 { SMB_VFS_OP_OFFLOAD_WRITE_RECV, "offload_write_recv" },
314 { SMB_VFS_OP_GET_COMPRESSION, "get_compression" },
315 { SMB_VFS_OP_SET_COMPRESSION, "set_compression" },
316 { SMB_VFS_OP_SNAP_CHECK_PATH, "snap_check_path" },
317 { SMB_VFS_OP_SNAP_CREATE, "snap_create" },
318 { SMB_VFS_OP_SNAP_DELETE, "snap_delete" },
319 { SMB_VFS_OP_GET_DOS_ATTRIBUTES, "get_dos_attributes" },
320 { SMB_VFS_OP_FGET_DOS_ATTRIBUTES, "fget_dos_attributes" },
321 { SMB_VFS_OP_SET_DOS_ATTRIBUTES, "set_dos_attributes" },
322 { SMB_VFS_OP_FSET_DOS_ATTRIBUTES, "fset_dos_attributes" },
323 { SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" },
324 { SMB_VFS_OP_GET_NT_ACL, "get_nt_acl" },
325 { SMB_VFS_OP_FSET_NT_ACL, "fset_nt_acl" },
326 { SMB_VFS_OP_AUDIT_FILE, "audit_file" },
327 { SMB_VFS_OP_SYS_ACL_GET_FILE, "sys_acl_get_file" },
328 { SMB_VFS_OP_SYS_ACL_GET_FD, "sys_acl_get_fd" },
329 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, "sys_acl_blob_get_file" },
330 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, "sys_acl_blob_get_fd" },
331 { SMB_VFS_OP_SYS_ACL_SET_FILE, "sys_acl_set_file" },
332 { SMB_VFS_OP_SYS_ACL_SET_FD, "sys_acl_set_fd" },
333 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, "sys_acl_delete_def_file" },
334 { SMB_VFS_OP_GETXATTR, "getxattr" },
335 { SMB_VFS_OP_FGETXATTR, "fgetxattr" },
336 { SMB_VFS_OP_LISTXATTR, "listxattr" },
337 { SMB_VFS_OP_FLISTXATTR, "flistxattr" },
338 { SMB_VFS_OP_REMOVEXATTR, "removexattr" },
339 { SMB_VFS_OP_FREMOVEXATTR, "fremovexattr" },
340 { SMB_VFS_OP_SETXATTR, "setxattr" },
341 { SMB_VFS_OP_FSETXATTR, "fsetxattr" },
342 { SMB_VFS_OP_AIO_FORCE, "aio_force" },
343 { SMB_VFS_OP_IS_OFFLINE, "is_offline" },
344 { SMB_VFS_OP_SET_OFFLINE, "set_offline" },
345 { SMB_VFS_OP_DURABLE_COOKIE, "durable_cookie" },
346 { SMB_VFS_OP_DURABLE_DISCONNECT, "durable_disconnect" },
347 { SMB_VFS_OP_DURABLE_RECONNECT, "durable_reconnect" },
348 { SMB_VFS_OP_READDIR_ATTR, "readdir_attr" },
349 { SMB_VFS_OP_LAST, NULL }
352 static int audit_syslog_facility(vfs_handle_struct *handle)
354 static const struct enum_list enum_log_facilities[] = {
355 { LOG_USER, "USER" },
356 { LOG_LOCAL0, "LOCAL0" },
357 { LOG_LOCAL1, "LOCAL1" },
358 { LOG_LOCAL2, "LOCAL2" },
359 { LOG_LOCAL3, "LOCAL3" },
360 { LOG_LOCAL4, "LOCAL4" },
361 { LOG_LOCAL5, "LOCAL5" },
362 { LOG_LOCAL6, "LOCAL6" },
363 { LOG_LOCAL7, "LOCAL7" },
369 facility = lp_parm_enum(SNUM(handle->conn), "full_audit", "facility", enum_log_facilities, LOG_USER);
374 static int audit_syslog_priority(vfs_handle_struct *handle)
376 static const struct enum_list enum_log_priorities[] = {
377 { LOG_EMERG, "EMERG" },
378 { LOG_ALERT, "ALERT" },
379 { LOG_CRIT, "CRIT" },
381 { LOG_WARNING, "WARNING" },
382 { LOG_NOTICE, "NOTICE" },
383 { LOG_INFO, "INFO" },
384 { LOG_DEBUG, "DEBUG" },
390 priority = lp_parm_enum(SNUM(handle->conn), "full_audit", "priority",
391 enum_log_priorities, LOG_NOTICE);
392 if (priority == -1) {
393 priority = LOG_WARNING;
399 static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
404 prefix = talloc_strdup(ctx,
405 lp_parm_const_string(SNUM(conn), "full_audit",
410 result = talloc_sub_advanced(ctx,
411 lp_servicename(talloc_tos(), SNUM(conn)),
412 conn->session_info->unix_info->unix_name,
414 conn->session_info->unix_token->gid,
415 conn->session_info->unix_info->sanitized_username,
416 conn->session_info->info->domain_name,
422 static bool log_success(struct vfs_full_audit_private_data *pd, vfs_op_type op)
424 if (pd->success_ops == NULL) {
428 return bitmap_query(pd->success_ops, op);
431 static bool log_failure(struct vfs_full_audit_private_data *pd, vfs_op_type op)
433 if (pd->failure_ops == NULL)
436 return bitmap_query(pd->failure_ops, op);
439 static struct bitmap *init_bitmap(TALLOC_CTX *mem_ctx, const char **ops)
447 bm = bitmap_talloc(mem_ctx, SMB_VFS_OP_LAST);
449 DEBUG(0, ("Could not alloc bitmap -- "
450 "defaulting to logging everything\n"));
454 for (; *ops != NULL; ops += 1) {
459 if (strequal(*ops, "all")) {
460 for (i=0; i<SMB_VFS_OP_LAST; i++) {
466 if (strequal(*ops, "none")) {
476 for (i=0; i<SMB_VFS_OP_LAST; i++) {
477 if ((vfs_op_names[i].name == NULL)
478 || (vfs_op_names[i].type != i)) {
479 smb_panic("vfs_full_audit.c: name table not "
480 "in sync with vfs_op_type enums\n");
482 if (strequal(op, vfs_op_names[i].name)) {
491 if (i == SMB_VFS_OP_LAST) {
492 DEBUG(0, ("Could not find opname %s, logging all\n",
501 static const char *audit_opname(vfs_op_type op)
503 if (op >= SMB_VFS_OP_LAST)
504 return "INVALID VFS OP";
505 return vfs_op_names[op].name;
508 static TALLOC_CTX *tmp_do_log_ctx;
510 * Get us a temporary talloc context usable just for DEBUG arguments
512 static TALLOC_CTX *do_log_ctx(void)
514 if (tmp_do_log_ctx == NULL) {
515 tmp_do_log_ctx = talloc_named_const(NULL, 0, "do_log_ctx");
517 return tmp_do_log_ctx;
520 static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
521 const char *format, ...) PRINTF_ATTRIBUTE(4, 5);
523 static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
524 const char *format, ...)
526 struct vfs_full_audit_private_data *pd;
528 char *audit_pre = NULL;
532 SMB_VFS_HANDLE_GET_DATA(handle, pd,
533 struct vfs_full_audit_private_data,
536 if (success && (!log_success(pd, op)))
539 if (!success && (!log_failure(pd, op)))
543 fstrcpy(err_msg, "ok");
545 fstr_sprintf(err_msg, "fail (%s)", strerror(errno));
547 va_start(ap, format);
548 op_msg = talloc_vasprintf(talloc_tos(), format, ap);
555 audit_pre = audit_prefix(talloc_tos(), handle->conn);
561 * Specify the facility to interoperate with other syslog
562 * callers (smbd for example).
564 priority = pd->syslog_priority | pd->syslog_facility;
566 syslog(priority, "%s|%s|%s|%s\n",
567 audit_pre ? audit_pre : "",
568 audit_opname(op), err_msg, op_msg);
570 DEBUG(1, ("%s|%s|%s|%s\n",
571 audit_pre ? audit_pre : "",
572 audit_opname(op), err_msg, op_msg));
575 TALLOC_FREE(audit_pre);
577 TALLOC_FREE(tmp_do_log_ctx);
581 * Return a string using the do_log_ctx()
583 static const char *smb_fname_str_do_log(const struct smb_filename *smb_fname)
588 if (smb_fname == NULL) {
591 status = get_full_smb_filename(do_log_ctx(), smb_fname, &fname);
592 if (!NT_STATUS_IS_OK(status)) {
599 * Return an fsp debug string using the do_log_ctx()
601 static const char *fsp_str_do_log(const struct files_struct *fsp)
603 return smb_fname_str_do_log(fsp->fsp_name);
606 /* Implementation of vfs_ops. Pass everything on to the default
607 operation but log event first. */
609 static int smb_full_audit_connect(vfs_handle_struct *handle,
610 const char *svc, const char *user)
613 struct vfs_full_audit_private_data *pd = NULL;
615 result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
620 pd = talloc_zero(handle, struct vfs_full_audit_private_data);
622 SMB_VFS_NEXT_DISCONNECT(handle);
626 pd->syslog_facility = audit_syslog_facility(handle);
627 if (pd->syslog_facility == -1) {
628 DEBUG(1, ("%s: Unknown facility %s\n", __func__,
629 lp_parm_const_string(SNUM(handle->conn),
630 "full_audit", "facility",
632 SMB_VFS_NEXT_DISCONNECT(handle);
636 pd->syslog_priority = audit_syslog_priority(handle);
638 pd->log_secdesc = lp_parm_bool(SNUM(handle->conn),
639 "full_audit", "log_secdesc", false);
641 pd->do_syslog = lp_parm_bool(SNUM(handle->conn),
642 "full_audit", "syslog", true);
646 openlog("smbd_audit", 0, pd->syslog_facility);
650 pd->success_ops = init_bitmap(
651 pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
653 pd->failure_ops = init_bitmap(
654 pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
657 /* Store the private data. */
658 SMB_VFS_HANDLE_SET_DATA(handle, pd, NULL,
659 struct vfs_full_audit_private_data, return -1);
661 do_log(SMB_VFS_OP_CONNECT, True, handle,
667 static void smb_full_audit_disconnect(vfs_handle_struct *handle)
669 SMB_VFS_NEXT_DISCONNECT(handle);
671 do_log(SMB_VFS_OP_DISCONNECT, True, handle,
672 "%s", lp_servicename(talloc_tos(), SNUM(handle->conn)));
674 /* The bitmaps will be disconnected when the private
678 static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
679 const struct smb_filename *smb_fname,
686 result = SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
688 /* Don't have a reasonable notion of failure here */
690 do_log(SMB_VFS_OP_DISK_FREE, True, handle, "%s", smb_fname->base_name);
695 static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
696 const struct smb_filename *smb_fname,
697 enum SMB_QUOTA_TYPE qtype,
703 result = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt);
705 do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s",
706 smb_fname->base_name);
711 static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
712 enum SMB_QUOTA_TYPE qtype, unid_t id,
717 result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
719 do_log(SMB_VFS_OP_SET_QUOTA, (result >= 0), handle, "");
724 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
725 struct files_struct *fsp,
726 struct shadow_copy_data *shadow_copy_data,
731 result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
733 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA, (result >= 0), handle, "");
738 static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
739 const struct smb_filename *smb_fname,
740 struct vfs_statvfs_struct *statbuf)
744 result = SMB_VFS_NEXT_STATVFS(handle, smb_fname, statbuf);
746 do_log(SMB_VFS_OP_STATVFS, (result >= 0), handle, "");
751 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
755 result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
757 do_log(SMB_VFS_OP_FS_CAPABILITIES, true, handle, "");
762 static NTSTATUS smb_full_audit_get_dfs_referrals(
763 struct vfs_handle_struct *handle,
764 struct dfs_GetDFSReferral *r)
768 status = SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
770 do_log(SMB_VFS_OP_GET_DFS_REFERRALS, NT_STATUS_IS_OK(status),
776 static NTSTATUS smb_full_audit_snap_check_path(struct vfs_handle_struct *handle,
778 const char *service_path,
783 status = SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
785 do_log(SMB_VFS_OP_SNAP_CHECK_PATH, NT_STATUS_IS_OK(status),
791 static NTSTATUS smb_full_audit_snap_create(struct vfs_handle_struct *handle,
793 const char *base_volume,
801 status = SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
802 rw, base_path, snap_path);
803 do_log(SMB_VFS_OP_SNAP_CREATE, NT_STATUS_IS_OK(status), handle, "");
808 static NTSTATUS smb_full_audit_snap_delete(struct vfs_handle_struct *handle,
815 status = SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path,
817 do_log(SMB_VFS_OP_SNAP_DELETE, NT_STATUS_IS_OK(status), handle, "");
822 static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
823 const struct smb_filename *smb_fname,
829 result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
831 do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
832 smb_fname->base_name);
837 static DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
838 files_struct *fsp, const char *mask, uint32_t attr)
842 result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
844 do_log(SMB_VFS_OP_FDOPENDIR, (result != NULL), handle, "%s",
845 fsp_str_do_log(fsp));
850 static struct dirent *smb_full_audit_readdir(vfs_handle_struct *handle,
851 DIR *dirp, SMB_STRUCT_STAT *sbuf)
853 struct dirent *result;
855 result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
857 /* This operation has no reasonable error condition
858 * (End of dir is also failure), so always succeed.
860 do_log(SMB_VFS_OP_READDIR, True, handle, "");
865 static void smb_full_audit_seekdir(vfs_handle_struct *handle,
866 DIR *dirp, long offset)
868 SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
870 do_log(SMB_VFS_OP_SEEKDIR, True, handle, "");
873 static long smb_full_audit_telldir(vfs_handle_struct *handle,
878 result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
880 do_log(SMB_VFS_OP_TELLDIR, True, handle, "");
885 static void smb_full_audit_rewinddir(vfs_handle_struct *handle,
888 SMB_VFS_NEXT_REWINDDIR(handle, dirp);
890 do_log(SMB_VFS_OP_REWINDDIR, True, handle, "");
893 static int smb_full_audit_mkdir(vfs_handle_struct *handle,
894 const struct smb_filename *smb_fname, mode_t mode)
898 result = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
900 do_log(SMB_VFS_OP_MKDIR, (result >= 0), handle, "%s",
901 smb_fname->base_name);
906 static int smb_full_audit_rmdir(vfs_handle_struct *handle,
907 const struct smb_filename *smb_fname)
911 result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
913 do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s",
914 smb_fname->base_name);
919 static int smb_full_audit_closedir(vfs_handle_struct *handle,
924 result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
926 do_log(SMB_VFS_OP_CLOSEDIR, (result >= 0), handle, "");
931 static int smb_full_audit_open(vfs_handle_struct *handle,
932 struct smb_filename *smb_fname,
933 files_struct *fsp, int flags, mode_t mode)
937 result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
939 do_log(SMB_VFS_OP_OPEN, (result >= 0), handle, "%s|%s",
940 ((flags & O_WRONLY) || (flags & O_RDWR))?"w":"r",
941 smb_fname_str_do_log(smb_fname));
946 static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
947 struct smb_request *req,
948 uint16_t root_dir_fid,
949 struct smb_filename *smb_fname,
950 uint32_t access_mask,
951 uint32_t share_access,
952 uint32_t create_disposition,
953 uint32_t create_options,
954 uint32_t file_attributes,
955 uint32_t oplock_request,
956 struct smb2_lease *lease,
957 uint64_t allocation_size,
958 uint32_t private_flags,
959 struct security_descriptor *sd,
960 struct ea_list *ea_list,
961 files_struct **result_fsp,
963 const struct smb2_create_blobs *in_context_blobs,
964 struct smb2_create_blobs *out_context_blobs)
967 const char* str_create_disposition;
969 switch (create_disposition) {
971 str_create_disposition = "supersede";
973 case FILE_OVERWRITE_IF:
974 str_create_disposition = "overwrite_if";
977 str_create_disposition = "open";
980 str_create_disposition = "overwrite";
983 str_create_disposition = "create";
986 str_create_disposition = "open_if";
989 str_create_disposition = "unknown";
992 result = SMB_VFS_NEXT_CREATE_FILE(
995 root_dir_fid, /* root_dir_fid */
996 smb_fname, /* fname */
997 access_mask, /* access_mask */
998 share_access, /* share_access */
999 create_disposition, /* create_disposition*/
1000 create_options, /* create_options */
1001 file_attributes, /* file_attributes */
1002 oplock_request, /* oplock_request */
1004 allocation_size, /* allocation_size */
1007 ea_list, /* ea_list */
1008 result_fsp, /* result */
1010 in_context_blobs, out_context_blobs); /* create context */
1012 do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
1013 "0x%x|%s|%s|%s", access_mask,
1014 create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
1015 str_create_disposition, smb_fname_str_do_log(smb_fname));
1020 static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
1024 result = SMB_VFS_NEXT_CLOSE(handle, fsp);
1026 do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s",
1027 fsp_str_do_log(fsp));
1032 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
1033 void *data, size_t n, off_t offset)
1037 result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
1039 do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s",
1040 fsp_str_do_log(fsp));
1045 struct smb_full_audit_pread_state {
1046 vfs_handle_struct *handle;
1049 struct vfs_aio_state vfs_aio_state;
1052 static void smb_full_audit_pread_done(struct tevent_req *subreq);
1054 static struct tevent_req *smb_full_audit_pread_send(
1055 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1056 struct tevent_context *ev, struct files_struct *fsp,
1057 void *data, size_t n, off_t offset)
1059 struct tevent_req *req, *subreq;
1060 struct smb_full_audit_pread_state *state;
1062 req = tevent_req_create(mem_ctx, &state,
1063 struct smb_full_audit_pread_state);
1065 do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
1066 fsp_str_do_log(fsp));
1069 state->handle = handle;
1072 subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
1074 if (tevent_req_nomem(subreq, req)) {
1075 do_log(SMB_VFS_OP_PREAD_SEND, false, handle, "%s",
1076 fsp_str_do_log(fsp));
1077 return tevent_req_post(req, ev);
1079 tevent_req_set_callback(subreq, smb_full_audit_pread_done, req);
1081 do_log(SMB_VFS_OP_PREAD_SEND, true, handle, "%s", fsp_str_do_log(fsp));
1085 static void smb_full_audit_pread_done(struct tevent_req *subreq)
1087 struct tevent_req *req = tevent_req_callback_data(
1088 subreq, struct tevent_req);
1089 struct smb_full_audit_pread_state *state = tevent_req_data(
1090 req, struct smb_full_audit_pread_state);
1092 state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
1093 TALLOC_FREE(subreq);
1094 tevent_req_done(req);
1097 static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
1098 struct vfs_aio_state *vfs_aio_state)
1100 struct smb_full_audit_pread_state *state = tevent_req_data(
1101 req, struct smb_full_audit_pread_state);
1103 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1104 do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
1105 fsp_str_do_log(state->fsp));
1109 do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
1110 fsp_str_do_log(state->fsp));
1112 *vfs_aio_state = state->vfs_aio_state;
1116 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
1117 const void *data, size_t n,
1122 result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
1124 do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s",
1125 fsp_str_do_log(fsp));
1130 struct smb_full_audit_pwrite_state {
1131 vfs_handle_struct *handle;
1134 struct vfs_aio_state vfs_aio_state;
1137 static void smb_full_audit_pwrite_done(struct tevent_req *subreq);
1139 static struct tevent_req *smb_full_audit_pwrite_send(
1140 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1141 struct tevent_context *ev, struct files_struct *fsp,
1142 const void *data, size_t n, off_t offset)
1144 struct tevent_req *req, *subreq;
1145 struct smb_full_audit_pwrite_state *state;
1147 req = tevent_req_create(mem_ctx, &state,
1148 struct smb_full_audit_pwrite_state);
1150 do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
1151 fsp_str_do_log(fsp));
1154 state->handle = handle;
1157 subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
1159 if (tevent_req_nomem(subreq, req)) {
1160 do_log(SMB_VFS_OP_PWRITE_SEND, false, handle, "%s",
1161 fsp_str_do_log(fsp));
1162 return tevent_req_post(req, ev);
1164 tevent_req_set_callback(subreq, smb_full_audit_pwrite_done, req);
1166 do_log(SMB_VFS_OP_PWRITE_SEND, true, handle, "%s",
1167 fsp_str_do_log(fsp));
1171 static void smb_full_audit_pwrite_done(struct tevent_req *subreq)
1173 struct tevent_req *req = tevent_req_callback_data(
1174 subreq, struct tevent_req);
1175 struct smb_full_audit_pwrite_state *state = tevent_req_data(
1176 req, struct smb_full_audit_pwrite_state);
1178 state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
1179 TALLOC_FREE(subreq);
1180 tevent_req_done(req);
1183 static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req,
1184 struct vfs_aio_state *vfs_aio_state)
1186 struct smb_full_audit_pwrite_state *state = tevent_req_data(
1187 req, struct smb_full_audit_pwrite_state);
1189 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1190 do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
1191 fsp_str_do_log(state->fsp));
1195 do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
1196 fsp_str_do_log(state->fsp));
1198 *vfs_aio_state = state->vfs_aio_state;
1202 static off_t smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
1203 off_t offset, int whence)
1207 result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
1209 do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
1210 "%s", fsp_str_do_log(fsp));
1215 static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
1216 files_struct *fromfsp,
1217 const DATA_BLOB *hdr, off_t offset,
1222 result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
1224 do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
1225 "%s", fsp_str_do_log(fromfsp));
1230 static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
1231 files_struct *tofsp,
1237 result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
1239 do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
1240 "%s", fsp_str_do_log(tofsp));
1245 static int smb_full_audit_rename(vfs_handle_struct *handle,
1246 const struct smb_filename *smb_fname_src,
1247 const struct smb_filename *smb_fname_dst)
1251 result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
1253 do_log(SMB_VFS_OP_RENAME, (result >= 0), handle, "%s|%s",
1254 smb_fname_str_do_log(smb_fname_src),
1255 smb_fname_str_do_log(smb_fname_dst));
1260 struct smb_full_audit_fsync_state {
1261 vfs_handle_struct *handle;
1264 struct vfs_aio_state vfs_aio_state;
1267 static void smb_full_audit_fsync_done(struct tevent_req *subreq);
1269 static struct tevent_req *smb_full_audit_fsync_send(
1270 struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx,
1271 struct tevent_context *ev, struct files_struct *fsp)
1273 struct tevent_req *req, *subreq;
1274 struct smb_full_audit_fsync_state *state;
1276 req = tevent_req_create(mem_ctx, &state,
1277 struct smb_full_audit_fsync_state);
1279 do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
1280 fsp_str_do_log(fsp));
1283 state->handle = handle;
1286 subreq = SMB_VFS_NEXT_FSYNC_SEND(state, ev, handle, fsp);
1287 if (tevent_req_nomem(subreq, req)) {
1288 do_log(SMB_VFS_OP_FSYNC_SEND, false, handle, "%s",
1289 fsp_str_do_log(fsp));
1290 return tevent_req_post(req, ev);
1292 tevent_req_set_callback(subreq, smb_full_audit_fsync_done, req);
1294 do_log(SMB_VFS_OP_FSYNC_SEND, true, handle, "%s", fsp_str_do_log(fsp));
1298 static void smb_full_audit_fsync_done(struct tevent_req *subreq)
1300 struct tevent_req *req = tevent_req_callback_data(
1301 subreq, struct tevent_req);
1302 struct smb_full_audit_fsync_state *state = tevent_req_data(
1303 req, struct smb_full_audit_fsync_state);
1305 state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
1306 TALLOC_FREE(subreq);
1307 tevent_req_done(req);
1310 static int smb_full_audit_fsync_recv(struct tevent_req *req,
1311 struct vfs_aio_state *vfs_aio_state)
1313 struct smb_full_audit_fsync_state *state = tevent_req_data(
1314 req, struct smb_full_audit_fsync_state);
1316 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
1317 do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
1318 fsp_str_do_log(state->fsp));
1322 do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
1323 fsp_str_do_log(state->fsp));
1325 *vfs_aio_state = state->vfs_aio_state;
1329 static int smb_full_audit_stat(vfs_handle_struct *handle,
1330 struct smb_filename *smb_fname)
1334 result = SMB_VFS_NEXT_STAT(handle, smb_fname);
1336 do_log(SMB_VFS_OP_STAT, (result >= 0), handle, "%s",
1337 smb_fname_str_do_log(smb_fname));
1342 static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
1343 SMB_STRUCT_STAT *sbuf)
1347 result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
1349 do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s",
1350 fsp_str_do_log(fsp));
1355 static int smb_full_audit_lstat(vfs_handle_struct *handle,
1356 struct smb_filename *smb_fname)
1360 result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
1362 do_log(SMB_VFS_OP_LSTAT, (result >= 0), handle, "%s",
1363 smb_fname_str_do_log(smb_fname));
1368 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
1369 files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
1373 result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
1375 do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result != (uint64_t)-1), handle,
1376 "%llu", (unsigned long long)result);
1381 static int smb_full_audit_unlink(vfs_handle_struct *handle,
1382 const struct smb_filename *smb_fname)
1386 result = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
1388 do_log(SMB_VFS_OP_UNLINK, (result >= 0), handle, "%s",
1389 smb_fname_str_do_log(smb_fname));
1394 static int smb_full_audit_chmod(vfs_handle_struct *handle,
1395 const struct smb_filename *smb_fname,
1400 result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
1402 do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o",
1403 smb_fname->base_name,
1409 static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
1414 result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
1416 do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
1417 "%s|%o", fsp_str_do_log(fsp), mode);
1422 static int smb_full_audit_chown(vfs_handle_struct *handle,
1423 const struct smb_filename *smb_fname,
1429 result = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
1431 do_log(SMB_VFS_OP_CHOWN, (result >= 0), handle, "%s|%ld|%ld",
1432 smb_fname->base_name, (long int)uid, (long int)gid);
1437 static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
1438 uid_t uid, gid_t gid)
1442 result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
1444 do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
1445 fsp_str_do_log(fsp), (long int)uid, (long int)gid);
1450 static int smb_full_audit_lchown(vfs_handle_struct *handle,
1451 const struct smb_filename *smb_fname,
1457 result = SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
1459 do_log(SMB_VFS_OP_LCHOWN, (result >= 0), handle, "%s|%ld|%ld",
1460 smb_fname->base_name, (long int)uid, (long int)gid);
1465 static int smb_full_audit_chdir(vfs_handle_struct *handle,
1466 const struct smb_filename *smb_fname)
1470 result = SMB_VFS_NEXT_CHDIR(handle, smb_fname);
1472 do_log(SMB_VFS_OP_CHDIR, (result >= 0), handle, "chdir|%s",
1473 smb_fname->base_name);
1478 static struct smb_filename *smb_full_audit_getwd(vfs_handle_struct *handle,
1481 struct smb_filename *result;
1483 result = SMB_VFS_NEXT_GETWD(handle, ctx);
1485 do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s",
1486 result == NULL? "" : result->base_name);
1491 static int smb_full_audit_ntimes(vfs_handle_struct *handle,
1492 const struct smb_filename *smb_fname,
1493 struct smb_file_time *ft)
1497 result = SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
1499 do_log(SMB_VFS_OP_NTIMES, (result >= 0), handle, "%s",
1500 smb_fname_str_do_log(smb_fname));
1505 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
1510 result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
1512 do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
1513 "%s", fsp_str_do_log(fsp));
1518 static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp,
1525 result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
1527 do_log(SMB_VFS_OP_FALLOCATE, (result >= 0), handle,
1528 "%s", fsp_str_do_log(fsp));
1533 static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
1534 int op, off_t offset, off_t count, int type)
1538 result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
1540 do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp_str_do_log(fsp));
1545 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
1546 struct files_struct *fsp,
1547 uint32_t share_mode, uint32_t access_mask)
1551 result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
1553 do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
1554 fsp_str_do_log(fsp));
1559 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
1564 result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
1566 do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
1567 fsp_str_do_log(fsp));
1572 static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
1573 off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid)
1577 result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
1579 do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp_str_do_log(fsp));
1584 static int smb_full_audit_symlink(vfs_handle_struct *handle,
1585 const char *link_contents,
1586 const struct smb_filename *new_smb_fname)
1590 result = SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname);
1592 do_log(SMB_VFS_OP_SYMLINK, (result >= 0), handle,
1593 "%s|%s", link_contents, new_smb_fname->base_name);
1598 static int smb_full_audit_readlink(vfs_handle_struct *handle,
1599 const struct smb_filename *smb_fname,
1605 result = SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz);
1607 do_log(SMB_VFS_OP_READLINK, (result >= 0), handle, "%s",
1608 smb_fname->base_name);
1613 static int smb_full_audit_link(vfs_handle_struct *handle,
1614 const struct smb_filename *old_smb_fname,
1615 const struct smb_filename *new_smb_fname)
1619 result = SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname);
1621 do_log(SMB_VFS_OP_LINK, (result >= 0), handle,
1622 "%s|%s", old_smb_fname->base_name, new_smb_fname->base_name);
1627 static int smb_full_audit_mknod(vfs_handle_struct *handle,
1628 const struct smb_filename *smb_fname,
1634 result = SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
1636 do_log(SMB_VFS_OP_MKNOD, (result >= 0), handle, "%s",
1637 smb_fname->base_name);
1642 static struct smb_filename *smb_full_audit_realpath(vfs_handle_struct *handle,
1644 const struct smb_filename *smb_fname)
1646 struct smb_filename *result_fname = NULL;
1648 result_fname = SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
1650 do_log(SMB_VFS_OP_REALPATH, (result_fname != NULL), handle, "%s",
1651 smb_fname->base_name);
1653 return result_fname;
1656 static int smb_full_audit_chflags(vfs_handle_struct *handle,
1657 const struct smb_filename *smb_fname,
1662 result = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
1664 do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s",
1665 smb_fname->base_name);
1670 static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
1671 const SMB_STRUCT_STAT *sbuf)
1673 struct file_id id_zero;
1674 struct file_id result;
1676 ZERO_STRUCT(id_zero);
1678 result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
1680 do_log(SMB_VFS_OP_FILE_ID_CREATE,
1681 !file_id_equal(&id_zero, &result),
1682 handle, "%s", file_id_string_tos(&result));
1687 static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
1688 struct files_struct *fsp,
1689 const struct smb_filename *smb_fname,
1690 TALLOC_CTX *mem_ctx,
1691 unsigned int *pnum_streams,
1692 struct stream_struct **pstreams)
1696 result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
1697 pnum_streams, pstreams);
1699 do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle,
1700 "%s", smb_fname->base_name);
1705 static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
1708 TALLOC_CTX *mem_ctx,
1713 result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
1716 do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle,
1717 "%s/%s->%s", path, name, (result == 0) ? "" : *found_name);
1722 static const char *smb_full_audit_connectpath(vfs_handle_struct *handle,
1723 const struct smb_filename *smb_fname)
1727 result = SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
1729 do_log(SMB_VFS_OP_CONNECTPATH, result != NULL, handle,
1730 "%s", smb_fname->base_name);
1735 static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle,
1736 struct byte_range_lock *br_lck,
1737 struct lock_struct *plock,
1742 result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
1745 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle,
1746 "%s:%llu-%llu. type=%d. blocking=%d",
1747 fsp_str_do_log(brl_fsp(br_lck)),
1748 (unsigned long long)plock->start,
1749 (unsigned long long)plock->size,
1756 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
1757 struct messaging_context *msg_ctx,
1758 struct byte_range_lock *br_lck,
1759 const struct lock_struct *plock)
1763 result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
1766 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS, (result == 0), handle,
1767 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
1768 (unsigned long long)plock->start,
1769 (unsigned long long)plock->size,
1775 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
1776 struct byte_range_lock *br_lck,
1777 struct lock_struct *plock)
1781 result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock);
1783 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS, (result == 0), handle,
1784 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck)),
1785 (unsigned long long)plock->start,
1786 (unsigned long long)plock->size,
1792 static bool smb_full_audit_strict_lock_check(struct vfs_handle_struct *handle,
1793 struct files_struct *fsp,
1794 struct lock_struct *plock)
1798 result = SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle, fsp, plock);
1800 do_log(SMB_VFS_OP_STRICT_LOCK_CHECK, result, handle,
1801 "%s:%llu-%llu:%d", fsp_str_do_log(fsp),
1802 (unsigned long long)plock->start,
1803 (unsigned long long)plock->size,
1809 static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle,
1811 enum vfs_translate_direction direction,
1812 TALLOC_CTX *mem_ctx,
1817 result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
1820 do_log(SMB_VFS_OP_TRANSLATE_NAME, NT_STATUS_IS_OK(result), handle, "");
1825 static NTSTATUS smb_full_audit_fsctl(struct vfs_handle_struct *handle,
1826 struct files_struct *fsp,
1830 const uint8_t *_in_data,
1832 uint8_t **_out_data,
1833 uint32_t max_out_len,
1838 result = SMB_VFS_NEXT_FSCTL(handle,
1849 do_log(SMB_VFS_OP_FSCTL, NT_STATUS_IS_OK(result), handle, "");
1854 static struct tevent_req *smb_full_audit_offload_read_send(
1855 TALLOC_CTX *mem_ctx,
1856 struct tevent_context *ev,
1857 struct vfs_handle_struct *handle,
1858 struct files_struct *fsp,
1864 struct tevent_req *req = NULL;
1866 req = SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx, ev, handle, fsp,
1867 fsctl, ttl, offset, to_copy);
1869 do_log(SMB_VFS_OP_OFFLOAD_READ_SEND, req, handle, "");
1874 static NTSTATUS smb_full_audit_offload_read_recv(
1875 struct tevent_req *req,
1876 struct vfs_handle_struct *handle,
1877 TALLOC_CTX *mem_ctx,
1878 DATA_BLOB *_token_blob)
1882 status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(req, handle, mem_ctx,
1885 do_log(SMB_VFS_OP_OFFLOAD_READ_RECV, NT_STATUS_IS_OK(status), handle, "");
1890 static struct tevent_req *smb_full_audit_offload_write_send(struct vfs_handle_struct *handle,
1891 TALLOC_CTX *mem_ctx,
1892 struct tevent_context *ev,
1895 off_t transfer_offset,
1896 struct files_struct *dest_fsp,
1900 struct tevent_req *req;
1902 req = SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle, mem_ctx, ev,
1903 fsctl, token, transfer_offset,
1904 dest_fsp, dest_off, num);
1906 do_log(SMB_VFS_OP_OFFLOAD_WRITE_SEND, req, handle, "");
1911 static NTSTATUS smb_full_audit_offload_write_recv(struct vfs_handle_struct *handle,
1912 struct tevent_req *req,
1917 result = SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(handle, req, copied);
1919 do_log(SMB_VFS_OP_OFFLOAD_WRITE_RECV, NT_STATUS_IS_OK(result), handle, "");
1924 static NTSTATUS smb_full_audit_get_compression(vfs_handle_struct *handle,
1925 TALLOC_CTX *mem_ctx,
1926 struct files_struct *fsp,
1927 struct smb_filename *smb_fname,
1928 uint16_t *_compression_fmt)
1932 result = SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
1935 do_log(SMB_VFS_OP_GET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
1937 (fsp ? fsp_str_do_log(fsp) : smb_fname_str_do_log(smb_fname)));
1942 static NTSTATUS smb_full_audit_set_compression(vfs_handle_struct *handle,
1943 TALLOC_CTX *mem_ctx,
1944 struct files_struct *fsp,
1945 uint16_t compression_fmt)
1949 result = SMB_VFS_NEXT_SET_COMPRESSION(handle, mem_ctx, fsp,
1952 do_log(SMB_VFS_OP_SET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
1953 "%s", fsp_str_do_log(fsp));
1958 static NTSTATUS smb_full_audit_readdir_attr(struct vfs_handle_struct *handle,
1959 const struct smb_filename *fname,
1960 TALLOC_CTX *mem_ctx,
1961 struct readdir_attr_data **pattr_data)
1965 status = SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
1967 do_log(SMB_VFS_OP_READDIR_ATTR, NT_STATUS_IS_OK(status), handle, "%s",
1968 smb_fname_str_do_log(fname));
1973 static NTSTATUS smb_full_audit_get_dos_attributes(
1974 struct vfs_handle_struct *handle,
1975 struct smb_filename *smb_fname,
1980 status = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
1984 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES,
1985 NT_STATUS_IS_OK(status),
1988 smb_fname_str_do_log(smb_fname));
1993 static NTSTATUS smb_full_audit_fget_dos_attributes(
1994 struct vfs_handle_struct *handle,
1995 struct files_struct *fsp,
2000 status = SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle,
2004 do_log(SMB_VFS_OP_FGET_DOS_ATTRIBUTES,
2005 NT_STATUS_IS_OK(status),
2008 fsp_str_do_log(fsp));
2013 static NTSTATUS smb_full_audit_set_dos_attributes(
2014 struct vfs_handle_struct *handle,
2015 const struct smb_filename *smb_fname,
2020 status = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
2024 do_log(SMB_VFS_OP_SET_DOS_ATTRIBUTES,
2025 NT_STATUS_IS_OK(status),
2028 smb_fname_str_do_log(smb_fname));
2033 static NTSTATUS smb_full_audit_fset_dos_attributes(
2034 struct vfs_handle_struct *handle,
2035 struct files_struct *fsp,
2040 status = SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle,
2044 do_log(SMB_VFS_OP_FSET_DOS_ATTRIBUTES,
2045 NT_STATUS_IS_OK(status),
2048 fsp_str_do_log(fsp));
2053 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
2054 uint32_t security_info,
2055 TALLOC_CTX *mem_ctx,
2056 struct security_descriptor **ppdesc)
2060 result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info,
2063 do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
2064 "%s", fsp_str_do_log(fsp));
2069 static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
2070 const struct smb_filename *smb_fname,
2071 uint32_t security_info,
2072 TALLOC_CTX *mem_ctx,
2073 struct security_descriptor **ppdesc)
2077 result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info,
2080 do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
2081 "%s", smb_fname_str_do_log(smb_fname));
2086 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
2087 uint32_t security_info_sent,
2088 const struct security_descriptor *psd)
2090 struct vfs_full_audit_private_data *pd;
2094 SMB_VFS_HANDLE_GET_DATA(handle, pd,
2095 struct vfs_full_audit_private_data,
2096 return NT_STATUS_INTERNAL_ERROR);
2098 if (pd->log_secdesc) {
2099 sd = sddl_encode(talloc_tos(), psd, get_global_sam_sid());
2102 result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
2104 do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle,
2105 "%s [%s]", fsp_str_do_log(fsp), sd ? sd : "");
2112 static NTSTATUS smb_full_audit_audit_file(struct vfs_handle_struct *handle,
2113 struct smb_filename *file,
2114 struct security_acl *sacl,
2115 uint32_t access_requested,
2116 uint32_t access_denied)
2120 result = SMB_VFS_NEXT_AUDIT_FILE(handle,
2126 do_log(SMB_VFS_OP_AUDIT_FILE, NT_STATUS_IS_OK(result), handle,
2127 "%s", smb_fname_str_do_log(file));
2132 static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
2133 const struct smb_filename *smb_fname,
2134 SMB_ACL_TYPE_T type,
2135 TALLOC_CTX *mem_ctx)
2139 result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
2142 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
2143 "%s", smb_fname->base_name);
2148 static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
2149 files_struct *fsp, TALLOC_CTX *mem_ctx)
2153 result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
2155 do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
2156 "%s", fsp_str_do_log(fsp));
2161 static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct *handle,
2162 const struct smb_filename *smb_fname,
2163 TALLOC_CTX *mem_ctx,
2164 char **blob_description,
2169 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname,
2170 mem_ctx, blob_description, blob);
2172 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE, (result >= 0), handle,
2173 "%s", smb_fname->base_name);
2178 static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
2180 TALLOC_CTX *mem_ctx,
2181 char **blob_description,
2186 result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob);
2188 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD, (result >= 0), handle,
2189 "%s", fsp_str_do_log(fsp));
2194 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
2195 const struct smb_filename *smb_fname,
2196 SMB_ACL_TYPE_T acltype,
2201 result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
2204 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE, (result >= 0), handle,
2205 "%s", smb_fname->base_name);
2210 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
2215 result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
2217 do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
2218 "%s", fsp_str_do_log(fsp));
2223 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
2224 const struct smb_filename *smb_fname)
2228 result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
2230 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, (result >= 0), handle,
2231 "%s", smb_fname->base_name);
2236 static ssize_t smb_full_audit_getxattr(struct vfs_handle_struct *handle,
2237 const struct smb_filename *smb_fname,
2238 const char *name, void *value, size_t size)
2242 result = SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
2244 do_log(SMB_VFS_OP_GETXATTR, (result >= 0), handle,
2245 "%s|%s", smb_fname->base_name, name);
2250 static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
2251 struct files_struct *fsp,
2252 const char *name, void *value, size_t size)
2256 result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
2258 do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
2259 "%s|%s", fsp_str_do_log(fsp), name);
2264 static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
2265 const struct smb_filename *smb_fname,
2271 result = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
2273 do_log(SMB_VFS_OP_LISTXATTR, (result >= 0), handle, "%s",
2274 smb_fname->base_name);
2279 static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
2280 struct files_struct *fsp, char *list,
2285 result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
2287 do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
2288 "%s", fsp_str_do_log(fsp));
2293 static int smb_full_audit_removexattr(struct vfs_handle_struct *handle,
2294 const struct smb_filename *smb_fname,
2299 result = SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
2301 do_log(SMB_VFS_OP_REMOVEXATTR, (result >= 0), handle,
2302 "%s|%s", smb_fname->base_name, name);
2307 static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
2308 struct files_struct *fsp,
2313 result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
2315 do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
2316 "%s|%s", fsp_str_do_log(fsp), name);
2321 static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
2322 const struct smb_filename *smb_fname,
2323 const char *name, const void *value, size_t size,
2328 result = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value, size,
2331 do_log(SMB_VFS_OP_SETXATTR, (result >= 0), handle,
2332 "%s|%s", smb_fname->base_name, name);
2337 static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
2338 struct files_struct *fsp, const char *name,
2339 const void *value, size_t size, int flags)
2343 result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
2345 do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
2346 "%s|%s", fsp_str_do_log(fsp), name);
2351 static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
2352 struct files_struct *fsp)
2356 result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
2357 do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
2358 "%s", fsp_str_do_log(fsp));
2363 static NTSTATUS smb_full_audit_durable_cookie(struct vfs_handle_struct *handle,
2364 struct files_struct *fsp,
2365 TALLOC_CTX *mem_ctx,
2370 result = SMB_VFS_NEXT_DURABLE_COOKIE(handle,
2375 do_log(SMB_VFS_OP_DURABLE_COOKIE, NT_STATUS_IS_OK(result), handle,
2376 "%s", fsp_str_do_log(fsp));
2381 static NTSTATUS smb_full_audit_durable_disconnect(
2382 struct vfs_handle_struct *handle,
2383 struct files_struct *fsp,
2384 const DATA_BLOB old_cookie,
2385 TALLOC_CTX *mem_ctx,
2386 DATA_BLOB *new_cookie)
2390 result = SMB_VFS_NEXT_DURABLE_DISCONNECT(handle,
2396 do_log(SMB_VFS_OP_DURABLE_DISCONNECT, NT_STATUS_IS_OK(result), handle,
2397 "%s", fsp_str_do_log(fsp));
2402 static NTSTATUS smb_full_audit_durable_reconnect(
2403 struct vfs_handle_struct *handle,
2404 struct smb_request *smb1req,
2405 struct smbXsrv_open *op,
2406 const DATA_BLOB old_cookie,
2407 TALLOC_CTX *mem_ctx,
2408 struct files_struct **fsp,
2409 DATA_BLOB *new_cookie)
2413 result = SMB_VFS_NEXT_DURABLE_RECONNECT(handle,
2421 do_log(SMB_VFS_OP_DURABLE_RECONNECT,
2422 NT_STATUS_IS_OK(result),
2429 static struct vfs_fn_pointers vfs_full_audit_fns = {
2431 /* Disk operations */
2433 .connect_fn = smb_full_audit_connect,
2434 .disconnect_fn = smb_full_audit_disconnect,
2435 .disk_free_fn = smb_full_audit_disk_free,
2436 .get_quota_fn = smb_full_audit_get_quota,
2437 .set_quota_fn = smb_full_audit_set_quota,
2438 .get_shadow_copy_data_fn = smb_full_audit_get_shadow_copy_data,
2439 .statvfs_fn = smb_full_audit_statvfs,
2440 .fs_capabilities_fn = smb_full_audit_fs_capabilities,
2441 .get_dfs_referrals_fn = smb_full_audit_get_dfs_referrals,
2442 .opendir_fn = smb_full_audit_opendir,
2443 .fdopendir_fn = smb_full_audit_fdopendir,
2444 .readdir_fn = smb_full_audit_readdir,
2445 .seekdir_fn = smb_full_audit_seekdir,
2446 .telldir_fn = smb_full_audit_telldir,
2447 .rewind_dir_fn = smb_full_audit_rewinddir,
2448 .mkdir_fn = smb_full_audit_mkdir,
2449 .rmdir_fn = smb_full_audit_rmdir,
2450 .closedir_fn = smb_full_audit_closedir,
2451 .open_fn = smb_full_audit_open,
2452 .create_file_fn = smb_full_audit_create_file,
2453 .close_fn = smb_full_audit_close,
2454 .pread_fn = smb_full_audit_pread,
2455 .pread_send_fn = smb_full_audit_pread_send,
2456 .pread_recv_fn = smb_full_audit_pread_recv,
2457 .pwrite_fn = smb_full_audit_pwrite,
2458 .pwrite_send_fn = smb_full_audit_pwrite_send,
2459 .pwrite_recv_fn = smb_full_audit_pwrite_recv,
2460 .lseek_fn = smb_full_audit_lseek,
2461 .sendfile_fn = smb_full_audit_sendfile,
2462 .recvfile_fn = smb_full_audit_recvfile,
2463 .rename_fn = smb_full_audit_rename,
2464 .fsync_send_fn = smb_full_audit_fsync_send,
2465 .fsync_recv_fn = smb_full_audit_fsync_recv,
2466 .stat_fn = smb_full_audit_stat,
2467 .fstat_fn = smb_full_audit_fstat,
2468 .lstat_fn = smb_full_audit_lstat,
2469 .get_alloc_size_fn = smb_full_audit_get_alloc_size,
2470 .unlink_fn = smb_full_audit_unlink,
2471 .chmod_fn = smb_full_audit_chmod,
2472 .fchmod_fn = smb_full_audit_fchmod,
2473 .chown_fn = smb_full_audit_chown,
2474 .fchown_fn = smb_full_audit_fchown,
2475 .lchown_fn = smb_full_audit_lchown,
2476 .chdir_fn = smb_full_audit_chdir,
2477 .getwd_fn = smb_full_audit_getwd,
2478 .ntimes_fn = smb_full_audit_ntimes,
2479 .ftruncate_fn = smb_full_audit_ftruncate,
2480 .fallocate_fn = smb_full_audit_fallocate,
2481 .lock_fn = smb_full_audit_lock,
2482 .kernel_flock_fn = smb_full_audit_kernel_flock,
2483 .linux_setlease_fn = smb_full_audit_linux_setlease,
2484 .getlock_fn = smb_full_audit_getlock,
2485 .symlink_fn = smb_full_audit_symlink,
2486 .readlink_fn = smb_full_audit_readlink,
2487 .link_fn = smb_full_audit_link,
2488 .mknod_fn = smb_full_audit_mknod,
2489 .realpath_fn = smb_full_audit_realpath,
2490 .chflags_fn = smb_full_audit_chflags,
2491 .file_id_create_fn = smb_full_audit_file_id_create,
2492 .offload_read_send_fn = smb_full_audit_offload_read_send,
2493 .offload_read_recv_fn = smb_full_audit_offload_read_recv,
2494 .offload_write_send_fn = smb_full_audit_offload_write_send,
2495 .offload_write_recv_fn = smb_full_audit_offload_write_recv,
2496 .get_compression_fn = smb_full_audit_get_compression,
2497 .set_compression_fn = smb_full_audit_set_compression,
2498 .snap_check_path_fn = smb_full_audit_snap_check_path,
2499 .snap_create_fn = smb_full_audit_snap_create,
2500 .snap_delete_fn = smb_full_audit_snap_delete,
2501 .streaminfo_fn = smb_full_audit_streaminfo,
2502 .get_real_filename_fn = smb_full_audit_get_real_filename,
2503 .connectpath_fn = smb_full_audit_connectpath,
2504 .brl_lock_windows_fn = smb_full_audit_brl_lock_windows,
2505 .brl_unlock_windows_fn = smb_full_audit_brl_unlock_windows,
2506 .brl_cancel_windows_fn = smb_full_audit_brl_cancel_windows,
2507 .strict_lock_check_fn = smb_full_audit_strict_lock_check,
2508 .translate_name_fn = smb_full_audit_translate_name,
2509 .fsctl_fn = smb_full_audit_fsctl,
2510 .get_dos_attributes_fn = smb_full_audit_get_dos_attributes,
2511 .fget_dos_attributes_fn = smb_full_audit_fget_dos_attributes,
2512 .set_dos_attributes_fn = smb_full_audit_set_dos_attributes,
2513 .fset_dos_attributes_fn = smb_full_audit_fset_dos_attributes,
2514 .fget_nt_acl_fn = smb_full_audit_fget_nt_acl,
2515 .get_nt_acl_fn = smb_full_audit_get_nt_acl,
2516 .fset_nt_acl_fn = smb_full_audit_fset_nt_acl,
2517 .audit_file_fn = smb_full_audit_audit_file,
2518 .sys_acl_get_file_fn = smb_full_audit_sys_acl_get_file,
2519 .sys_acl_get_fd_fn = smb_full_audit_sys_acl_get_fd,
2520 .sys_acl_blob_get_file_fn = smb_full_audit_sys_acl_blob_get_file,
2521 .sys_acl_blob_get_fd_fn = smb_full_audit_sys_acl_blob_get_fd,
2522 .sys_acl_set_file_fn = smb_full_audit_sys_acl_set_file,
2523 .sys_acl_set_fd_fn = smb_full_audit_sys_acl_set_fd,
2524 .sys_acl_delete_def_file_fn = smb_full_audit_sys_acl_delete_def_file,
2525 .getxattr_fn = smb_full_audit_getxattr,
2526 .fgetxattr_fn = smb_full_audit_fgetxattr,
2527 .listxattr_fn = smb_full_audit_listxattr,
2528 .flistxattr_fn = smb_full_audit_flistxattr,
2529 .removexattr_fn = smb_full_audit_removexattr,
2530 .fremovexattr_fn = smb_full_audit_fremovexattr,
2531 .setxattr_fn = smb_full_audit_setxattr,
2532 .fsetxattr_fn = smb_full_audit_fsetxattr,
2533 .aio_force_fn = smb_full_audit_aio_force,
2534 .durable_cookie_fn = smb_full_audit_durable_cookie,
2535 .durable_disconnect_fn = smb_full_audit_durable_disconnect,
2536 .durable_reconnect_fn = smb_full_audit_durable_reconnect,
2537 .readdir_attr_fn = smb_full_audit_readdir_attr
2542 NTSTATUS vfs_full_audit_init(TALLOC_CTX *ctx)
2546 smb_vfs_assert_all_fns(&vfs_full_audit_fns, "full_audit");
2548 ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "full_audit",
2549 &vfs_full_audit_fns);
2551 if (!NT_STATUS_IS_OK(ret))
2554 vfs_full_audit_debug_level = debug_add_class("full_audit");
2555 if (vfs_full_audit_debug_level == -1) {
2556 vfs_full_audit_debug_level = DBGC_VFS;
2557 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2560 DEBUG(10, ("vfs_full_audit: Debug class number of "
2561 "'full_audit': %d\n", vfs_full_audit_debug_level));