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 create_file
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|/tmp
42 * smbd_audit: nobody|192.168.234.1|create_file|fail (No such file or directory)|0x1|file|open|/ts/doesNotExist
43 * smbd_audit: nobody|192.168.234.1|open|ok|w|/tmp/file.txt
44 * smbd_audit: nobody|192.168.234.1|create_file|ok|0x3|file|open|/tmp/file.txt
46 * where "nobody" is the connected username and "192.168.234.1" is the
47 * client's IP address.
51 * prefix: A macro expansion template prepended to the syslog entry.
53 * success: A list of VFS operations for which a successful completion should
54 * be logged. Defaults to no logging at all. The special operation "all" logs
55 * - you guessed it - everything.
57 * failure: A list of VFS operations for which failure to complete should be
58 * logged. Defaults to logging everything.
63 #include "system/filesys.h"
64 #include "system/syslog.h"
65 #include "smbd/smbd.h"
66 #include "../librpc/gen_ndr/ndr_netlogon.h"
69 #include "lib/param/loadparm.h"
70 #include "lib/util/bitmap.h"
71 #include "lib/util/tevent_unix.h"
72 #include "libcli/security/sddl.h"
73 #include "passdb/machine_sid.h"
74 #include "lib/util/tevent_ntstatus.h"
76 static int vfs_full_audit_debug_level
= DBGC_VFS
;
78 struct vfs_full_audit_private_data
{
79 struct bitmap
*success_ops
;
80 struct bitmap
*failure_ops
;
88 #define DBGC_CLASS vfs_full_audit_debug_level
90 typedef enum _vfs_op_type
{
95 SMB_VFS_OP_CONNECT
= 0,
96 SMB_VFS_OP_DISCONNECT
,
100 SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
102 SMB_VFS_OP_FS_CAPABILITIES
,
103 SMB_VFS_OP_GET_DFS_REFERRALS
,
104 SMB_VFS_OP_CREATE_DFS_PATHAT
,
105 SMB_VFS_OP_READ_DFS_PATHAT
,
107 /* Directory operations */
110 SMB_VFS_OP_FDOPENDIR
,
114 SMB_VFS_OP_REWINDDIR
,
118 /* File operations */
121 SMB_VFS_OP_CREATE_FILE
,
125 SMB_VFS_OP_PREAD_SEND
,
126 SMB_VFS_OP_PREAD_RECV
,
129 SMB_VFS_OP_PWRITE_SEND
,
130 SMB_VFS_OP_PWRITE_RECV
,
136 SMB_VFS_OP_FSYNC_SEND
,
137 SMB_VFS_OP_FSYNC_RECV
,
141 SMB_VFS_OP_GET_ALLOC_SIZE
,
150 SMB_VFS_OP_FTRUNCATE
,
151 SMB_VFS_OP_FALLOCATE
,
153 SMB_VFS_OP_KERNEL_FLOCK
,
155 SMB_VFS_OP_LINUX_SETLEASE
,
157 SMB_VFS_OP_SYMLINKAT
,
158 SMB_VFS_OP_READLINKAT
,
163 SMB_VFS_OP_FILE_ID_CREATE
,
164 SMB_VFS_OP_FS_FILE_ID
,
165 SMB_VFS_OP_STREAMINFO
,
166 SMB_VFS_OP_GET_REAL_FILENAME
,
167 SMB_VFS_OP_CONNECTPATH
,
168 SMB_VFS_OP_BRL_LOCK_WINDOWS
,
169 SMB_VFS_OP_BRL_UNLOCK_WINDOWS
,
170 SMB_VFS_OP_STRICT_LOCK_CHECK
,
171 SMB_VFS_OP_TRANSLATE_NAME
,
173 SMB_VFS_OP_OFFLOAD_READ_SEND
,
174 SMB_VFS_OP_OFFLOAD_READ_RECV
,
175 SMB_VFS_OP_OFFLOAD_WRITE_SEND
,
176 SMB_VFS_OP_OFFLOAD_WRITE_RECV
,
177 SMB_VFS_OP_GET_COMPRESSION
,
178 SMB_VFS_OP_SET_COMPRESSION
,
179 SMB_VFS_OP_SNAP_CHECK_PATH
,
180 SMB_VFS_OP_SNAP_CREATE
,
181 SMB_VFS_OP_SNAP_DELETE
,
183 /* DOS attribute operations. */
184 SMB_VFS_OP_GET_DOS_ATTRIBUTES
,
185 SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND
,
186 SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV
,
187 SMB_VFS_OP_FGET_DOS_ATTRIBUTES
,
188 SMB_VFS_OP_SET_DOS_ATTRIBUTES
,
189 SMB_VFS_OP_FSET_DOS_ATTRIBUTES
,
191 /* NT ACL operations. */
193 SMB_VFS_OP_FGET_NT_ACL
,
194 SMB_VFS_OP_GET_NT_ACL
,
195 SMB_VFS_OP_FSET_NT_ACL
,
196 SMB_VFS_OP_AUDIT_FILE
,
198 /* POSIX ACL operations. */
200 SMB_VFS_OP_SYS_ACL_GET_FILE
,
201 SMB_VFS_OP_SYS_ACL_GET_FD
,
202 SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE
,
203 SMB_VFS_OP_SYS_ACL_BLOB_GET_FD
,
204 SMB_VFS_OP_SYS_ACL_SET_FILE
,
205 SMB_VFS_OP_SYS_ACL_SET_FD
,
206 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
210 SMB_VFS_OP_GETXATTRAT_SEND
,
211 SMB_VFS_OP_GETXATTRAT_RECV
,
212 SMB_VFS_OP_FGETXATTR
,
213 SMB_VFS_OP_LISTXATTR
,
214 SMB_VFS_OP_FLISTXATTR
,
215 SMB_VFS_OP_REMOVEXATTR
,
216 SMB_VFS_OP_FREMOVEXATTR
,
218 SMB_VFS_OP_FSETXATTR
,
221 SMB_VFS_OP_AIO_FORCE
,
223 /* offline operations */
224 SMB_VFS_OP_IS_OFFLINE
,
225 SMB_VFS_OP_SET_OFFLINE
,
227 /* Durable handle operations. */
228 SMB_VFS_OP_DURABLE_COOKIE
,
229 SMB_VFS_OP_DURABLE_DISCONNECT
,
230 SMB_VFS_OP_DURABLE_RECONNECT
,
232 SMB_VFS_OP_READDIR_ATTR
,
234 /* This should always be last enum value */
239 /* The following array *must* be in the same order as defined in vfs_op_type */
245 { SMB_VFS_OP_CONNECT
, "connect" },
246 { SMB_VFS_OP_DISCONNECT
, "disconnect" },
247 { SMB_VFS_OP_DISK_FREE
, "disk_free" },
248 { SMB_VFS_OP_GET_QUOTA
, "get_quota" },
249 { SMB_VFS_OP_SET_QUOTA
, "set_quota" },
250 { SMB_VFS_OP_GET_SHADOW_COPY_DATA
, "get_shadow_copy_data" },
251 { SMB_VFS_OP_STATVFS
, "statvfs" },
252 { SMB_VFS_OP_FS_CAPABILITIES
, "fs_capabilities" },
253 { SMB_VFS_OP_GET_DFS_REFERRALS
, "get_dfs_referrals" },
254 { SMB_VFS_OP_CREATE_DFS_PATHAT
, "create_dfs_pathat" },
255 { SMB_VFS_OP_READ_DFS_PATHAT
, "read_dfs_pathat" },
256 { SMB_VFS_OP_OPENDIR
, "opendir" },
257 { SMB_VFS_OP_FDOPENDIR
, "fdopendir" },
258 { SMB_VFS_OP_READDIR
, "readdir" },
259 { SMB_VFS_OP_SEEKDIR
, "seekdir" },
260 { SMB_VFS_OP_TELLDIR
, "telldir" },
261 { SMB_VFS_OP_REWINDDIR
, "rewinddir" },
262 { SMB_VFS_OP_MKDIRAT
, "mkdirat" },
263 { SMB_VFS_OP_CLOSEDIR
, "closedir" },
264 { SMB_VFS_OP_OPEN
, "open" },
265 { SMB_VFS_OP_CREATE_FILE
, "create_file" },
266 { SMB_VFS_OP_CLOSE
, "close" },
267 { SMB_VFS_OP_READ
, "read" },
268 { SMB_VFS_OP_PREAD
, "pread" },
269 { SMB_VFS_OP_PREAD_SEND
, "pread_send" },
270 { SMB_VFS_OP_PREAD_RECV
, "pread_recv" },
271 { SMB_VFS_OP_WRITE
, "write" },
272 { SMB_VFS_OP_PWRITE
, "pwrite" },
273 { SMB_VFS_OP_PWRITE_SEND
, "pwrite_send" },
274 { SMB_VFS_OP_PWRITE_RECV
, "pwrite_recv" },
275 { SMB_VFS_OP_LSEEK
, "lseek" },
276 { SMB_VFS_OP_SENDFILE
, "sendfile" },
277 { SMB_VFS_OP_RECVFILE
, "recvfile" },
278 { SMB_VFS_OP_RENAMEAT
, "renameat" },
279 { SMB_VFS_OP_FSYNC
, "fsync" },
280 { SMB_VFS_OP_FSYNC_SEND
, "fsync_send" },
281 { SMB_VFS_OP_FSYNC_RECV
, "fsync_recv" },
282 { SMB_VFS_OP_STAT
, "stat" },
283 { SMB_VFS_OP_FSTAT
, "fstat" },
284 { SMB_VFS_OP_LSTAT
, "lstat" },
285 { SMB_VFS_OP_GET_ALLOC_SIZE
, "get_alloc_size" },
286 { SMB_VFS_OP_UNLINKAT
, "unlinkat" },
287 { SMB_VFS_OP_CHMOD
, "chmod" },
288 { SMB_VFS_OP_FCHMOD
, "fchmod" },
289 { SMB_VFS_OP_FCHOWN
, "fchown" },
290 { SMB_VFS_OP_LCHOWN
, "lchown" },
291 { SMB_VFS_OP_CHDIR
, "chdir" },
292 { SMB_VFS_OP_GETWD
, "getwd" },
293 { SMB_VFS_OP_NTIMES
, "ntimes" },
294 { SMB_VFS_OP_FTRUNCATE
, "ftruncate" },
295 { SMB_VFS_OP_FALLOCATE
,"fallocate" },
296 { SMB_VFS_OP_LOCK
, "lock" },
297 { SMB_VFS_OP_KERNEL_FLOCK
, "kernel_flock" },
298 { SMB_VFS_OP_LINUX_SETLEASE
, "linux_setlease" },
299 { SMB_VFS_OP_GETLOCK
, "getlock" },
300 { SMB_VFS_OP_SYMLINKAT
, "symlinkat" },
301 { SMB_VFS_OP_READLINKAT
,"readlinkat" },
302 { SMB_VFS_OP_LINKAT
, "linkat" },
303 { SMB_VFS_OP_MKNODAT
, "mknodat" },
304 { SMB_VFS_OP_REALPATH
, "realpath" },
305 { SMB_VFS_OP_CHFLAGS
, "chflags" },
306 { SMB_VFS_OP_FILE_ID_CREATE
, "file_id_create" },
307 { SMB_VFS_OP_FS_FILE_ID
, "fs_file_id" },
308 { SMB_VFS_OP_STREAMINFO
, "streaminfo" },
309 { SMB_VFS_OP_GET_REAL_FILENAME
, "get_real_filename" },
310 { SMB_VFS_OP_CONNECTPATH
, "connectpath" },
311 { SMB_VFS_OP_BRL_LOCK_WINDOWS
, "brl_lock_windows" },
312 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, "brl_unlock_windows" },
313 { SMB_VFS_OP_STRICT_LOCK_CHECK
, "strict_lock_check" },
314 { SMB_VFS_OP_TRANSLATE_NAME
, "translate_name" },
315 { SMB_VFS_OP_FSCTL
, "fsctl" },
316 { SMB_VFS_OP_OFFLOAD_READ_SEND
, "offload_read_send" },
317 { SMB_VFS_OP_OFFLOAD_READ_RECV
, "offload_read_recv" },
318 { SMB_VFS_OP_OFFLOAD_WRITE_SEND
, "offload_write_send" },
319 { SMB_VFS_OP_OFFLOAD_WRITE_RECV
, "offload_write_recv" },
320 { SMB_VFS_OP_GET_COMPRESSION
, "get_compression" },
321 { SMB_VFS_OP_SET_COMPRESSION
, "set_compression" },
322 { SMB_VFS_OP_SNAP_CHECK_PATH
, "snap_check_path" },
323 { SMB_VFS_OP_SNAP_CREATE
, "snap_create" },
324 { SMB_VFS_OP_SNAP_DELETE
, "snap_delete" },
325 { SMB_VFS_OP_GET_DOS_ATTRIBUTES
, "get_dos_attributes" },
326 { SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND
, "get_dos_attributes_send" },
327 { SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV
, "get_dos_attributes_recv" },
328 { SMB_VFS_OP_FGET_DOS_ATTRIBUTES
, "fget_dos_attributes" },
329 { SMB_VFS_OP_SET_DOS_ATTRIBUTES
, "set_dos_attributes" },
330 { SMB_VFS_OP_FSET_DOS_ATTRIBUTES
, "fset_dos_attributes" },
331 { SMB_VFS_OP_FGET_NT_ACL
, "fget_nt_acl" },
332 { SMB_VFS_OP_GET_NT_ACL
, "get_nt_acl" },
333 { SMB_VFS_OP_FSET_NT_ACL
, "fset_nt_acl" },
334 { SMB_VFS_OP_AUDIT_FILE
, "audit_file" },
335 { SMB_VFS_OP_SYS_ACL_GET_FILE
, "sys_acl_get_file" },
336 { SMB_VFS_OP_SYS_ACL_GET_FD
, "sys_acl_get_fd" },
337 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE
, "sys_acl_blob_get_file" },
338 { SMB_VFS_OP_SYS_ACL_BLOB_GET_FD
, "sys_acl_blob_get_fd" },
339 { SMB_VFS_OP_SYS_ACL_SET_FILE
, "sys_acl_set_file" },
340 { SMB_VFS_OP_SYS_ACL_SET_FD
, "sys_acl_set_fd" },
341 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, "sys_acl_delete_def_file" },
342 { SMB_VFS_OP_GETXATTR
, "getxattr" },
343 { SMB_VFS_OP_GETXATTRAT_SEND
, "getxattrat_send" },
344 { SMB_VFS_OP_GETXATTRAT_RECV
, "getxattrat_recv" },
345 { SMB_VFS_OP_FGETXATTR
, "fgetxattr" },
346 { SMB_VFS_OP_LISTXATTR
, "listxattr" },
347 { SMB_VFS_OP_FLISTXATTR
, "flistxattr" },
348 { SMB_VFS_OP_REMOVEXATTR
, "removexattr" },
349 { SMB_VFS_OP_FREMOVEXATTR
, "fremovexattr" },
350 { SMB_VFS_OP_SETXATTR
, "setxattr" },
351 { SMB_VFS_OP_FSETXATTR
, "fsetxattr" },
352 { SMB_VFS_OP_AIO_FORCE
, "aio_force" },
353 { SMB_VFS_OP_IS_OFFLINE
, "is_offline" },
354 { SMB_VFS_OP_SET_OFFLINE
, "set_offline" },
355 { SMB_VFS_OP_DURABLE_COOKIE
, "durable_cookie" },
356 { SMB_VFS_OP_DURABLE_DISCONNECT
, "durable_disconnect" },
357 { SMB_VFS_OP_DURABLE_RECONNECT
, "durable_reconnect" },
358 { SMB_VFS_OP_READDIR_ATTR
, "readdir_attr" },
359 { SMB_VFS_OP_LAST
, NULL
}
362 static int audit_syslog_facility(vfs_handle_struct
*handle
)
364 static const struct enum_list enum_log_facilities
[] = {
366 { LOG_AUTH
, "AUTH" },
369 { LOG_AUTHPRIV
, "AUTHPRIV" },
372 { LOG_AUDIT
, "AUDIT" },
375 { LOG_CONSOLE
, "CONSOLE" },
378 { LOG_CRON
, "CRON" },
381 { LOG_DAEMON
, "DAEMON" },
387 { LOG_INSTALL
, "INSTALL" },
390 { LOG_KERN
, "KERN" },
393 { LOG_LAUNCHD
, "LAUNCHD" },
396 { LOG_LFMT
, "LFMT" },
402 { LOG_MAIL
, "MAIL" },
405 { LOG_MEGASAFE
, "MEGASAFE" },
408 { LOG_NETINFO
, "NETINFO" },
411 { LOG_NEWS
, "NEWS" },
413 #ifdef LOG_NFACILITIES
414 { LOG_NFACILITIES
, "NFACILITIES" },
422 #ifdef LOG_REMOTEAUTH
423 { LOG_REMOTEAUTH
, "REMOTEAUTH" },
426 { LOG_SECURITY
, "SECURITY" },
429 { LOG_SYSLOG
, "SYSLOG" },
432 { LOG_USER
, "USER" },
435 { LOG_UUCP
, "UUCP" },
437 { LOG_LOCAL0
, "LOCAL0" },
438 { LOG_LOCAL1
, "LOCAL1" },
439 { LOG_LOCAL2
, "LOCAL2" },
440 { LOG_LOCAL3
, "LOCAL3" },
441 { LOG_LOCAL4
, "LOCAL4" },
442 { LOG_LOCAL5
, "LOCAL5" },
443 { LOG_LOCAL6
, "LOCAL6" },
444 { LOG_LOCAL7
, "LOCAL7" },
450 facility
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "facility", enum_log_facilities
, LOG_USER
);
455 static int audit_syslog_priority(vfs_handle_struct
*handle
)
457 static const struct enum_list enum_log_priorities
[] = {
458 { LOG_EMERG
, "EMERG" },
459 { LOG_ALERT
, "ALERT" },
460 { LOG_CRIT
, "CRIT" },
462 { LOG_WARNING
, "WARNING" },
463 { LOG_NOTICE
, "NOTICE" },
464 { LOG_INFO
, "INFO" },
465 { LOG_DEBUG
, "DEBUG" },
471 priority
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "priority",
472 enum_log_priorities
, LOG_NOTICE
);
473 if (priority
== -1) {
474 priority
= LOG_WARNING
;
480 static char *audit_prefix(TALLOC_CTX
*ctx
, connection_struct
*conn
)
482 const struct loadparm_substitution
*lp_sub
=
483 loadparm_s3_global_substitution();
487 prefix
= talloc_strdup(ctx
,
488 lp_parm_const_string(SNUM(conn
), "full_audit",
493 result
= talloc_sub_full(ctx
,
494 lp_servicename(talloc_tos(), lp_sub
, SNUM(conn
)),
495 conn
->session_info
->unix_info
->unix_name
,
497 conn
->session_info
->unix_token
->gid
,
498 conn
->session_info
->unix_info
->sanitized_username
,
499 conn
->session_info
->info
->domain_name
,
505 static bool log_success(struct vfs_full_audit_private_data
*pd
, vfs_op_type op
)
507 if (pd
->success_ops
== NULL
) {
511 return bitmap_query(pd
->success_ops
, op
);
514 static bool log_failure(struct vfs_full_audit_private_data
*pd
, vfs_op_type op
)
516 if (pd
->failure_ops
== NULL
)
519 return bitmap_query(pd
->failure_ops
, op
);
522 static struct bitmap
*init_bitmap(TALLOC_CTX
*mem_ctx
, const char **ops
)
530 bm
= bitmap_talloc(mem_ctx
, SMB_VFS_OP_LAST
);
532 DEBUG(0, ("Could not alloc bitmap -- "
533 "defaulting to logging everything\n"));
537 for (; *ops
!= NULL
; ops
+= 1) {
542 if (strequal(*ops
, "all")) {
543 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
549 if (strequal(*ops
, "none")) {
559 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
560 if ((vfs_op_names
[i
].name
== NULL
)
561 || (vfs_op_names
[i
].type
!= i
)) {
562 smb_panic("vfs_full_audit.c: name table not "
563 "in sync with vfs_op_type enums\n");
565 if (strequal(op
, vfs_op_names
[i
].name
)) {
574 if (i
== SMB_VFS_OP_LAST
) {
575 DEBUG(0, ("Could not find opname %s, logging all\n",
584 static const char *audit_opname(vfs_op_type op
)
586 if (op
>= SMB_VFS_OP_LAST
)
587 return "INVALID VFS OP";
588 return vfs_op_names
[op
].name
;
591 static TALLOC_CTX
*tmp_do_log_ctx
;
593 * Get us a temporary talloc context usable just for DEBUG arguments
595 static TALLOC_CTX
*do_log_ctx(void)
597 if (tmp_do_log_ctx
== NULL
) {
598 tmp_do_log_ctx
= talloc_named_const(NULL
, 0, "do_log_ctx");
600 return tmp_do_log_ctx
;
603 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
604 const char *format
, ...) PRINTF_ATTRIBUTE(4, 5);
606 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
607 const char *format
, ...)
609 struct vfs_full_audit_private_data
*pd
;
611 char *audit_pre
= NULL
;
615 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
616 struct vfs_full_audit_private_data
,
619 if (success
&& (!log_success(pd
, op
)))
622 if (!success
&& (!log_failure(pd
, op
)))
626 fstrcpy(err_msg
, "ok");
628 fstr_sprintf(err_msg
, "fail (%s)", strerror(errno
));
630 va_start(ap
, format
);
631 op_msg
= talloc_vasprintf(talloc_tos(), format
, ap
);
638 audit_pre
= audit_prefix(talloc_tos(), handle
->conn
);
644 * Specify the facility to interoperate with other syslog
645 * callers (smbd for example).
647 priority
= pd
->syslog_priority
| pd
->syslog_facility
;
649 syslog(priority
, "%s|%s|%s|%s\n",
650 audit_pre
? audit_pre
: "",
651 audit_opname(op
), err_msg
, op_msg
);
653 DEBUG(1, ("%s|%s|%s|%s\n",
654 audit_pre
? audit_pre
: "",
655 audit_opname(op
), err_msg
, op_msg
));
658 TALLOC_FREE(audit_pre
);
660 TALLOC_FREE(tmp_do_log_ctx
);
664 * Return a string using the do_log_ctx()
666 static const char *smb_fname_str_do_log(struct connection_struct
*conn
,
667 const struct smb_filename
*smb_fname
)
672 if (smb_fname
== NULL
) {
676 if (smb_fname
->base_name
[0] != '/') {
677 char *abs_name
= NULL
;
678 struct smb_filename
*fname_copy
= cp_smb_filename(
681 if (fname_copy
== NULL
) {
685 if (!ISDOT(smb_fname
->base_name
)) {
686 abs_name
= talloc_asprintf(do_log_ctx(),
688 conn
->cwd_fsp
->fsp_name
->base_name
,
689 smb_fname
->base_name
);
691 abs_name
= talloc_strdup(do_log_ctx(),
692 conn
->cwd_fsp
->fsp_name
->base_name
);
694 if (abs_name
== NULL
) {
697 fname_copy
->base_name
= abs_name
;
698 smb_fname
= fname_copy
;
701 status
= get_full_smb_filename(do_log_ctx(), smb_fname
, &fname
);
702 if (!NT_STATUS_IS_OK(status
)) {
709 * Return an fsp debug string using the do_log_ctx()
711 static const char *fsp_str_do_log(const struct files_struct
*fsp
)
713 return smb_fname_str_do_log(fsp
->conn
, fsp
->fsp_name
);
716 /* Implementation of vfs_ops. Pass everything on to the default
717 operation but log event first. */
719 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
720 const char *svc
, const char *user
)
723 const char *none
[] = { "none" };
724 struct vfs_full_audit_private_data
*pd
= NULL
;
726 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
731 pd
= talloc_zero(handle
, struct vfs_full_audit_private_data
);
733 SMB_VFS_NEXT_DISCONNECT(handle
);
737 pd
->syslog_facility
= audit_syslog_facility(handle
);
738 if (pd
->syslog_facility
== -1) {
739 DEBUG(1, ("%s: Unknown facility %s\n", __func__
,
740 lp_parm_const_string(SNUM(handle
->conn
),
741 "full_audit", "facility",
743 SMB_VFS_NEXT_DISCONNECT(handle
);
747 pd
->syslog_priority
= audit_syslog_priority(handle
);
749 pd
->log_secdesc
= lp_parm_bool(SNUM(handle
->conn
),
750 "full_audit", "log_secdesc", false);
752 pd
->do_syslog
= lp_parm_bool(SNUM(handle
->conn
),
753 "full_audit", "syslog", true);
757 openlog("smbd_audit", 0, pd
->syslog_facility
);
761 pd
->success_ops
= init_bitmap(
762 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
764 pd
->failure_ops
= init_bitmap(
765 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
768 /* Store the private data. */
769 SMB_VFS_HANDLE_SET_DATA(handle
, pd
, NULL
,
770 struct vfs_full_audit_private_data
, return -1);
772 do_log(SMB_VFS_OP_CONNECT
, True
, handle
,
778 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
)
780 const struct loadparm_substitution
*lp_sub
=
781 loadparm_s3_global_substitution();
783 SMB_VFS_NEXT_DISCONNECT(handle
);
785 do_log(SMB_VFS_OP_DISCONNECT
, True
, handle
,
786 "%s", lp_servicename(talloc_tos(), lp_sub
, SNUM(handle
->conn
)));
788 /* The bitmaps will be disconnected when the private
792 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
793 const struct smb_filename
*smb_fname
,
800 result
= SMB_VFS_NEXT_DISK_FREE(handle
, smb_fname
, bsize
, dfree
, dsize
);
802 /* Don't have a reasonable notion of failure here */
804 do_log(SMB_VFS_OP_DISK_FREE
,
808 smb_fname_str_do_log(handle
->conn
, smb_fname
));
813 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
814 const struct smb_filename
*smb_fname
,
815 enum SMB_QUOTA_TYPE qtype
,
821 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, smb_fname
, qtype
, id
, qt
);
823 do_log(SMB_VFS_OP_GET_QUOTA
,
827 smb_fname_str_do_log(handle
->conn
, smb_fname
));
832 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
833 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
838 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
840 do_log(SMB_VFS_OP_SET_QUOTA
, (result
>= 0), handle
, "");
845 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
846 struct files_struct
*fsp
,
847 struct shadow_copy_data
*shadow_copy_data
,
852 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
, labels
);
854 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA
, (result
>= 0), handle
, "");
859 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
860 const struct smb_filename
*smb_fname
,
861 struct vfs_statvfs_struct
*statbuf
)
865 result
= SMB_VFS_NEXT_STATVFS(handle
, smb_fname
, statbuf
);
867 do_log(SMB_VFS_OP_STATVFS
, (result
>= 0), handle
, "");
872 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
, enum timestamp_set_resolution
*p_ts_res
)
876 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
878 do_log(SMB_VFS_OP_FS_CAPABILITIES
, true, handle
, "");
883 static NTSTATUS
smb_full_audit_get_dfs_referrals(
884 struct vfs_handle_struct
*handle
,
885 struct dfs_GetDFSReferral
*r
)
889 status
= SMB_VFS_NEXT_GET_DFS_REFERRALS(handle
, r
);
891 do_log(SMB_VFS_OP_GET_DFS_REFERRALS
, NT_STATUS_IS_OK(status
),
897 static NTSTATUS
smb_full_audit_create_dfs_pathat(struct vfs_handle_struct
*handle
,
898 struct files_struct
*dirfsp
,
899 const struct smb_filename
*smb_fname
,
900 const struct referral
*reflist
,
901 size_t referral_count
)
905 status
= SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle
,
911 do_log(SMB_VFS_OP_CREATE_DFS_PATHAT
,
912 NT_STATUS_IS_OK(status
),
915 smb_fname_str_do_log(handle
->conn
, smb_fname
));
920 static NTSTATUS
smb_full_audit_read_dfs_pathat(struct vfs_handle_struct
*handle
,
922 struct files_struct
*dirfsp
,
923 const struct smb_filename
*smb_fname
,
924 struct referral
**ppreflist
,
925 size_t *preferral_count
)
929 status
= SMB_VFS_NEXT_READ_DFS_PATHAT(handle
,
936 do_log(SMB_VFS_OP_READ_DFS_PATHAT
,
937 NT_STATUS_IS_OK(status
),
940 smb_fname_str_do_log(handle
->conn
, smb_fname
));
945 static NTSTATUS
smb_full_audit_snap_check_path(struct vfs_handle_struct
*handle
,
947 const char *service_path
,
952 status
= SMB_VFS_NEXT_SNAP_CHECK_PATH(handle
, mem_ctx
, service_path
,
954 do_log(SMB_VFS_OP_SNAP_CHECK_PATH
, NT_STATUS_IS_OK(status
),
960 static NTSTATUS
smb_full_audit_snap_create(struct vfs_handle_struct
*handle
,
962 const char *base_volume
,
970 status
= SMB_VFS_NEXT_SNAP_CREATE(handle
, mem_ctx
, base_volume
, tstamp
,
971 rw
, base_path
, snap_path
);
972 do_log(SMB_VFS_OP_SNAP_CREATE
, NT_STATUS_IS_OK(status
), handle
, "");
977 static NTSTATUS
smb_full_audit_snap_delete(struct vfs_handle_struct
*handle
,
984 status
= SMB_VFS_NEXT_SNAP_DELETE(handle
, mem_ctx
, base_path
,
986 do_log(SMB_VFS_OP_SNAP_DELETE
, NT_STATUS_IS_OK(status
), handle
, "");
991 static DIR *smb_full_audit_opendir(vfs_handle_struct
*handle
,
992 const struct smb_filename
*smb_fname
,
998 result
= SMB_VFS_NEXT_OPENDIR(handle
, smb_fname
, mask
, attr
);
1000 do_log(SMB_VFS_OP_OPENDIR
,
1004 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1009 static DIR *smb_full_audit_fdopendir(vfs_handle_struct
*handle
,
1010 files_struct
*fsp
, const char *mask
, uint32_t attr
)
1014 result
= SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
1016 do_log(SMB_VFS_OP_FDOPENDIR
, (result
!= NULL
), handle
, "%s",
1017 fsp_str_do_log(fsp
));
1022 static struct dirent
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
1023 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
1025 struct dirent
*result
;
1027 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
1029 /* This operation has no reasonable error condition
1030 * (End of dir is also failure), so always succeed.
1032 do_log(SMB_VFS_OP_READDIR
, True
, handle
, "");
1037 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
1038 DIR *dirp
, long offset
)
1040 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
1042 do_log(SMB_VFS_OP_SEEKDIR
, True
, handle
, "");
1045 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
1050 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
1052 do_log(SMB_VFS_OP_TELLDIR
, True
, handle
, "");
1057 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
1060 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
1062 do_log(SMB_VFS_OP_REWINDDIR
, True
, handle
, "");
1065 static int smb_full_audit_mkdirat(vfs_handle_struct
*handle
,
1066 struct files_struct
*dirfsp
,
1067 const struct smb_filename
*smb_fname
,
1072 result
= SMB_VFS_NEXT_MKDIRAT(handle
,
1077 do_log(SMB_VFS_OP_MKDIRAT
,
1081 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1086 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
1091 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
1093 do_log(SMB_VFS_OP_CLOSEDIR
, (result
>= 0), handle
, "");
1098 static int smb_full_audit_open(vfs_handle_struct
*handle
,
1099 struct smb_filename
*smb_fname
,
1100 files_struct
*fsp
, int flags
, mode_t mode
)
1104 result
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
1106 do_log(SMB_VFS_OP_OPEN
, (result
>= 0), handle
, "%s|%s",
1107 ((flags
& O_WRONLY
) || (flags
& O_RDWR
))?"w":"r",
1108 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1113 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
1114 struct smb_request
*req
,
1115 uint16_t root_dir_fid
,
1116 struct smb_filename
*smb_fname
,
1117 uint32_t access_mask
,
1118 uint32_t share_access
,
1119 uint32_t create_disposition
,
1120 uint32_t create_options
,
1121 uint32_t file_attributes
,
1122 uint32_t oplock_request
,
1123 const struct smb2_lease
*lease
,
1124 uint64_t allocation_size
,
1125 uint32_t private_flags
,
1126 struct security_descriptor
*sd
,
1127 struct ea_list
*ea_list
,
1128 files_struct
**result_fsp
,
1130 const struct smb2_create_blobs
*in_context_blobs
,
1131 struct smb2_create_blobs
*out_context_blobs
)
1134 const char* str_create_disposition
;
1136 switch (create_disposition
) {
1137 case FILE_SUPERSEDE
:
1138 str_create_disposition
= "supersede";
1140 case FILE_OVERWRITE_IF
:
1141 str_create_disposition
= "overwrite_if";
1144 str_create_disposition
= "open";
1146 case FILE_OVERWRITE
:
1147 str_create_disposition
= "overwrite";
1150 str_create_disposition
= "create";
1153 str_create_disposition
= "open_if";
1156 str_create_disposition
= "unknown";
1159 result
= SMB_VFS_NEXT_CREATE_FILE(
1160 handle
, /* handle */
1162 root_dir_fid
, /* root_dir_fid */
1163 smb_fname
, /* fname */
1164 access_mask
, /* access_mask */
1165 share_access
, /* share_access */
1166 create_disposition
, /* create_disposition*/
1167 create_options
, /* create_options */
1168 file_attributes
, /* file_attributes */
1169 oplock_request
, /* oplock_request */
1171 allocation_size
, /* allocation_size */
1174 ea_list
, /* ea_list */
1175 result_fsp
, /* result */
1177 in_context_blobs
, out_context_blobs
); /* create context */
1179 do_log(SMB_VFS_OP_CREATE_FILE
, (NT_STATUS_IS_OK(result
)), handle
,
1180 "0x%x|%s|%s|%s", access_mask
,
1181 create_options
& FILE_DIRECTORY_FILE
? "dir" : "file",
1182 str_create_disposition
,
1183 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1188 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
1192 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
1194 do_log(SMB_VFS_OP_CLOSE
, (result
>= 0), handle
, "%s",
1195 fsp_str_do_log(fsp
));
1200 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
1201 void *data
, size_t n
, off_t offset
)
1205 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
1207 do_log(SMB_VFS_OP_PREAD
, (result
>= 0), handle
, "%s",
1208 fsp_str_do_log(fsp
));
1213 struct smb_full_audit_pread_state
{
1214 vfs_handle_struct
*handle
;
1217 struct vfs_aio_state vfs_aio_state
;
1220 static void smb_full_audit_pread_done(struct tevent_req
*subreq
);
1222 static struct tevent_req
*smb_full_audit_pread_send(
1223 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1224 struct tevent_context
*ev
, struct files_struct
*fsp
,
1225 void *data
, size_t n
, off_t offset
)
1227 struct tevent_req
*req
, *subreq
;
1228 struct smb_full_audit_pread_state
*state
;
1230 req
= tevent_req_create(mem_ctx
, &state
,
1231 struct smb_full_audit_pread_state
);
1233 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
1234 fsp_str_do_log(fsp
));
1237 state
->handle
= handle
;
1240 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
1242 if (tevent_req_nomem(subreq
, req
)) {
1243 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
1244 fsp_str_do_log(fsp
));
1245 return tevent_req_post(req
, ev
);
1247 tevent_req_set_callback(subreq
, smb_full_audit_pread_done
, req
);
1249 do_log(SMB_VFS_OP_PREAD_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1253 static void smb_full_audit_pread_done(struct tevent_req
*subreq
)
1255 struct tevent_req
*req
= tevent_req_callback_data(
1256 subreq
, struct tevent_req
);
1257 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1258 req
, struct smb_full_audit_pread_state
);
1260 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->vfs_aio_state
);
1261 TALLOC_FREE(subreq
);
1262 tevent_req_done(req
);
1265 static ssize_t
smb_full_audit_pread_recv(struct tevent_req
*req
,
1266 struct vfs_aio_state
*vfs_aio_state
)
1268 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1269 req
, struct smb_full_audit_pread_state
);
1271 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
1272 do_log(SMB_VFS_OP_PREAD_RECV
, false, state
->handle
, "%s",
1273 fsp_str_do_log(state
->fsp
));
1277 do_log(SMB_VFS_OP_PREAD_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1278 fsp_str_do_log(state
->fsp
));
1280 *vfs_aio_state
= state
->vfs_aio_state
;
1284 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
1285 const void *data
, size_t n
,
1290 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
1292 do_log(SMB_VFS_OP_PWRITE
, (result
>= 0), handle
, "%s",
1293 fsp_str_do_log(fsp
));
1298 struct smb_full_audit_pwrite_state
{
1299 vfs_handle_struct
*handle
;
1302 struct vfs_aio_state vfs_aio_state
;
1305 static void smb_full_audit_pwrite_done(struct tevent_req
*subreq
);
1307 static struct tevent_req
*smb_full_audit_pwrite_send(
1308 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1309 struct tevent_context
*ev
, struct files_struct
*fsp
,
1310 const void *data
, size_t n
, off_t offset
)
1312 struct tevent_req
*req
, *subreq
;
1313 struct smb_full_audit_pwrite_state
*state
;
1315 req
= tevent_req_create(mem_ctx
, &state
,
1316 struct smb_full_audit_pwrite_state
);
1318 do_log(SMB_VFS_OP_PWRITE_SEND
, false, handle
, "%s",
1319 fsp_str_do_log(fsp
));
1322 state
->handle
= handle
;
1325 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
1327 if (tevent_req_nomem(subreq
, req
)) {
1328 do_log(SMB_VFS_OP_PWRITE_SEND
, false, handle
, "%s",
1329 fsp_str_do_log(fsp
));
1330 return tevent_req_post(req
, ev
);
1332 tevent_req_set_callback(subreq
, smb_full_audit_pwrite_done
, req
);
1334 do_log(SMB_VFS_OP_PWRITE_SEND
, true, handle
, "%s",
1335 fsp_str_do_log(fsp
));
1339 static void smb_full_audit_pwrite_done(struct tevent_req
*subreq
)
1341 struct tevent_req
*req
= tevent_req_callback_data(
1342 subreq
, struct tevent_req
);
1343 struct smb_full_audit_pwrite_state
*state
= tevent_req_data(
1344 req
, struct smb_full_audit_pwrite_state
);
1346 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->vfs_aio_state
);
1347 TALLOC_FREE(subreq
);
1348 tevent_req_done(req
);
1351 static ssize_t
smb_full_audit_pwrite_recv(struct tevent_req
*req
,
1352 struct vfs_aio_state
*vfs_aio_state
)
1354 struct smb_full_audit_pwrite_state
*state
= tevent_req_data(
1355 req
, struct smb_full_audit_pwrite_state
);
1357 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
1358 do_log(SMB_VFS_OP_PWRITE_RECV
, false, state
->handle
, "%s",
1359 fsp_str_do_log(state
->fsp
));
1363 do_log(SMB_VFS_OP_PWRITE_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1364 fsp_str_do_log(state
->fsp
));
1366 *vfs_aio_state
= state
->vfs_aio_state
;
1370 static off_t
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
1371 off_t offset
, int whence
)
1375 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
1377 do_log(SMB_VFS_OP_LSEEK
, (result
!= (ssize_t
)-1), handle
,
1378 "%s", fsp_str_do_log(fsp
));
1383 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
1384 files_struct
*fromfsp
,
1385 const DATA_BLOB
*hdr
, off_t offset
,
1390 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
1392 do_log(SMB_VFS_OP_SENDFILE
, (result
>= 0), handle
,
1393 "%s", fsp_str_do_log(fromfsp
));
1398 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
1399 files_struct
*tofsp
,
1405 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
1407 do_log(SMB_VFS_OP_RECVFILE
, (result
>= 0), handle
,
1408 "%s", fsp_str_do_log(tofsp
));
1413 static int smb_full_audit_renameat(vfs_handle_struct
*handle
,
1414 files_struct
*srcfsp
,
1415 const struct smb_filename
*smb_fname_src
,
1416 files_struct
*dstfsp
,
1417 const struct smb_filename
*smb_fname_dst
)
1421 result
= SMB_VFS_NEXT_RENAMEAT(handle
,
1427 do_log(SMB_VFS_OP_RENAMEAT
, (result
>= 0), handle
, "%s|%s",
1428 smb_fname_str_do_log(handle
->conn
, smb_fname_src
),
1429 smb_fname_str_do_log(handle
->conn
, smb_fname_dst
));
1434 struct smb_full_audit_fsync_state
{
1435 vfs_handle_struct
*handle
;
1438 struct vfs_aio_state vfs_aio_state
;
1441 static void smb_full_audit_fsync_done(struct tevent_req
*subreq
);
1443 static struct tevent_req
*smb_full_audit_fsync_send(
1444 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1445 struct tevent_context
*ev
, struct files_struct
*fsp
)
1447 struct tevent_req
*req
, *subreq
;
1448 struct smb_full_audit_fsync_state
*state
;
1450 req
= tevent_req_create(mem_ctx
, &state
,
1451 struct smb_full_audit_fsync_state
);
1453 do_log(SMB_VFS_OP_FSYNC_SEND
, false, handle
, "%s",
1454 fsp_str_do_log(fsp
));
1457 state
->handle
= handle
;
1460 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
1461 if (tevent_req_nomem(subreq
, req
)) {
1462 do_log(SMB_VFS_OP_FSYNC_SEND
, false, handle
, "%s",
1463 fsp_str_do_log(fsp
));
1464 return tevent_req_post(req
, ev
);
1466 tevent_req_set_callback(subreq
, smb_full_audit_fsync_done
, req
);
1468 do_log(SMB_VFS_OP_FSYNC_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1472 static void smb_full_audit_fsync_done(struct tevent_req
*subreq
)
1474 struct tevent_req
*req
= tevent_req_callback_data(
1475 subreq
, struct tevent_req
);
1476 struct smb_full_audit_fsync_state
*state
= tevent_req_data(
1477 req
, struct smb_full_audit_fsync_state
);
1479 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->vfs_aio_state
);
1480 TALLOC_FREE(subreq
);
1481 tevent_req_done(req
);
1484 static int smb_full_audit_fsync_recv(struct tevent_req
*req
,
1485 struct vfs_aio_state
*vfs_aio_state
)
1487 struct smb_full_audit_fsync_state
*state
= tevent_req_data(
1488 req
, struct smb_full_audit_fsync_state
);
1490 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
1491 do_log(SMB_VFS_OP_FSYNC_RECV
, false, state
->handle
, "%s",
1492 fsp_str_do_log(state
->fsp
));
1496 do_log(SMB_VFS_OP_FSYNC_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1497 fsp_str_do_log(state
->fsp
));
1499 *vfs_aio_state
= state
->vfs_aio_state
;
1503 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
1504 struct smb_filename
*smb_fname
)
1508 result
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
1510 do_log(SMB_VFS_OP_STAT
, (result
>= 0), handle
, "%s",
1511 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1516 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1517 SMB_STRUCT_STAT
*sbuf
)
1521 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1523 do_log(SMB_VFS_OP_FSTAT
, (result
>= 0), handle
, "%s",
1524 fsp_str_do_log(fsp
));
1529 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
1530 struct smb_filename
*smb_fname
)
1534 result
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
1536 do_log(SMB_VFS_OP_LSTAT
, (result
>= 0), handle
, "%s",
1537 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1542 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
1543 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
1547 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1549 do_log(SMB_VFS_OP_GET_ALLOC_SIZE
, (result
!= (uint64_t)-1), handle
,
1550 "%llu", (unsigned long long)result
);
1555 static int smb_full_audit_unlinkat(vfs_handle_struct
*handle
,
1556 struct files_struct
*dirfsp
,
1557 const struct smb_filename
*smb_fname
,
1562 result
= SMB_VFS_NEXT_UNLINKAT(handle
,
1567 do_log(SMB_VFS_OP_UNLINKAT
, (result
>= 0), handle
, "%s",
1568 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1573 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
1574 const struct smb_filename
*smb_fname
,
1579 result
= SMB_VFS_NEXT_CHMOD(handle
, smb_fname
, mode
);
1581 do_log(SMB_VFS_OP_CHMOD
,
1585 smb_fname_str_do_log(handle
->conn
, smb_fname
),
1591 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1596 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1598 do_log(SMB_VFS_OP_FCHMOD
, (result
>= 0), handle
,
1599 "%s|%o", fsp_str_do_log(fsp
), mode
);
1604 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1605 uid_t uid
, gid_t gid
)
1609 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1611 do_log(SMB_VFS_OP_FCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1612 fsp_str_do_log(fsp
), (long int)uid
, (long int)gid
);
1617 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
1618 const struct smb_filename
*smb_fname
,
1624 result
= SMB_VFS_NEXT_LCHOWN(handle
, smb_fname
, uid
, gid
);
1626 do_log(SMB_VFS_OP_LCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1627 smb_fname
->base_name
, (long int)uid
, (long int)gid
);
1632 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
1633 const struct smb_filename
*smb_fname
)
1637 result
= SMB_VFS_NEXT_CHDIR(handle
, smb_fname
);
1639 do_log(SMB_VFS_OP_CHDIR
,
1643 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1648 static struct smb_filename
*smb_full_audit_getwd(vfs_handle_struct
*handle
,
1651 struct smb_filename
*result
;
1653 result
= SMB_VFS_NEXT_GETWD(handle
, ctx
);
1655 do_log(SMB_VFS_OP_GETWD
, (result
!= NULL
), handle
, "%s",
1656 result
== NULL
? "" : result
->base_name
);
1661 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
1662 const struct smb_filename
*smb_fname
,
1663 struct smb_file_time
*ft
)
1666 time_t create_time
= convert_timespec_to_time_t(ft
->create_time
);
1667 time_t atime
= convert_timespec_to_time_t(ft
->atime
);
1668 time_t mtime
= convert_timespec_to_time_t(ft
->mtime
);
1669 time_t ctime
= convert_timespec_to_time_t(ft
->ctime
);
1670 const char *create_time_str
= "";
1671 const char *atime_str
= "";
1672 const char *mtime_str
= "";
1673 const char *ctime_str
= "";
1674 TALLOC_CTX
*frame
= talloc_stackframe();
1676 result
= SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
1678 if (create_time
> 0) {
1679 create_time_str
= timestring(frame
, create_time
);
1682 atime_str
= timestring(frame
, atime
);
1685 mtime_str
= timestring(frame
, mtime
);
1688 ctime_str
= timestring(frame
, ctime
);
1691 do_log(SMB_VFS_OP_NTIMES
,
1695 smb_fname_str_do_log(handle
->conn
, smb_fname
),
1706 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1711 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1713 do_log(SMB_VFS_OP_FTRUNCATE
, (result
>= 0), handle
,
1714 "%s", fsp_str_do_log(fsp
));
1719 static int smb_full_audit_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1726 result
= SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1728 do_log(SMB_VFS_OP_FALLOCATE
, (result
>= 0), handle
,
1729 "%s", fsp_str_do_log(fsp
));
1734 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1735 int op
, off_t offset
, off_t count
, int type
)
1739 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1741 do_log(SMB_VFS_OP_LOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1746 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1747 struct files_struct
*fsp
,
1748 uint32_t share_access
,
1749 uint32_t access_mask
)
1753 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
,
1758 do_log(SMB_VFS_OP_KERNEL_FLOCK
, (result
>= 0), handle
, "%s",
1759 fsp_str_do_log(fsp
));
1764 static int smb_full_audit_fcntl(struct vfs_handle_struct
*handle
,
1765 struct files_struct
*fsp
,
1766 int cmd
, va_list cmd_arg
)
1769 va_list dup_cmd_arg
;
1772 va_copy(dup_cmd_arg
, cmd_arg
);
1773 arg
= va_arg(dup_cmd_arg
, void *);
1774 result
= SMB_VFS_NEXT_FCNTL(handle
, fsp
, cmd
, arg
);
1775 va_end(dup_cmd_arg
);
1777 do_log(SMB_VFS_OP_FCNTL
, (result
>= 0), handle
, "%s",
1778 fsp_str_do_log(fsp
));
1783 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1788 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1790 do_log(SMB_VFS_OP_LINUX_SETLEASE
, (result
>= 0), handle
, "%s",
1791 fsp_str_do_log(fsp
));
1796 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1797 off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
)
1801 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
1803 do_log(SMB_VFS_OP_GETLOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1808 static int smb_full_audit_symlinkat(vfs_handle_struct
*handle
,
1809 const char *link_contents
,
1810 struct files_struct
*dirfsp
,
1811 const struct smb_filename
*new_smb_fname
)
1815 result
= SMB_VFS_NEXT_SYMLINKAT(handle
,
1820 do_log(SMB_VFS_OP_SYMLINKAT
,
1825 smb_fname_str_do_log(handle
->conn
, new_smb_fname
));
1830 static int smb_full_audit_readlinkat(vfs_handle_struct
*handle
,
1831 files_struct
*dirfsp
,
1832 const struct smb_filename
*smb_fname
,
1838 result
= SMB_VFS_NEXT_READLINKAT(handle
,
1844 do_log(SMB_VFS_OP_READLINKAT
,
1848 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1853 static int smb_full_audit_linkat(vfs_handle_struct
*handle
,
1854 files_struct
*srcfsp
,
1855 const struct smb_filename
*old_smb_fname
,
1856 files_struct
*dstfsp
,
1857 const struct smb_filename
*new_smb_fname
,
1862 result
= SMB_VFS_NEXT_LINKAT(handle
,
1869 do_log(SMB_VFS_OP_LINKAT
,
1873 smb_fname_str_do_log(handle
->conn
, old_smb_fname
),
1874 smb_fname_str_do_log(handle
->conn
, new_smb_fname
));
1879 static int smb_full_audit_mknodat(vfs_handle_struct
*handle
,
1880 files_struct
*dirfsp
,
1881 const struct smb_filename
*smb_fname
,
1887 result
= SMB_VFS_NEXT_MKNODAT(handle
,
1893 do_log(SMB_VFS_OP_MKNODAT
,
1897 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1902 static struct smb_filename
*smb_full_audit_realpath(vfs_handle_struct
*handle
,
1904 const struct smb_filename
*smb_fname
)
1906 struct smb_filename
*result_fname
= NULL
;
1908 result_fname
= SMB_VFS_NEXT_REALPATH(handle
, ctx
, smb_fname
);
1910 do_log(SMB_VFS_OP_REALPATH
,
1911 (result_fname
!= NULL
),
1914 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1916 return result_fname
;
1919 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
1920 const struct smb_filename
*smb_fname
,
1925 result
= SMB_VFS_NEXT_CHFLAGS(handle
, smb_fname
, flags
);
1927 do_log(SMB_VFS_OP_CHFLAGS
,
1931 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1936 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
1937 const SMB_STRUCT_STAT
*sbuf
)
1939 struct file_id id_zero
= { 0 };
1940 struct file_id result
;
1941 struct file_id_buf idbuf
;
1943 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1945 do_log(SMB_VFS_OP_FILE_ID_CREATE
,
1946 !file_id_equal(&id_zero
, &result
),
1949 file_id_str_buf(result
, &idbuf
));
1954 static uint64_t smb_full_audit_fs_file_id(struct vfs_handle_struct
*handle
,
1955 const SMB_STRUCT_STAT
*sbuf
)
1959 result
= SMB_VFS_NEXT_FS_FILE_ID(handle
, sbuf
);
1961 do_log(SMB_VFS_OP_FS_FILE_ID
,
1963 handle
, "%" PRIu64
, result
);
1968 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
1969 struct files_struct
*fsp
,
1970 const struct smb_filename
*smb_fname
,
1971 TALLOC_CTX
*mem_ctx
,
1972 unsigned int *pnum_streams
,
1973 struct stream_struct
**pstreams
)
1977 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, smb_fname
, mem_ctx
,
1978 pnum_streams
, pstreams
);
1980 do_log(SMB_VFS_OP_STREAMINFO
,
1981 NT_STATUS_IS_OK(result
),
1984 smb_fname_str_do_log(handle
->conn
, smb_fname
));
1989 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1992 TALLOC_CTX
*mem_ctx
,
1997 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
2000 do_log(SMB_VFS_OP_GET_REAL_FILENAME
, (result
== 0), handle
,
2001 "%s/%s->%s", path
, name
, (result
== 0) ? *found_name
: "");
2006 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
2007 const struct smb_filename
*smb_fname
)
2011 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, smb_fname
);
2013 do_log(SMB_VFS_OP_CONNECTPATH
,
2017 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2022 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
2023 struct byte_range_lock
*br_lck
,
2024 struct lock_struct
*plock
)
2028 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
);
2030 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS
, NT_STATUS_IS_OK(result
), handle
,
2031 "%s:%llu-%llu. type=%d.",
2032 fsp_str_do_log(brl_fsp(br_lck
)),
2033 (unsigned long long)plock
->start
,
2034 (unsigned long long)plock
->size
,
2040 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
2041 struct byte_range_lock
*br_lck
,
2042 const struct lock_struct
*plock
)
2046 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, br_lck
, plock
);
2048 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, (result
== 0), handle
,
2049 "%s:%llu-%llu:%d", fsp_str_do_log(brl_fsp(br_lck
)),
2050 (unsigned long long)plock
->start
,
2051 (unsigned long long)plock
->size
,
2057 static bool smb_full_audit_strict_lock_check(struct vfs_handle_struct
*handle
,
2058 struct files_struct
*fsp
,
2059 struct lock_struct
*plock
)
2063 result
= SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle
, fsp
, plock
);
2065 do_log(SMB_VFS_OP_STRICT_LOCK_CHECK
, result
, handle
,
2066 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
),
2067 (unsigned long long)plock
->start
,
2068 (unsigned long long)plock
->size
,
2074 static NTSTATUS
smb_full_audit_translate_name(struct vfs_handle_struct
*handle
,
2076 enum vfs_translate_direction direction
,
2077 TALLOC_CTX
*mem_ctx
,
2082 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
2085 do_log(SMB_VFS_OP_TRANSLATE_NAME
, NT_STATUS_IS_OK(result
), handle
, "");
2090 static NTSTATUS
smb_full_audit_fsctl(struct vfs_handle_struct
*handle
,
2091 struct files_struct
*fsp
,
2095 const uint8_t *_in_data
,
2097 uint8_t **_out_data
,
2098 uint32_t max_out_len
,
2103 result
= SMB_VFS_NEXT_FSCTL(handle
,
2114 do_log(SMB_VFS_OP_FSCTL
, NT_STATUS_IS_OK(result
), handle
, "");
2119 static struct tevent_req
*smb_full_audit_offload_read_send(
2120 TALLOC_CTX
*mem_ctx
,
2121 struct tevent_context
*ev
,
2122 struct vfs_handle_struct
*handle
,
2123 struct files_struct
*fsp
,
2129 struct tevent_req
*req
= NULL
;
2131 req
= SMB_VFS_NEXT_OFFLOAD_READ_SEND(mem_ctx
, ev
, handle
, fsp
,
2132 fsctl
, ttl
, offset
, to_copy
);
2134 do_log(SMB_VFS_OP_OFFLOAD_READ_SEND
, req
, handle
, "");
2139 static NTSTATUS
smb_full_audit_offload_read_recv(
2140 struct tevent_req
*req
,
2141 struct vfs_handle_struct
*handle
,
2142 TALLOC_CTX
*mem_ctx
,
2143 DATA_BLOB
*_token_blob
)
2147 status
= SMB_VFS_NEXT_OFFLOAD_READ_RECV(req
, handle
, mem_ctx
,
2150 do_log(SMB_VFS_OP_OFFLOAD_READ_RECV
, NT_STATUS_IS_OK(status
), handle
, "");
2155 static struct tevent_req
*smb_full_audit_offload_write_send(struct vfs_handle_struct
*handle
,
2156 TALLOC_CTX
*mem_ctx
,
2157 struct tevent_context
*ev
,
2160 off_t transfer_offset
,
2161 struct files_struct
*dest_fsp
,
2165 struct tevent_req
*req
;
2167 req
= SMB_VFS_NEXT_OFFLOAD_WRITE_SEND(handle
, mem_ctx
, ev
,
2168 fsctl
, token
, transfer_offset
,
2169 dest_fsp
, dest_off
, num
);
2171 do_log(SMB_VFS_OP_OFFLOAD_WRITE_SEND
, req
, handle
, "");
2176 static NTSTATUS
smb_full_audit_offload_write_recv(struct vfs_handle_struct
*handle
,
2177 struct tevent_req
*req
,
2182 result
= SMB_VFS_NEXT_OFFLOAD_WRITE_RECV(handle
, req
, copied
);
2184 do_log(SMB_VFS_OP_OFFLOAD_WRITE_RECV
, NT_STATUS_IS_OK(result
), handle
, "");
2189 static NTSTATUS
smb_full_audit_get_compression(vfs_handle_struct
*handle
,
2190 TALLOC_CTX
*mem_ctx
,
2191 struct files_struct
*fsp
,
2192 struct smb_filename
*smb_fname
,
2193 uint16_t *_compression_fmt
)
2197 result
= SMB_VFS_NEXT_GET_COMPRESSION(handle
, mem_ctx
, fsp
, smb_fname
,
2200 do_log(SMB_VFS_OP_GET_COMPRESSION
, NT_STATUS_IS_OK(result
), handle
,
2202 (fsp
? fsp_str_do_log(fsp
) :
2203 smb_fname_str_do_log(handle
->conn
, smb_fname
)));
2208 static NTSTATUS
smb_full_audit_set_compression(vfs_handle_struct
*handle
,
2209 TALLOC_CTX
*mem_ctx
,
2210 struct files_struct
*fsp
,
2211 uint16_t compression_fmt
)
2215 result
= SMB_VFS_NEXT_SET_COMPRESSION(handle
, mem_ctx
, fsp
,
2218 do_log(SMB_VFS_OP_SET_COMPRESSION
, NT_STATUS_IS_OK(result
), handle
,
2219 "%s", fsp_str_do_log(fsp
));
2224 static NTSTATUS
smb_full_audit_readdir_attr(struct vfs_handle_struct
*handle
,
2225 const struct smb_filename
*fname
,
2226 TALLOC_CTX
*mem_ctx
,
2227 struct readdir_attr_data
**pattr_data
)
2231 status
= SMB_VFS_NEXT_READDIR_ATTR(handle
, fname
, mem_ctx
, pattr_data
);
2233 do_log(SMB_VFS_OP_READDIR_ATTR
, NT_STATUS_IS_OK(status
), handle
, "%s",
2234 smb_fname_str_do_log(handle
->conn
, fname
));
2239 static NTSTATUS
smb_full_audit_get_dos_attributes(
2240 struct vfs_handle_struct
*handle
,
2241 struct smb_filename
*smb_fname
,
2246 status
= SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle
,
2250 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES
,
2251 NT_STATUS_IS_OK(status
),
2254 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2259 struct smb_full_audit_get_dos_attributes_state
{
2260 struct vfs_aio_state aio_state
;
2261 vfs_handle_struct
*handle
;
2262 files_struct
*dir_fsp
;
2263 const struct smb_filename
*smb_fname
;
2267 static void smb_full_audit_get_dos_attributes_done(struct tevent_req
*subreq
);
2269 static struct tevent_req
*smb_full_audit_get_dos_attributes_send(
2270 TALLOC_CTX
*mem_ctx
,
2271 struct tevent_context
*ev
,
2272 struct vfs_handle_struct
*handle
,
2273 files_struct
*dir_fsp
,
2274 struct smb_filename
*smb_fname
)
2276 struct tevent_req
*req
= NULL
;
2277 struct smb_full_audit_get_dos_attributes_state
*state
= NULL
;
2278 struct tevent_req
*subreq
= NULL
;
2280 req
= tevent_req_create(mem_ctx
, &state
,
2281 struct smb_full_audit_get_dos_attributes_state
);
2283 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND
,
2287 fsp_str_do_log(dir_fsp
),
2288 smb_fname
->base_name
);
2291 *state
= (struct smb_full_audit_get_dos_attributes_state
) {
2294 .smb_fname
= smb_fname
,
2297 subreq
= SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_SEND(mem_ctx
,
2302 if (tevent_req_nomem(subreq
, req
)) {
2303 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND
,
2307 fsp_str_do_log(dir_fsp
),
2308 smb_fname
->base_name
);
2309 return tevent_req_post(req
, ev
);
2311 tevent_req_set_callback(subreq
,
2312 smb_full_audit_get_dos_attributes_done
,
2315 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_SEND
,
2319 fsp_str_do_log(dir_fsp
),
2320 smb_fname
->base_name
);
2325 static void smb_full_audit_get_dos_attributes_done(struct tevent_req
*subreq
)
2327 struct tevent_req
*req
=
2328 tevent_req_callback_data(subreq
,
2330 struct smb_full_audit_get_dos_attributes_state
*state
=
2331 tevent_req_data(req
,
2332 struct smb_full_audit_get_dos_attributes_state
);
2335 status
= SMB_VFS_NEXT_GET_DOS_ATTRIBUTES_RECV(subreq
,
2338 TALLOC_FREE(subreq
);
2339 if (tevent_req_nterror(req
, status
)) {
2343 tevent_req_done(req
);
2347 static NTSTATUS
smb_full_audit_get_dos_attributes_recv(struct tevent_req
*req
,
2348 struct vfs_aio_state
*aio_state
,
2351 struct smb_full_audit_get_dos_attributes_state
*state
=
2352 tevent_req_data(req
,
2353 struct smb_full_audit_get_dos_attributes_state
);
2356 if (tevent_req_is_nterror(req
, &status
)) {
2357 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV
,
2361 fsp_str_do_log(state
->dir_fsp
),
2362 state
->smb_fname
->base_name
);
2363 tevent_req_received(req
);
2367 do_log(SMB_VFS_OP_GET_DOS_ATTRIBUTES_RECV
,
2371 fsp_str_do_log(state
->dir_fsp
),
2372 state
->smb_fname
->base_name
);
2374 *aio_state
= state
->aio_state
;
2375 *dosmode
= state
->dosmode
;
2376 tevent_req_received(req
);
2377 return NT_STATUS_OK
;
2380 static NTSTATUS
smb_full_audit_fget_dos_attributes(
2381 struct vfs_handle_struct
*handle
,
2382 struct files_struct
*fsp
,
2387 status
= SMB_VFS_NEXT_FGET_DOS_ATTRIBUTES(handle
,
2391 do_log(SMB_VFS_OP_FGET_DOS_ATTRIBUTES
,
2392 NT_STATUS_IS_OK(status
),
2395 fsp_str_do_log(fsp
));
2400 static NTSTATUS
smb_full_audit_set_dos_attributes(
2401 struct vfs_handle_struct
*handle
,
2402 const struct smb_filename
*smb_fname
,
2407 status
= SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle
,
2411 do_log(SMB_VFS_OP_SET_DOS_ATTRIBUTES
,
2412 NT_STATUS_IS_OK(status
),
2415 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2420 static NTSTATUS
smb_full_audit_fset_dos_attributes(
2421 struct vfs_handle_struct
*handle
,
2422 struct files_struct
*fsp
,
2427 status
= SMB_VFS_NEXT_FSET_DOS_ATTRIBUTES(handle
,
2431 do_log(SMB_VFS_OP_FSET_DOS_ATTRIBUTES
,
2432 NT_STATUS_IS_OK(status
),
2435 fsp_str_do_log(fsp
));
2440 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
2441 uint32_t security_info
,
2442 TALLOC_CTX
*mem_ctx
,
2443 struct security_descriptor
**ppdesc
)
2447 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
,
2450 do_log(SMB_VFS_OP_FGET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
2451 "%s", fsp_str_do_log(fsp
));
2456 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
2457 const struct smb_filename
*smb_fname
,
2458 uint32_t security_info
,
2459 TALLOC_CTX
*mem_ctx
,
2460 struct security_descriptor
**ppdesc
)
2464 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, smb_fname
, security_info
,
2467 do_log(SMB_VFS_OP_GET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
2468 "%s", smb_fname_str_do_log(handle
->conn
, smb_fname
));
2473 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
2474 uint32_t security_info_sent
,
2475 const struct security_descriptor
*psd
)
2477 struct vfs_full_audit_private_data
*pd
;
2481 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
2482 struct vfs_full_audit_private_data
,
2483 return NT_STATUS_INTERNAL_ERROR
);
2485 if (pd
->log_secdesc
) {
2486 sd
= sddl_encode(talloc_tos(), psd
, get_global_sam_sid());
2489 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
2491 do_log(SMB_VFS_OP_FSET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
2492 "%s [%s]", fsp_str_do_log(fsp
), sd
? sd
: "");
2499 static NTSTATUS
smb_full_audit_audit_file(struct vfs_handle_struct
*handle
,
2500 struct smb_filename
*file
,
2501 struct security_acl
*sacl
,
2502 uint32_t access_requested
,
2503 uint32_t access_denied
)
2507 result
= SMB_VFS_NEXT_AUDIT_FILE(handle
,
2513 do_log(SMB_VFS_OP_AUDIT_FILE
, NT_STATUS_IS_OK(result
), handle
,
2515 smb_fname_str_do_log(handle
->conn
, file
));
2520 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
2521 const struct smb_filename
*smb_fname
,
2522 SMB_ACL_TYPE_T type
,
2523 TALLOC_CTX
*mem_ctx
)
2527 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, smb_fname
,
2530 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE
,
2534 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2539 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
2540 files_struct
*fsp
, TALLOC_CTX
*mem_ctx
)
2544 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
2546 do_log(SMB_VFS_OP_SYS_ACL_GET_FD
, (result
!= NULL
), handle
,
2547 "%s", fsp_str_do_log(fsp
));
2552 static int smb_full_audit_sys_acl_blob_get_file(vfs_handle_struct
*handle
,
2553 const struct smb_filename
*smb_fname
,
2554 TALLOC_CTX
*mem_ctx
,
2555 char **blob_description
,
2560 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle
, smb_fname
,
2561 mem_ctx
, blob_description
, blob
);
2563 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FILE
,
2567 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2572 static int smb_full_audit_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
2574 TALLOC_CTX
*mem_ctx
,
2575 char **blob_description
,
2580 result
= SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
, blob_description
, blob
);
2582 do_log(SMB_VFS_OP_SYS_ACL_BLOB_GET_FD
, (result
>= 0), handle
,
2583 "%s", fsp_str_do_log(fsp
));
2588 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
2589 const struct smb_filename
*smb_fname
,
2590 SMB_ACL_TYPE_T acltype
,
2595 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, smb_fname
, acltype
,
2598 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE
,
2602 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2607 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
2612 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
2614 do_log(SMB_VFS_OP_SYS_ACL_SET_FD
, (result
>= 0), handle
,
2615 "%s", fsp_str_do_log(fsp
));
2620 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
2621 const struct smb_filename
*smb_fname
)
2625 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, smb_fname
);
2627 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
2631 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2636 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
2637 const struct smb_filename
*smb_fname
,
2638 const char *name
, void *value
, size_t size
)
2642 result
= SMB_VFS_NEXT_GETXATTR(handle
, smb_fname
, name
, value
, size
);
2644 do_log(SMB_VFS_OP_GETXATTR
,
2648 smb_fname_str_do_log(handle
->conn
, smb_fname
),
2654 struct smb_full_audit_getxattrat_state
{
2655 struct vfs_aio_state aio_state
;
2656 vfs_handle_struct
*handle
;
2657 files_struct
*dir_fsp
;
2658 const struct smb_filename
*smb_fname
;
2659 const char *xattr_name
;
2661 uint8_t *xattr_value
;
2664 static void smb_full_audit_getxattrat_done(struct tevent_req
*subreq
);
2666 static struct tevent_req
*smb_full_audit_getxattrat_send(
2667 TALLOC_CTX
*mem_ctx
,
2668 struct tevent_context
*ev
,
2669 struct vfs_handle_struct
*handle
,
2670 files_struct
*dir_fsp
,
2671 const struct smb_filename
*smb_fname
,
2672 const char *xattr_name
,
2675 struct tevent_req
*req
= NULL
;
2676 struct tevent_req
*subreq
= NULL
;
2677 struct smb_full_audit_getxattrat_state
*state
= NULL
;
2679 req
= tevent_req_create(mem_ctx
, &state
,
2680 struct smb_full_audit_getxattrat_state
);
2682 do_log(SMB_VFS_OP_GETXATTRAT_SEND
,
2686 fsp_str_do_log(dir_fsp
),
2687 smb_fname
->base_name
,
2691 *state
= (struct smb_full_audit_getxattrat_state
) {
2694 .smb_fname
= smb_fname
,
2695 .xattr_name
= xattr_name
,
2698 subreq
= SMB_VFS_NEXT_GETXATTRAT_SEND(state
,
2705 if (tevent_req_nomem(subreq
, req
)) {
2706 do_log(SMB_VFS_OP_GETXATTRAT_SEND
,
2710 fsp_str_do_log(dir_fsp
),
2711 smb_fname
->base_name
,
2713 return tevent_req_post(req
, ev
);
2715 tevent_req_set_callback(subreq
, smb_full_audit_getxattrat_done
, req
);
2717 do_log(SMB_VFS_OP_GETXATTRAT_SEND
,
2721 fsp_str_do_log(dir_fsp
),
2722 smb_fname
->base_name
,
2728 static void smb_full_audit_getxattrat_done(struct tevent_req
*subreq
)
2730 struct tevent_req
*req
= tevent_req_callback_data(
2731 subreq
, struct tevent_req
);
2732 struct smb_full_audit_getxattrat_state
*state
= tevent_req_data(
2733 req
, struct smb_full_audit_getxattrat_state
);
2735 state
->xattr_size
= SMB_VFS_NEXT_GETXATTRAT_RECV(subreq
,
2738 &state
->xattr_value
);
2739 TALLOC_FREE(subreq
);
2740 if (state
->xattr_size
== -1) {
2741 tevent_req_error(req
, state
->aio_state
.error
);
2745 tevent_req_done(req
);
2748 static ssize_t
smb_full_audit_getxattrat_recv(struct tevent_req
*req
,
2749 struct vfs_aio_state
*aio_state
,
2750 TALLOC_CTX
*mem_ctx
,
2751 uint8_t **xattr_value
)
2753 struct smb_full_audit_getxattrat_state
*state
= tevent_req_data(
2754 req
, struct smb_full_audit_getxattrat_state
);
2757 if (tevent_req_is_unix_error(req
, &aio_state
->error
)) {
2758 do_log(SMB_VFS_OP_GETXATTRAT_RECV
,
2762 fsp_str_do_log(state
->dir_fsp
),
2763 state
->smb_fname
->base_name
,
2765 tevent_req_received(req
);
2769 do_log(SMB_VFS_OP_GETXATTRAT_RECV
,
2773 fsp_str_do_log(state
->dir_fsp
),
2774 state
->smb_fname
->base_name
,
2777 *aio_state
= state
->aio_state
;
2778 xattr_size
= state
->xattr_size
;
2779 if (xattr_value
!= NULL
) {
2780 *xattr_value
= talloc_move(mem_ctx
, &state
->xattr_value
);
2783 tevent_req_received(req
);
2787 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2788 struct files_struct
*fsp
,
2789 const char *name
, void *value
, size_t size
)
2793 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2795 do_log(SMB_VFS_OP_FGETXATTR
, (result
>= 0), handle
,
2796 "%s|%s", fsp_str_do_log(fsp
), name
);
2801 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
2802 const struct smb_filename
*smb_fname
,
2808 result
= SMB_VFS_NEXT_LISTXATTR(handle
, smb_fname
, list
, size
);
2810 do_log(SMB_VFS_OP_LISTXATTR
,
2814 smb_fname_str_do_log(handle
->conn
, smb_fname
));
2819 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
2820 struct files_struct
*fsp
, char *list
,
2825 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
2827 do_log(SMB_VFS_OP_FLISTXATTR
, (result
>= 0), handle
,
2828 "%s", fsp_str_do_log(fsp
));
2833 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
2834 const struct smb_filename
*smb_fname
,
2839 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, smb_fname
, name
);
2841 do_log(SMB_VFS_OP_REMOVEXATTR
,
2845 smb_fname_str_do_log(handle
->conn
, smb_fname
),
2851 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2852 struct files_struct
*fsp
,
2857 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2859 do_log(SMB_VFS_OP_FREMOVEXATTR
, (result
>= 0), handle
,
2860 "%s|%s", fsp_str_do_log(fsp
), name
);
2865 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
2866 const struct smb_filename
*smb_fname
,
2867 const char *name
, const void *value
, size_t size
,
2872 result
= SMB_VFS_NEXT_SETXATTR(handle
, smb_fname
, name
, value
, size
,
2875 do_log(SMB_VFS_OP_SETXATTR
,
2879 smb_fname_str_do_log(handle
->conn
, smb_fname
),
2885 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2886 struct files_struct
*fsp
, const char *name
,
2887 const void *value
, size_t size
, int flags
)
2891 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2893 do_log(SMB_VFS_OP_FSETXATTR
, (result
>= 0), handle
,
2894 "%s|%s", fsp_str_do_log(fsp
), name
);
2899 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
2900 struct files_struct
*fsp
)
2904 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2905 do_log(SMB_VFS_OP_AIO_FORCE
, result
, handle
,
2906 "%s", fsp_str_do_log(fsp
));
2911 static NTSTATUS
smb_full_audit_durable_cookie(struct vfs_handle_struct
*handle
,
2912 struct files_struct
*fsp
,
2913 TALLOC_CTX
*mem_ctx
,
2918 result
= SMB_VFS_NEXT_DURABLE_COOKIE(handle
,
2923 do_log(SMB_VFS_OP_DURABLE_COOKIE
, NT_STATUS_IS_OK(result
), handle
,
2924 "%s", fsp_str_do_log(fsp
));
2929 static NTSTATUS
smb_full_audit_durable_disconnect(
2930 struct vfs_handle_struct
*handle
,
2931 struct files_struct
*fsp
,
2932 const DATA_BLOB old_cookie
,
2933 TALLOC_CTX
*mem_ctx
,
2934 DATA_BLOB
*new_cookie
)
2938 result
= SMB_VFS_NEXT_DURABLE_DISCONNECT(handle
,
2944 do_log(SMB_VFS_OP_DURABLE_DISCONNECT
, NT_STATUS_IS_OK(result
), handle
,
2945 "%s", fsp_str_do_log(fsp
));
2950 static NTSTATUS
smb_full_audit_durable_reconnect(
2951 struct vfs_handle_struct
*handle
,
2952 struct smb_request
*smb1req
,
2953 struct smbXsrv_open
*op
,
2954 const DATA_BLOB old_cookie
,
2955 TALLOC_CTX
*mem_ctx
,
2956 struct files_struct
**fsp
,
2957 DATA_BLOB
*new_cookie
)
2961 result
= SMB_VFS_NEXT_DURABLE_RECONNECT(handle
,
2969 do_log(SMB_VFS_OP_DURABLE_RECONNECT
,
2970 NT_STATUS_IS_OK(result
),
2977 static struct vfs_fn_pointers vfs_full_audit_fns
= {
2979 /* Disk operations */
2981 .connect_fn
= smb_full_audit_connect
,
2982 .disconnect_fn
= smb_full_audit_disconnect
,
2983 .disk_free_fn
= smb_full_audit_disk_free
,
2984 .get_quota_fn
= smb_full_audit_get_quota
,
2985 .set_quota_fn
= smb_full_audit_set_quota
,
2986 .get_shadow_copy_data_fn
= smb_full_audit_get_shadow_copy_data
,
2987 .statvfs_fn
= smb_full_audit_statvfs
,
2988 .fs_capabilities_fn
= smb_full_audit_fs_capabilities
,
2989 .get_dfs_referrals_fn
= smb_full_audit_get_dfs_referrals
,
2990 .create_dfs_pathat_fn
= smb_full_audit_create_dfs_pathat
,
2991 .read_dfs_pathat_fn
= smb_full_audit_read_dfs_pathat
,
2992 .opendir_fn
= smb_full_audit_opendir
,
2993 .fdopendir_fn
= smb_full_audit_fdopendir
,
2994 .readdir_fn
= smb_full_audit_readdir
,
2995 .seekdir_fn
= smb_full_audit_seekdir
,
2996 .telldir_fn
= smb_full_audit_telldir
,
2997 .rewind_dir_fn
= smb_full_audit_rewinddir
,
2998 .mkdirat_fn
= smb_full_audit_mkdirat
,
2999 .closedir_fn
= smb_full_audit_closedir
,
3000 .open_fn
= smb_full_audit_open
,
3001 .create_file_fn
= smb_full_audit_create_file
,
3002 .close_fn
= smb_full_audit_close
,
3003 .pread_fn
= smb_full_audit_pread
,
3004 .pread_send_fn
= smb_full_audit_pread_send
,
3005 .pread_recv_fn
= smb_full_audit_pread_recv
,
3006 .pwrite_fn
= smb_full_audit_pwrite
,
3007 .pwrite_send_fn
= smb_full_audit_pwrite_send
,
3008 .pwrite_recv_fn
= smb_full_audit_pwrite_recv
,
3009 .lseek_fn
= smb_full_audit_lseek
,
3010 .sendfile_fn
= smb_full_audit_sendfile
,
3011 .recvfile_fn
= smb_full_audit_recvfile
,
3012 .renameat_fn
= smb_full_audit_renameat
,
3013 .fsync_send_fn
= smb_full_audit_fsync_send
,
3014 .fsync_recv_fn
= smb_full_audit_fsync_recv
,
3015 .stat_fn
= smb_full_audit_stat
,
3016 .fstat_fn
= smb_full_audit_fstat
,
3017 .lstat_fn
= smb_full_audit_lstat
,
3018 .get_alloc_size_fn
= smb_full_audit_get_alloc_size
,
3019 .unlinkat_fn
= smb_full_audit_unlinkat
,
3020 .chmod_fn
= smb_full_audit_chmod
,
3021 .fchmod_fn
= smb_full_audit_fchmod
,
3022 .fchown_fn
= smb_full_audit_fchown
,
3023 .lchown_fn
= smb_full_audit_lchown
,
3024 .chdir_fn
= smb_full_audit_chdir
,
3025 .getwd_fn
= smb_full_audit_getwd
,
3026 .ntimes_fn
= smb_full_audit_ntimes
,
3027 .ftruncate_fn
= smb_full_audit_ftruncate
,
3028 .fallocate_fn
= smb_full_audit_fallocate
,
3029 .lock_fn
= smb_full_audit_lock
,
3030 .kernel_flock_fn
= smb_full_audit_kernel_flock
,
3031 .fcntl_fn
= smb_full_audit_fcntl
,
3032 .linux_setlease_fn
= smb_full_audit_linux_setlease
,
3033 .getlock_fn
= smb_full_audit_getlock
,
3034 .symlinkat_fn
= smb_full_audit_symlinkat
,
3035 .readlinkat_fn
= smb_full_audit_readlinkat
,
3036 .linkat_fn
= smb_full_audit_linkat
,
3037 .mknodat_fn
= smb_full_audit_mknodat
,
3038 .realpath_fn
= smb_full_audit_realpath
,
3039 .chflags_fn
= smb_full_audit_chflags
,
3040 .file_id_create_fn
= smb_full_audit_file_id_create
,
3041 .fs_file_id_fn
= smb_full_audit_fs_file_id
,
3042 .offload_read_send_fn
= smb_full_audit_offload_read_send
,
3043 .offload_read_recv_fn
= smb_full_audit_offload_read_recv
,
3044 .offload_write_send_fn
= smb_full_audit_offload_write_send
,
3045 .offload_write_recv_fn
= smb_full_audit_offload_write_recv
,
3046 .get_compression_fn
= smb_full_audit_get_compression
,
3047 .set_compression_fn
= smb_full_audit_set_compression
,
3048 .snap_check_path_fn
= smb_full_audit_snap_check_path
,
3049 .snap_create_fn
= smb_full_audit_snap_create
,
3050 .snap_delete_fn
= smb_full_audit_snap_delete
,
3051 .streaminfo_fn
= smb_full_audit_streaminfo
,
3052 .get_real_filename_fn
= smb_full_audit_get_real_filename
,
3053 .connectpath_fn
= smb_full_audit_connectpath
,
3054 .brl_lock_windows_fn
= smb_full_audit_brl_lock_windows
,
3055 .brl_unlock_windows_fn
= smb_full_audit_brl_unlock_windows
,
3056 .strict_lock_check_fn
= smb_full_audit_strict_lock_check
,
3057 .translate_name_fn
= smb_full_audit_translate_name
,
3058 .fsctl_fn
= smb_full_audit_fsctl
,
3059 .get_dos_attributes_fn
= smb_full_audit_get_dos_attributes
,
3060 .get_dos_attributes_send_fn
= smb_full_audit_get_dos_attributes_send
,
3061 .get_dos_attributes_recv_fn
= smb_full_audit_get_dos_attributes_recv
,
3062 .fget_dos_attributes_fn
= smb_full_audit_fget_dos_attributes
,
3063 .set_dos_attributes_fn
= smb_full_audit_set_dos_attributes
,
3064 .fset_dos_attributes_fn
= smb_full_audit_fset_dos_attributes
,
3065 .fget_nt_acl_fn
= smb_full_audit_fget_nt_acl
,
3066 .get_nt_acl_fn
= smb_full_audit_get_nt_acl
,
3067 .fset_nt_acl_fn
= smb_full_audit_fset_nt_acl
,
3068 .audit_file_fn
= smb_full_audit_audit_file
,
3069 .sys_acl_get_file_fn
= smb_full_audit_sys_acl_get_file
,
3070 .sys_acl_get_fd_fn
= smb_full_audit_sys_acl_get_fd
,
3071 .sys_acl_blob_get_file_fn
= smb_full_audit_sys_acl_blob_get_file
,
3072 .sys_acl_blob_get_fd_fn
= smb_full_audit_sys_acl_blob_get_fd
,
3073 .sys_acl_set_file_fn
= smb_full_audit_sys_acl_set_file
,
3074 .sys_acl_set_fd_fn
= smb_full_audit_sys_acl_set_fd
,
3075 .sys_acl_delete_def_file_fn
= smb_full_audit_sys_acl_delete_def_file
,
3076 .getxattr_fn
= smb_full_audit_getxattr
,
3077 .getxattrat_send_fn
= smb_full_audit_getxattrat_send
,
3078 .getxattrat_recv_fn
= smb_full_audit_getxattrat_recv
,
3079 .fgetxattr_fn
= smb_full_audit_fgetxattr
,
3080 .listxattr_fn
= smb_full_audit_listxattr
,
3081 .flistxattr_fn
= smb_full_audit_flistxattr
,
3082 .removexattr_fn
= smb_full_audit_removexattr
,
3083 .fremovexattr_fn
= smb_full_audit_fremovexattr
,
3084 .setxattr_fn
= smb_full_audit_setxattr
,
3085 .fsetxattr_fn
= smb_full_audit_fsetxattr
,
3086 .aio_force_fn
= smb_full_audit_aio_force
,
3087 .durable_cookie_fn
= smb_full_audit_durable_cookie
,
3088 .durable_disconnect_fn
= smb_full_audit_durable_disconnect
,
3089 .durable_reconnect_fn
= smb_full_audit_durable_reconnect
,
3090 .readdir_attr_fn
= smb_full_audit_readdir_attr
3095 NTSTATUS
vfs_full_audit_init(TALLOC_CTX
*ctx
)
3099 smb_vfs_assert_all_fns(&vfs_full_audit_fns
, "full_audit");
3101 ret
= smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "full_audit",
3102 &vfs_full_audit_fns
);
3104 if (!NT_STATUS_IS_OK(ret
))
3107 vfs_full_audit_debug_level
= debug_add_class("full_audit");
3108 if (vfs_full_audit_debug_level
== -1) {
3109 vfs_full_audit_debug_level
= DBGC_VFS
;
3110 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
3113 DEBUG(10, ("vfs_full_audit: Debug class number of "
3114 "'full_audit': %d\n", vfs_full_audit_debug_level
));