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"
71 static int vfs_full_audit_debug_level
= DBGC_VFS
;
73 struct vfs_full_audit_private_data
{
74 struct bitmap
*success_ops
;
75 struct bitmap
*failure_ops
;
79 #define DBGC_CLASS vfs_full_audit_debug_level
81 typedef enum _vfs_op_type
{
86 SMB_VFS_OP_CONNECT
= 0,
87 SMB_VFS_OP_DISCONNECT
,
91 SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
93 SMB_VFS_OP_FS_CAPABILITIES
,
95 /* Directory operations */
102 SMB_VFS_OP_REWINDDIR
,
106 SMB_VFS_OP_INIT_SEARCH_OP
,
108 /* File operations */
111 SMB_VFS_OP_CREATE_FILE
,
115 SMB_VFS_OP_PREAD_SEND
,
116 SMB_VFS_OP_PREAD_RECV
,
127 SMB_VFS_OP_GET_ALLOC_SIZE
,
137 SMB_VFS_OP_FTRUNCATE
,
138 SMB_VFS_OP_FALLOCATE
,
140 SMB_VFS_OP_KERNEL_FLOCK
,
141 SMB_VFS_OP_LINUX_SETLEASE
,
148 SMB_VFS_OP_NOTIFY_WATCH
,
150 SMB_VFS_OP_FILE_ID_CREATE
,
151 SMB_VFS_OP_STREAMINFO
,
152 SMB_VFS_OP_GET_REAL_FILENAME
,
153 SMB_VFS_OP_CONNECTPATH
,
154 SMB_VFS_OP_BRL_LOCK_WINDOWS
,
155 SMB_VFS_OP_BRL_UNLOCK_WINDOWS
,
156 SMB_VFS_OP_BRL_CANCEL_WINDOWS
,
157 SMB_VFS_OP_STRICT_LOCK
,
158 SMB_VFS_OP_STRICT_UNLOCK
,
159 SMB_VFS_OP_TRANSLATE_NAME
,
161 /* NT ACL operations. */
163 SMB_VFS_OP_FGET_NT_ACL
,
164 SMB_VFS_OP_GET_NT_ACL
,
165 SMB_VFS_OP_FSET_NT_ACL
,
167 /* POSIX ACL operations. */
169 SMB_VFS_OP_CHMOD_ACL
,
170 SMB_VFS_OP_FCHMOD_ACL
,
172 SMB_VFS_OP_SYS_ACL_GET_ENTRY
,
173 SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
,
174 SMB_VFS_OP_SYS_ACL_GET_PERMSET
,
175 SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
,
176 SMB_VFS_OP_SYS_ACL_GET_FILE
,
177 SMB_VFS_OP_SYS_ACL_GET_FD
,
178 SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
,
179 SMB_VFS_OP_SYS_ACL_ADD_PERM
,
180 SMB_VFS_OP_SYS_ACL_TO_TEXT
,
181 SMB_VFS_OP_SYS_ACL_INIT
,
182 SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
,
183 SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
,
184 SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
,
185 SMB_VFS_OP_SYS_ACL_SET_PERMSET
,
186 SMB_VFS_OP_SYS_ACL_VALID
,
187 SMB_VFS_OP_SYS_ACL_SET_FILE
,
188 SMB_VFS_OP_SYS_ACL_SET_FD
,
189 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
190 SMB_VFS_OP_SYS_ACL_GET_PERM
,
191 SMB_VFS_OP_SYS_ACL_FREE_TEXT
,
192 SMB_VFS_OP_SYS_ACL_FREE_ACL
,
193 SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
,
197 SMB_VFS_OP_FGETXATTR
,
198 SMB_VFS_OP_LISTXATTR
,
199 SMB_VFS_OP_FLISTXATTR
,
200 SMB_VFS_OP_REMOVEXATTR
,
201 SMB_VFS_OP_FREMOVEXATTR
,
203 SMB_VFS_OP_FSETXATTR
,
207 SMB_VFS_OP_AIO_WRITE
,
208 SMB_VFS_OP_AIO_RETURN
,
209 SMB_VFS_OP_AIO_CANCEL
,
210 SMB_VFS_OP_AIO_ERROR
,
211 SMB_VFS_OP_AIO_FSYNC
,
212 SMB_VFS_OP_AIO_SUSPEND
,
213 SMB_VFS_OP_AIO_FORCE
,
215 /* offline operations */
216 SMB_VFS_OP_IS_OFFLINE
,
217 SMB_VFS_OP_SET_OFFLINE
,
219 /* This should always be last enum value */
224 /* The following array *must* be in the same order as defined in vfs.h */
230 { SMB_VFS_OP_CONNECT
, "connect" },
231 { SMB_VFS_OP_DISCONNECT
, "disconnect" },
232 { SMB_VFS_OP_DISK_FREE
, "disk_free" },
233 { SMB_VFS_OP_GET_QUOTA
, "get_quota" },
234 { SMB_VFS_OP_SET_QUOTA
, "set_quota" },
235 { SMB_VFS_OP_GET_SHADOW_COPY_DATA
, "get_shadow_copy_data" },
236 { SMB_VFS_OP_STATVFS
, "statvfs" },
237 { SMB_VFS_OP_FS_CAPABILITIES
, "fs_capabilities" },
238 { SMB_VFS_OP_OPENDIR
, "opendir" },
239 { SMB_VFS_OP_FDOPENDIR
, "fdopendir" },
240 { SMB_VFS_OP_READDIR
, "readdir" },
241 { SMB_VFS_OP_SEEKDIR
, "seekdir" },
242 { SMB_VFS_OP_TELLDIR
, "telldir" },
243 { SMB_VFS_OP_REWINDDIR
, "rewinddir" },
244 { SMB_VFS_OP_MKDIR
, "mkdir" },
245 { SMB_VFS_OP_RMDIR
, "rmdir" },
246 { SMB_VFS_OP_CLOSEDIR
, "closedir" },
247 { SMB_VFS_OP_INIT_SEARCH_OP
, "init_search_op" },
248 { SMB_VFS_OP_OPEN
, "open" },
249 { SMB_VFS_OP_CREATE_FILE
, "create_file" },
250 { SMB_VFS_OP_CLOSE
, "close" },
251 { SMB_VFS_OP_READ
, "read" },
252 { SMB_VFS_OP_PREAD
, "pread" },
253 { SMB_VFS_OP_PREAD_SEND
, "pread_send" },
254 { SMB_VFS_OP_PREAD_RECV
, "pread_recv" },
255 { SMB_VFS_OP_WRITE
, "write" },
256 { SMB_VFS_OP_PWRITE
, "pwrite" },
257 { SMB_VFS_OP_LSEEK
, "lseek" },
258 { SMB_VFS_OP_SENDFILE
, "sendfile" },
259 { SMB_VFS_OP_RECVFILE
, "recvfile" },
260 { SMB_VFS_OP_RENAME
, "rename" },
261 { SMB_VFS_OP_FSYNC
, "fsync" },
262 { SMB_VFS_OP_STAT
, "stat" },
263 { SMB_VFS_OP_FSTAT
, "fstat" },
264 { SMB_VFS_OP_LSTAT
, "lstat" },
265 { SMB_VFS_OP_GET_ALLOC_SIZE
, "get_alloc_size" },
266 { SMB_VFS_OP_UNLINK
, "unlink" },
267 { SMB_VFS_OP_CHMOD
, "chmod" },
268 { SMB_VFS_OP_FCHMOD
, "fchmod" },
269 { SMB_VFS_OP_CHOWN
, "chown" },
270 { SMB_VFS_OP_FCHOWN
, "fchown" },
271 { SMB_VFS_OP_LCHOWN
, "lchown" },
272 { SMB_VFS_OP_CHDIR
, "chdir" },
273 { SMB_VFS_OP_GETWD
, "getwd" },
274 { SMB_VFS_OP_NTIMES
, "ntimes" },
275 { SMB_VFS_OP_FTRUNCATE
, "ftruncate" },
276 { SMB_VFS_OP_FALLOCATE
,"fallocate" },
277 { SMB_VFS_OP_LOCK
, "lock" },
278 { SMB_VFS_OP_KERNEL_FLOCK
, "kernel_flock" },
279 { SMB_VFS_OP_LINUX_SETLEASE
, "linux_setlease" },
280 { SMB_VFS_OP_GETLOCK
, "getlock" },
281 { SMB_VFS_OP_SYMLINK
, "symlink" },
282 { SMB_VFS_OP_READLINK
, "readlink" },
283 { SMB_VFS_OP_LINK
, "link" },
284 { SMB_VFS_OP_MKNOD
, "mknod" },
285 { SMB_VFS_OP_REALPATH
, "realpath" },
286 { SMB_VFS_OP_NOTIFY_WATCH
, "notify_watch" },
287 { SMB_VFS_OP_CHFLAGS
, "chflags" },
288 { SMB_VFS_OP_FILE_ID_CREATE
, "file_id_create" },
289 { SMB_VFS_OP_STREAMINFO
, "streaminfo" },
290 { SMB_VFS_OP_GET_REAL_FILENAME
, "get_real_filename" },
291 { SMB_VFS_OP_CONNECTPATH
, "connectpath" },
292 { SMB_VFS_OP_BRL_LOCK_WINDOWS
, "brl_lock_windows" },
293 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, "brl_unlock_windows" },
294 { SMB_VFS_OP_BRL_CANCEL_WINDOWS
, "brl_cancel_windows" },
295 { SMB_VFS_OP_STRICT_LOCK
, "strict_lock" },
296 { SMB_VFS_OP_STRICT_UNLOCK
, "strict_unlock" },
297 { SMB_VFS_OP_TRANSLATE_NAME
, "translate_name" },
298 { SMB_VFS_OP_FGET_NT_ACL
, "fget_nt_acl" },
299 { SMB_VFS_OP_GET_NT_ACL
, "get_nt_acl" },
300 { SMB_VFS_OP_FSET_NT_ACL
, "fset_nt_acl" },
301 { SMB_VFS_OP_CHMOD_ACL
, "chmod_acl" },
302 { SMB_VFS_OP_FCHMOD_ACL
, "fchmod_acl" },
303 { SMB_VFS_OP_SYS_ACL_GET_ENTRY
, "sys_acl_get_entry" },
304 { SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, "sys_acl_get_tag_type" },
305 { SMB_VFS_OP_SYS_ACL_GET_PERMSET
, "sys_acl_get_permset" },
306 { SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, "sys_acl_get_qualifier" },
307 { SMB_VFS_OP_SYS_ACL_GET_FILE
, "sys_acl_get_file" },
308 { SMB_VFS_OP_SYS_ACL_GET_FD
, "sys_acl_get_fd" },
309 { SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, "sys_acl_clear_perms" },
310 { SMB_VFS_OP_SYS_ACL_ADD_PERM
, "sys_acl_add_perm" },
311 { SMB_VFS_OP_SYS_ACL_TO_TEXT
, "sys_acl_to_text" },
312 { SMB_VFS_OP_SYS_ACL_INIT
, "sys_acl_init" },
313 { SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, "sys_acl_create_entry" },
314 { SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, "sys_acl_set_tag_type" },
315 { SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, "sys_acl_set_qualifier" },
316 { SMB_VFS_OP_SYS_ACL_SET_PERMSET
, "sys_acl_set_permset" },
317 { SMB_VFS_OP_SYS_ACL_VALID
, "sys_acl_valid" },
318 { SMB_VFS_OP_SYS_ACL_SET_FILE
, "sys_acl_set_file" },
319 { SMB_VFS_OP_SYS_ACL_SET_FD
, "sys_acl_set_fd" },
320 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, "sys_acl_delete_def_file" },
321 { SMB_VFS_OP_SYS_ACL_GET_PERM
, "sys_acl_get_perm" },
322 { SMB_VFS_OP_SYS_ACL_FREE_TEXT
, "sys_acl_free_text" },
323 { SMB_VFS_OP_SYS_ACL_FREE_ACL
, "sys_acl_free_acl" },
324 { SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, "sys_acl_free_qualifier" },
325 { SMB_VFS_OP_GETXATTR
, "getxattr" },
326 { SMB_VFS_OP_FGETXATTR
, "fgetxattr" },
327 { SMB_VFS_OP_LISTXATTR
, "listxattr" },
328 { SMB_VFS_OP_FLISTXATTR
, "flistxattr" },
329 { SMB_VFS_OP_REMOVEXATTR
, "removexattr" },
330 { SMB_VFS_OP_FREMOVEXATTR
, "fremovexattr" },
331 { SMB_VFS_OP_SETXATTR
, "setxattr" },
332 { SMB_VFS_OP_FSETXATTR
, "fsetxattr" },
333 { SMB_VFS_OP_AIO_READ
, "aio_read" },
334 { SMB_VFS_OP_AIO_WRITE
, "aio_write" },
335 { SMB_VFS_OP_AIO_RETURN
,"aio_return" },
336 { SMB_VFS_OP_AIO_CANCEL
,"aio_cancel" },
337 { SMB_VFS_OP_AIO_ERROR
, "aio_error" },
338 { SMB_VFS_OP_AIO_FSYNC
, "aio_fsync" },
339 { SMB_VFS_OP_AIO_SUSPEND
,"aio_suspend" },
340 { SMB_VFS_OP_AIO_FORCE
, "aio_force" },
341 { SMB_VFS_OP_IS_OFFLINE
, "is_offline" },
342 { SMB_VFS_OP_SET_OFFLINE
, "set_offline" },
343 { SMB_VFS_OP_LAST
, NULL
}
346 static int audit_syslog_facility(vfs_handle_struct
*handle
)
348 static const struct enum_list enum_log_facilities
[] = {
349 { LOG_USER
, "USER" },
350 { LOG_LOCAL0
, "LOCAL0" },
351 { LOG_LOCAL1
, "LOCAL1" },
352 { LOG_LOCAL2
, "LOCAL2" },
353 { LOG_LOCAL3
, "LOCAL3" },
354 { LOG_LOCAL4
, "LOCAL4" },
355 { LOG_LOCAL5
, "LOCAL5" },
356 { LOG_LOCAL6
, "LOCAL6" },
357 { LOG_LOCAL7
, "LOCAL7" },
363 facility
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "facility", enum_log_facilities
, LOG_USER
);
368 static int audit_syslog_priority(vfs_handle_struct
*handle
)
370 static const struct enum_list enum_log_priorities
[] = {
371 { LOG_EMERG
, "EMERG" },
372 { LOG_ALERT
, "ALERT" },
373 { LOG_CRIT
, "CRIT" },
375 { LOG_WARNING
, "WARNING" },
376 { LOG_NOTICE
, "NOTICE" },
377 { LOG_INFO
, "INFO" },
378 { LOG_DEBUG
, "DEBUG" },
384 priority
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "priority",
385 enum_log_priorities
, LOG_NOTICE
);
386 if (priority
== -1) {
387 priority
= LOG_WARNING
;
393 static char *audit_prefix(TALLOC_CTX
*ctx
, connection_struct
*conn
)
398 prefix
= talloc_strdup(ctx
,
399 lp_parm_const_string(SNUM(conn
), "full_audit",
404 result
= talloc_sub_advanced(ctx
,
405 lp_servicename(talloc_tos(), SNUM(conn
)),
406 conn
->session_info
->unix_info
->unix_name
,
408 conn
->session_info
->unix_token
->gid
,
409 conn
->session_info
->unix_info
->sanitized_username
,
410 conn
->session_info
->info
->domain_name
,
416 static bool log_success(vfs_handle_struct
*handle
, vfs_op_type op
)
418 struct vfs_full_audit_private_data
*pd
= NULL
;
420 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
421 struct vfs_full_audit_private_data
,
424 if (pd
->success_ops
== NULL
) {
428 return bitmap_query(pd
->success_ops
, op
);
431 static bool log_failure(vfs_handle_struct
*handle
, vfs_op_type op
)
433 struct vfs_full_audit_private_data
*pd
= NULL
;
435 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
436 struct vfs_full_audit_private_data
,
439 if (pd
->failure_ops
== NULL
)
442 return bitmap_query(pd
->failure_ops
, op
);
445 static struct bitmap
*init_bitmap(TALLOC_CTX
*mem_ctx
, const char **ops
)
453 bm
= bitmap_talloc(mem_ctx
, SMB_VFS_OP_LAST
);
455 DEBUG(0, ("Could not alloc bitmap -- "
456 "defaulting to logging everything\n"));
460 for (; *ops
!= NULL
; ops
+= 1) {
465 if (strequal(*ops
, "all")) {
466 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
472 if (strequal(*ops
, "none")) {
482 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
483 if (vfs_op_names
[i
].name
== NULL
) {
484 smb_panic("vfs_full_audit.c: name table not "
485 "in sync with vfs.h\n");
487 if (strequal(op
, vfs_op_names
[i
].name
)) {
496 if (i
== SMB_VFS_OP_LAST
) {
497 DEBUG(0, ("Could not find opname %s, logging all\n",
506 static const char *audit_opname(vfs_op_type op
)
508 if (op
>= SMB_VFS_OP_LAST
)
509 return "INVALID VFS OP";
510 return vfs_op_names
[op
].name
;
513 static TALLOC_CTX
*tmp_do_log_ctx
;
515 * Get us a temporary talloc context usable just for DEBUG arguments
517 static TALLOC_CTX
*do_log_ctx(void)
519 if (tmp_do_log_ctx
== NULL
) {
520 tmp_do_log_ctx
= talloc_named_const(NULL
, 0, "do_log_ctx");
522 return tmp_do_log_ctx
;
525 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
526 const char *format
, ...)
529 char *audit_pre
= NULL
;
534 if (success
&& (!log_success(handle
, op
)))
537 if (!success
&& (!log_failure(handle
, op
)))
541 fstrcpy(err_msg
, "ok");
543 fstr_sprintf(err_msg
, "fail (%s)", strerror(errno
));
545 va_start(ap
, format
);
546 op_msg
= talloc_vasprintf(talloc_tos(), format
, ap
);
554 * Specify the facility to interoperate with other syslog callers
555 * (smbd for example).
557 priority
= audit_syslog_priority(handle
) |
558 audit_syslog_facility(handle
);
560 audit_pre
= audit_prefix(talloc_tos(), handle
->conn
);
561 syslog(priority
, "%s|%s|%s|%s\n",
562 audit_pre
? audit_pre
: "",
563 audit_opname(op
), err_msg
, op_msg
);
566 TALLOC_FREE(audit_pre
);
568 TALLOC_FREE(tmp_do_log_ctx
);
574 * Return a string using the do_log_ctx()
576 static const char *smb_fname_str_do_log(const struct smb_filename
*smb_fname
)
581 if (smb_fname
== NULL
) {
584 status
= get_full_smb_filename(do_log_ctx(), smb_fname
, &fname
);
585 if (!NT_STATUS_IS_OK(status
)) {
592 * Return an fsp debug string using the do_log_ctx()
594 static const char *fsp_str_do_log(const struct files_struct
*fsp
)
596 return smb_fname_str_do_log(fsp
->fsp_name
);
599 /* Implementation of vfs_ops. Pass everything on to the default
600 operation but log event first. */
602 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
603 const char *svc
, const char *user
)
606 struct vfs_full_audit_private_data
*pd
= NULL
;
608 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
613 pd
= talloc_zero(handle
, struct vfs_full_audit_private_data
);
615 SMB_VFS_NEXT_DISCONNECT(handle
);
620 openlog("smbd_audit", 0, audit_syslog_facility(handle
));
623 pd
->success_ops
= init_bitmap(
624 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
626 pd
->failure_ops
= init_bitmap(
627 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
630 /* Store the private data. */
631 SMB_VFS_HANDLE_SET_DATA(handle
, pd
, NULL
,
632 struct vfs_full_audit_private_data
, return -1);
634 do_log(SMB_VFS_OP_CONNECT
, True
, handle
,
640 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
)
642 SMB_VFS_NEXT_DISCONNECT(handle
);
644 do_log(SMB_VFS_OP_DISCONNECT
, True
, handle
,
645 "%s", lp_servicename(talloc_tos(), SNUM(handle
->conn
)));
647 /* The bitmaps will be disconnected when the private
653 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
655 bool small_query
, uint64_t *bsize
,
656 uint64_t *dfree
, uint64_t *dsize
)
660 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
663 /* Don't have a reasonable notion of failure here */
665 do_log(SMB_VFS_OP_DISK_FREE
, True
, handle
, "%s", path
);
670 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
671 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
676 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
678 do_log(SMB_VFS_OP_GET_QUOTA
, (result
>= 0), handle
, "");
684 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
685 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
690 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
692 do_log(SMB_VFS_OP_SET_QUOTA
, (result
>= 0), handle
, "");
697 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
698 struct files_struct
*fsp
,
699 struct shadow_copy_data
*shadow_copy_data
,
704 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
, labels
);
706 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA
, (result
>= 0), handle
, "");
711 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
713 struct vfs_statvfs_struct
*statbuf
)
717 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
719 do_log(SMB_VFS_OP_STATVFS
, (result
>= 0), handle
, "");
724 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
, enum timestamp_set_resolution
*p_ts_res
)
728 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
730 do_log(SMB_VFS_OP_FS_CAPABILITIES
, true, handle
, "");
735 static DIR *smb_full_audit_opendir(vfs_handle_struct
*handle
,
736 const char *fname
, const char *mask
, uint32 attr
)
740 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
742 do_log(SMB_VFS_OP_OPENDIR
, (result
!= NULL
), handle
, "%s", fname
);
747 static DIR *smb_full_audit_fdopendir(vfs_handle_struct
*handle
,
748 files_struct
*fsp
, const char *mask
, uint32 attr
)
752 result
= SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
754 do_log(SMB_VFS_OP_FDOPENDIR
, (result
!= NULL
), handle
, "%s",
755 fsp_str_do_log(fsp
));
760 static struct dirent
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
761 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
763 struct dirent
*result
;
765 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
767 /* This operation has no reasonable error condition
768 * (End of dir is also failure), so always succeed.
770 do_log(SMB_VFS_OP_READDIR
, True
, handle
, "");
775 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
776 DIR *dirp
, long offset
)
778 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
780 do_log(SMB_VFS_OP_SEEKDIR
, True
, handle
, "");
784 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
789 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
791 do_log(SMB_VFS_OP_TELLDIR
, True
, handle
, "");
796 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
799 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
801 do_log(SMB_VFS_OP_REWINDDIR
, True
, handle
, "");
805 static int smb_full_audit_mkdir(vfs_handle_struct
*handle
,
806 const char *path
, mode_t mode
)
810 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
812 do_log(SMB_VFS_OP_MKDIR
, (result
>= 0), handle
, "%s", path
);
817 static int smb_full_audit_rmdir(vfs_handle_struct
*handle
,
822 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
824 do_log(SMB_VFS_OP_RMDIR
, (result
>= 0), handle
, "%s", path
);
829 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
834 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
836 do_log(SMB_VFS_OP_CLOSEDIR
, (result
>= 0), handle
, "");
841 static void smb_full_audit_init_search_op(vfs_handle_struct
*handle
,
844 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
846 do_log(SMB_VFS_OP_INIT_SEARCH_OP
, True
, handle
, "");
850 static int smb_full_audit_open(vfs_handle_struct
*handle
,
851 struct smb_filename
*smb_fname
,
852 files_struct
*fsp
, int flags
, mode_t mode
)
856 result
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
858 do_log(SMB_VFS_OP_OPEN
, (result
>= 0), handle
, "%s|%s",
859 ((flags
& O_WRONLY
) || (flags
& O_RDWR
))?"w":"r",
860 smb_fname_str_do_log(smb_fname
));
865 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
866 struct smb_request
*req
,
867 uint16_t root_dir_fid
,
868 struct smb_filename
*smb_fname
,
869 uint32_t access_mask
,
870 uint32_t share_access
,
871 uint32_t create_disposition
,
872 uint32_t create_options
,
873 uint32_t file_attributes
,
874 uint32_t oplock_request
,
875 uint64_t allocation_size
,
876 uint32_t private_flags
,
877 struct security_descriptor
*sd
,
878 struct ea_list
*ea_list
,
879 files_struct
**result_fsp
,
883 const char* str_create_disposition
;
885 switch (create_disposition
) {
887 str_create_disposition
= "supersede";
889 case FILE_OVERWRITE_IF
:
890 str_create_disposition
= "overwrite_if";
893 str_create_disposition
= "open";
896 str_create_disposition
= "overwrite";
899 str_create_disposition
= "create";
902 str_create_disposition
= "open_if";
905 str_create_disposition
= "unknown";
908 result
= SMB_VFS_NEXT_CREATE_FILE(
911 root_dir_fid
, /* root_dir_fid */
912 smb_fname
, /* fname */
913 access_mask
, /* access_mask */
914 share_access
, /* share_access */
915 create_disposition
, /* create_disposition*/
916 create_options
, /* create_options */
917 file_attributes
, /* file_attributes */
918 oplock_request
, /* oplock_request */
919 allocation_size
, /* allocation_size */
922 ea_list
, /* ea_list */
923 result_fsp
, /* result */
926 do_log(SMB_VFS_OP_CREATE_FILE
, (NT_STATUS_IS_OK(result
)), handle
,
927 "0x%x|%s|%s|%s", access_mask
,
928 create_options
& FILE_DIRECTORY_FILE
? "dir" : "file",
929 str_create_disposition
, smb_fname_str_do_log(smb_fname
));
934 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
938 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
940 do_log(SMB_VFS_OP_CLOSE
, (result
>= 0), handle
, "%s",
941 fsp_str_do_log(fsp
));
946 static ssize_t
smb_full_audit_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
947 void *data
, size_t n
)
951 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
953 do_log(SMB_VFS_OP_READ
, (result
>= 0), handle
, "%s",
954 fsp_str_do_log(fsp
));
959 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
960 void *data
, size_t n
, off_t offset
)
964 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
966 do_log(SMB_VFS_OP_PREAD
, (result
>= 0), handle
, "%s",
967 fsp_str_do_log(fsp
));
972 struct smb_full_audit_pread_state
{
973 vfs_handle_struct
*handle
;
979 static void smb_full_audit_pread_done(struct tevent_req
*subreq
);
981 static struct tevent_req
*smb_full_audit_pread_send(
982 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
983 struct tevent_context
*ev
, struct files_struct
*fsp
,
984 void *data
, size_t n
, off_t offset
)
986 struct tevent_req
*req
, *subreq
;
987 struct smb_full_audit_pread_state
*state
;
989 req
= tevent_req_create(mem_ctx
, &state
,
990 struct smb_full_audit_pread_state
);
992 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
993 fsp_str_do_log(fsp
));
996 state
->handle
= handle
;
999 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
1001 if (tevent_req_nomem(subreq
, req
)) {
1002 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
1003 fsp_str_do_log(fsp
));
1004 return tevent_req_post(req
, ev
);
1006 tevent_req_set_callback(subreq
, smb_full_audit_pread_done
, req
);
1008 do_log(SMB_VFS_OP_PREAD_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1012 static void smb_full_audit_pread_done(struct tevent_req
*subreq
)
1014 struct tevent_req
*req
= tevent_req_callback_data(
1015 subreq
, struct tevent_req
);
1016 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1017 req
, struct smb_full_audit_pread_state
);
1019 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
1020 TALLOC_FREE(subreq
);
1021 tevent_req_done(req
);
1024 static ssize_t
smb_full_audit_pread_recv(struct tevent_req
*req
, int *err
)
1026 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1027 req
, struct smb_full_audit_pread_state
);
1029 if (tevent_req_is_unix_error(req
, err
)) {
1030 do_log(SMB_VFS_OP_PREAD_RECV
, false, state
->handle
, "%s",
1031 fsp_str_do_log(state
->fsp
));
1035 do_log(SMB_VFS_OP_PREAD_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1036 fsp_str_do_log(state
->fsp
));
1042 static ssize_t
smb_full_audit_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
1043 const void *data
, size_t n
)
1047 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
1049 do_log(SMB_VFS_OP_WRITE
, (result
>= 0), handle
, "%s",
1050 fsp_str_do_log(fsp
));
1055 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
1056 const void *data
, size_t n
,
1061 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
1063 do_log(SMB_VFS_OP_PWRITE
, (result
>= 0), handle
, "%s",
1064 fsp_str_do_log(fsp
));
1069 static off_t
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
1070 off_t offset
, int whence
)
1074 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
1076 do_log(SMB_VFS_OP_LSEEK
, (result
!= (ssize_t
)-1), handle
,
1077 "%s", fsp_str_do_log(fsp
));
1082 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
1083 files_struct
*fromfsp
,
1084 const DATA_BLOB
*hdr
, off_t offset
,
1089 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
1091 do_log(SMB_VFS_OP_SENDFILE
, (result
>= 0), handle
,
1092 "%s", fsp_str_do_log(fromfsp
));
1097 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
1098 files_struct
*tofsp
,
1104 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
1106 do_log(SMB_VFS_OP_RECVFILE
, (result
>= 0), handle
,
1107 "%s", fsp_str_do_log(tofsp
));
1112 static int smb_full_audit_rename(vfs_handle_struct
*handle
,
1113 const struct smb_filename
*smb_fname_src
,
1114 const struct smb_filename
*smb_fname_dst
)
1118 result
= SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
1120 do_log(SMB_VFS_OP_RENAME
, (result
>= 0), handle
, "%s|%s",
1121 smb_fname_str_do_log(smb_fname_src
),
1122 smb_fname_str_do_log(smb_fname_dst
));
1127 static int smb_full_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
1131 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
1133 do_log(SMB_VFS_OP_FSYNC
, (result
>= 0), handle
, "%s",
1134 fsp_str_do_log(fsp
));
1139 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
1140 struct smb_filename
*smb_fname
)
1144 result
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
1146 do_log(SMB_VFS_OP_STAT
, (result
>= 0), handle
, "%s",
1147 smb_fname_str_do_log(smb_fname
));
1152 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1153 SMB_STRUCT_STAT
*sbuf
)
1157 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1159 do_log(SMB_VFS_OP_FSTAT
, (result
>= 0), handle
, "%s",
1160 fsp_str_do_log(fsp
));
1165 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
1166 struct smb_filename
*smb_fname
)
1170 result
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
1172 do_log(SMB_VFS_OP_LSTAT
, (result
>= 0), handle
, "%s",
1173 smb_fname_str_do_log(smb_fname
));
1178 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
1179 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
1183 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1185 do_log(SMB_VFS_OP_GET_ALLOC_SIZE
, (result
!= (uint64_t)-1), handle
,
1191 static int smb_full_audit_unlink(vfs_handle_struct
*handle
,
1192 const struct smb_filename
*smb_fname
)
1196 result
= SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
1198 do_log(SMB_VFS_OP_UNLINK
, (result
>= 0), handle
, "%s",
1199 smb_fname_str_do_log(smb_fname
));
1204 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
1205 const char *path
, mode_t mode
)
1209 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1211 do_log(SMB_VFS_OP_CHMOD
, (result
>= 0), handle
, "%s|%o", path
, mode
);
1216 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1221 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1223 do_log(SMB_VFS_OP_FCHMOD
, (result
>= 0), handle
,
1224 "%s|%o", fsp_str_do_log(fsp
), mode
);
1229 static int smb_full_audit_chown(vfs_handle_struct
*handle
,
1230 const char *path
, uid_t uid
, gid_t gid
)
1234 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1236 do_log(SMB_VFS_OP_CHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1237 path
, (long int)uid
, (long int)gid
);
1242 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1243 uid_t uid
, gid_t gid
)
1247 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1249 do_log(SMB_VFS_OP_FCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1250 fsp_str_do_log(fsp
), (long int)uid
, (long int)gid
);
1255 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
1256 const char *path
, uid_t uid
, gid_t gid
)
1260 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1262 do_log(SMB_VFS_OP_LCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1263 path
, (long int)uid
, (long int)gid
);
1268 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
1273 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
1275 do_log(SMB_VFS_OP_CHDIR
, (result
>= 0), handle
, "chdir|%s", path
);
1280 static char *smb_full_audit_getwd(vfs_handle_struct
*handle
)
1284 result
= SMB_VFS_NEXT_GETWD(handle
);
1286 do_log(SMB_VFS_OP_GETWD
, (result
!= NULL
), handle
, "%s",
1287 result
== NULL
? "" : result
);
1292 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
1293 const struct smb_filename
*smb_fname
,
1294 struct smb_file_time
*ft
)
1298 result
= SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
1300 do_log(SMB_VFS_OP_NTIMES
, (result
>= 0), handle
, "%s",
1301 smb_fname_str_do_log(smb_fname
));
1306 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1311 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1313 do_log(SMB_VFS_OP_FTRUNCATE
, (result
>= 0), handle
,
1314 "%s", fsp_str_do_log(fsp
));
1319 static int smb_full_audit_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1320 enum vfs_fallocate_mode mode
,
1326 result
= SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1328 do_log(SMB_VFS_OP_FALLOCATE
, (result
>= 0), handle
,
1329 "%s", fsp_str_do_log(fsp
));
1334 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1335 int op
, off_t offset
, off_t count
, int type
)
1339 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1341 do_log(SMB_VFS_OP_LOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1346 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1347 struct files_struct
*fsp
,
1348 uint32 share_mode
, uint32 access_mask
)
1352 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
1354 do_log(SMB_VFS_OP_KERNEL_FLOCK
, (result
>= 0), handle
, "%s",
1355 fsp_str_do_log(fsp
));
1360 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1365 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1367 do_log(SMB_VFS_OP_LINUX_SETLEASE
, (result
>= 0), handle
, "%s",
1368 fsp_str_do_log(fsp
));
1373 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1374 off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
)
1378 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
1380 do_log(SMB_VFS_OP_GETLOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1385 static int smb_full_audit_symlink(vfs_handle_struct
*handle
,
1386 const char *oldpath
, const char *newpath
)
1390 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1392 do_log(SMB_VFS_OP_SYMLINK
, (result
>= 0), handle
,
1393 "%s|%s", oldpath
, newpath
);
1398 static int smb_full_audit_readlink(vfs_handle_struct
*handle
,
1399 const char *path
, char *buf
, size_t bufsiz
)
1403 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1405 do_log(SMB_VFS_OP_READLINK
, (result
>= 0), handle
, "%s", path
);
1410 static int smb_full_audit_link(vfs_handle_struct
*handle
,
1411 const char *oldpath
, const char *newpath
)
1415 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
1417 do_log(SMB_VFS_OP_LINK
, (result
>= 0), handle
,
1418 "%s|%s", oldpath
, newpath
);
1423 static int smb_full_audit_mknod(vfs_handle_struct
*handle
,
1424 const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1428 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1430 do_log(SMB_VFS_OP_MKNOD
, (result
>= 0), handle
, "%s", pathname
);
1435 static char *smb_full_audit_realpath(vfs_handle_struct
*handle
,
1440 result
= SMB_VFS_NEXT_REALPATH(handle
, path
);
1442 do_log(SMB_VFS_OP_REALPATH
, (result
!= NULL
), handle
, "%s", path
);
1447 static NTSTATUS
smb_full_audit_notify_watch(struct vfs_handle_struct
*handle
,
1448 struct sys_notify_context
*ctx
,
1451 uint32_t *subdir_filter
,
1452 void (*callback
)(struct sys_notify_context
*ctx
,
1454 struct notify_event
*ev
),
1455 void *private_data
, void *handle_p
)
1459 result
= SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
1460 filter
, subdir_filter
, callback
,
1461 private_data
, handle_p
);
1463 do_log(SMB_VFS_OP_NOTIFY_WATCH
, NT_STATUS_IS_OK(result
), handle
, "");
1468 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
1469 const char *path
, unsigned int flags
)
1473 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1475 do_log(SMB_VFS_OP_CHFLAGS
, (result
!= 0), handle
, "%s", path
);
1480 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
1481 const SMB_STRUCT_STAT
*sbuf
)
1483 struct file_id id_zero
;
1484 struct file_id result
;
1486 ZERO_STRUCT(id_zero
);
1488 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1490 do_log(SMB_VFS_OP_FILE_ID_CREATE
,
1491 !file_id_equal(&id_zero
, &result
),
1492 handle
, "%s", file_id_string_tos(&result
));
1497 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
1498 struct files_struct
*fsp
,
1500 TALLOC_CTX
*mem_ctx
,
1501 unsigned int *pnum_streams
,
1502 struct stream_struct
**pstreams
)
1506 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1507 pnum_streams
, pstreams
);
1509 do_log(SMB_VFS_OP_STREAMINFO
, NT_STATUS_IS_OK(result
), handle
,
1515 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1518 TALLOC_CTX
*mem_ctx
,
1523 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
1526 do_log(SMB_VFS_OP_GET_REAL_FILENAME
, (result
== 0), handle
,
1527 "%s/%s->%s", path
, name
, (result
== 0) ? "" : *found_name
);
1532 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
1537 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1539 do_log(SMB_VFS_OP_CONNECTPATH
, result
!= NULL
, handle
,
1545 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1546 struct byte_range_lock
*br_lck
,
1547 struct lock_struct
*plock
,
1549 struct blocking_lock_record
*blr
)
1553 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1554 blocking_lock
, blr
);
1556 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS
, NT_STATUS_IS_OK(result
), handle
,
1557 "%s:%llu-%llu. type=%d. blocking=%d", fsp_str_do_log(br_lck
->fsp
),
1558 plock
->start
, plock
->size
, plock
->lock_type
, blocking_lock
);
1563 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1564 struct messaging_context
*msg_ctx
,
1565 struct byte_range_lock
*br_lck
,
1566 const struct lock_struct
*plock
)
1570 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1573 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, (result
== 0), handle
,
1574 "%s:%llu-%llu:%d", fsp_str_do_log(br_lck
->fsp
), plock
->start
,
1575 plock
->size
, plock
->lock_type
);
1580 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1581 struct byte_range_lock
*br_lck
,
1582 struct lock_struct
*plock
,
1583 struct blocking_lock_record
*blr
)
1587 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
, blr
);
1589 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS
, (result
== 0), handle
,
1590 "%s:%llu-%llu:%d", fsp_str_do_log(br_lck
->fsp
), plock
->start
,
1596 static bool smb_full_audit_strict_lock(struct vfs_handle_struct
*handle
,
1597 struct files_struct
*fsp
,
1598 struct lock_struct
*plock
)
1602 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1604 do_log(SMB_VFS_OP_STRICT_LOCK
, result
, handle
,
1605 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1611 static void smb_full_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1612 struct files_struct
*fsp
,
1613 struct lock_struct
*plock
)
1615 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1617 do_log(SMB_VFS_OP_STRICT_UNLOCK
, true, handle
,
1618 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1624 static NTSTATUS
smb_full_audit_translate_name(struct vfs_handle_struct
*handle
,
1626 enum vfs_translate_direction direction
,
1627 TALLOC_CTX
*mem_ctx
,
1632 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
1635 do_log(SMB_VFS_OP_TRANSLATE_NAME
, NT_STATUS_IS_OK(result
), handle
, "");
1640 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1641 uint32 security_info
,
1642 struct security_descriptor
**ppdesc
)
1646 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, ppdesc
);
1648 do_log(SMB_VFS_OP_FGET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1649 "%s", fsp_str_do_log(fsp
));
1654 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
1656 uint32 security_info
,
1657 struct security_descriptor
**ppdesc
)
1661 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, ppdesc
);
1663 do_log(SMB_VFS_OP_GET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1669 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1670 uint32 security_info_sent
,
1671 const struct security_descriptor
*psd
)
1675 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
1677 do_log(SMB_VFS_OP_FSET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
, "%s",
1678 fsp_str_do_log(fsp
));
1683 static int smb_full_audit_chmod_acl(vfs_handle_struct
*handle
,
1684 const char *path
, mode_t mode
)
1688 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1690 do_log(SMB_VFS_OP_CHMOD_ACL
, (result
>= 0), handle
,
1691 "%s|%o", path
, mode
);
1696 static int smb_full_audit_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1701 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1703 do_log(SMB_VFS_OP_FCHMOD_ACL
, (result
>= 0), handle
,
1704 "%s|%o", fsp_str_do_log(fsp
), mode
);
1709 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct
*handle
,
1711 SMB_ACL_T theacl
, int entry_id
,
1712 SMB_ACL_ENTRY_T
*entry_p
)
1716 result
= SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle
, theacl
, entry_id
,
1719 do_log(SMB_VFS_OP_SYS_ACL_GET_ENTRY
, (result
>= 0), handle
,
1725 static int smb_full_audit_sys_acl_get_tag_type(vfs_handle_struct
*handle
,
1727 SMB_ACL_ENTRY_T entry_d
,
1728 SMB_ACL_TAG_T
*tag_type_p
)
1732 result
= SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle
, entry_d
,
1735 do_log(SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, (result
>= 0), handle
,
1741 static int smb_full_audit_sys_acl_get_permset(vfs_handle_struct
*handle
,
1743 SMB_ACL_ENTRY_T entry_d
,
1744 SMB_ACL_PERMSET_T
*permset_p
)
1748 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle
, entry_d
,
1751 do_log(SMB_VFS_OP_SYS_ACL_GET_PERMSET
, (result
>= 0), handle
,
1757 static void * smb_full_audit_sys_acl_get_qualifier(vfs_handle_struct
*handle
,
1759 SMB_ACL_ENTRY_T entry_d
)
1763 result
= SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle
, entry_d
);
1765 do_log(SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, (result
!= NULL
), handle
,
1771 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1773 SMB_ACL_TYPE_T type
)
1777 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
);
1779 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE
, (result
!= NULL
), handle
,
1785 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
1790 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
);
1792 do_log(SMB_VFS_OP_SYS_ACL_GET_FD
, (result
!= NULL
), handle
,
1793 "%s", fsp_str_do_log(fsp
));
1798 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct
*handle
,
1800 SMB_ACL_PERMSET_T permset
)
1804 result
= SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle
, permset
);
1806 do_log(SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, (result
>= 0), handle
,
1812 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct
*handle
,
1814 SMB_ACL_PERMSET_T permset
,
1815 SMB_ACL_PERM_T perm
)
1819 result
= SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle
, permset
, perm
);
1821 do_log(SMB_VFS_OP_SYS_ACL_ADD_PERM
, (result
>= 0), handle
,
1827 static char * smb_full_audit_sys_acl_to_text(vfs_handle_struct
*handle
,
1833 result
= SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle
, theacl
, plen
);
1835 do_log(SMB_VFS_OP_SYS_ACL_TO_TEXT
, (result
!= NULL
), handle
,
1841 static SMB_ACL_T
smb_full_audit_sys_acl_init(vfs_handle_struct
*handle
,
1847 result
= SMB_VFS_NEXT_SYS_ACL_INIT(handle
, count
);
1849 do_log(SMB_VFS_OP_SYS_ACL_INIT
, (result
!= NULL
), handle
,
1855 static int smb_full_audit_sys_acl_create_entry(vfs_handle_struct
*handle
,
1857 SMB_ACL_ENTRY_T
*pentry
)
1861 result
= SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle
, pacl
, pentry
);
1863 do_log(SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, (result
>= 0), handle
,
1869 static int smb_full_audit_sys_acl_set_tag_type(vfs_handle_struct
*handle
,
1871 SMB_ACL_ENTRY_T entry
,
1872 SMB_ACL_TAG_T tagtype
)
1876 result
= SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle
, entry
,
1879 do_log(SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, (result
>= 0), handle
,
1885 static int smb_full_audit_sys_acl_set_qualifier(vfs_handle_struct
*handle
,
1887 SMB_ACL_ENTRY_T entry
,
1892 result
= SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle
, entry
, qual
);
1894 do_log(SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, (result
>= 0), handle
,
1900 static int smb_full_audit_sys_acl_set_permset(vfs_handle_struct
*handle
,
1902 SMB_ACL_ENTRY_T entry
,
1903 SMB_ACL_PERMSET_T permset
)
1907 result
= SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle
, entry
, permset
);
1909 do_log(SMB_VFS_OP_SYS_ACL_SET_PERMSET
, (result
>= 0), handle
,
1915 static int smb_full_audit_sys_acl_valid(vfs_handle_struct
*handle
,
1921 result
= SMB_VFS_NEXT_SYS_ACL_VALID(handle
, theacl
);
1923 do_log(SMB_VFS_OP_SYS_ACL_VALID
, (result
>= 0), handle
,
1929 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
1931 const char *name
, SMB_ACL_TYPE_T acltype
,
1936 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
1939 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE
, (result
>= 0), handle
,
1945 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
1950 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
1952 do_log(SMB_VFS_OP_SYS_ACL_SET_FD
, (result
>= 0), handle
,
1953 "%s", fsp_str_do_log(fsp
));
1958 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
1964 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
1966 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, (result
>= 0), handle
,
1972 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct
*handle
,
1974 SMB_ACL_PERMSET_T permset
,
1975 SMB_ACL_PERM_T perm
)
1979 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle
, permset
, perm
);
1981 do_log(SMB_VFS_OP_SYS_ACL_GET_PERM
, (result
>= 0), handle
,
1987 static int smb_full_audit_sys_acl_free_text(vfs_handle_struct
*handle
,
1993 result
= SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle
, text
);
1995 do_log(SMB_VFS_OP_SYS_ACL_FREE_TEXT
, (result
>= 0), handle
,
2001 static int smb_full_audit_sys_acl_free_acl(vfs_handle_struct
*handle
,
2003 SMB_ACL_T posix_acl
)
2007 result
= SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle
, posix_acl
);
2009 do_log(SMB_VFS_OP_SYS_ACL_FREE_ACL
, (result
>= 0), handle
,
2015 static int smb_full_audit_sys_acl_free_qualifier(vfs_handle_struct
*handle
,
2017 SMB_ACL_TAG_T tagtype
)
2021 result
= SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle
, qualifier
,
2024 do_log(SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, (result
>= 0), handle
,
2030 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
2032 const char *name
, void *value
, size_t size
)
2036 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
2038 do_log(SMB_VFS_OP_GETXATTR
, (result
>= 0), handle
,
2039 "%s|%s", path
, name
);
2044 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2045 struct files_struct
*fsp
,
2046 const char *name
, void *value
, size_t size
)
2050 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2052 do_log(SMB_VFS_OP_FGETXATTR
, (result
>= 0), handle
,
2053 "%s|%s", fsp_str_do_log(fsp
), name
);
2058 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
2059 const char *path
, char *list
, size_t size
)
2063 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
2065 do_log(SMB_VFS_OP_LISTXATTR
, (result
>= 0), handle
, "%s", path
);
2070 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
2071 struct files_struct
*fsp
, char *list
,
2076 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
2078 do_log(SMB_VFS_OP_FLISTXATTR
, (result
>= 0), handle
,
2079 "%s", fsp_str_do_log(fsp
));
2084 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
2090 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2092 do_log(SMB_VFS_OP_REMOVEXATTR
, (result
>= 0), handle
,
2093 "%s|%s", path
, name
);
2098 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2099 struct files_struct
*fsp
,
2104 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2106 do_log(SMB_VFS_OP_FREMOVEXATTR
, (result
>= 0), handle
,
2107 "%s|%s", fsp_str_do_log(fsp
), name
);
2112 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
2114 const char *name
, const void *value
, size_t size
,
2119 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
2122 do_log(SMB_VFS_OP_SETXATTR
, (result
>= 0), handle
,
2123 "%s|%s", path
, name
);
2128 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2129 struct files_struct
*fsp
, const char *name
,
2130 const void *value
, size_t size
, int flags
)
2134 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2136 do_log(SMB_VFS_OP_FSETXATTR
, (result
>= 0), handle
,
2137 "%s|%s", fsp_str_do_log(fsp
), name
);
2142 static int smb_full_audit_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2146 result
= SMB_VFS_NEXT_AIO_READ(handle
, fsp
, aiocb
);
2147 do_log(SMB_VFS_OP_AIO_READ
, (result
>= 0), handle
,
2148 "%s", fsp_str_do_log(fsp
));
2153 static int smb_full_audit_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2157 result
= SMB_VFS_NEXT_AIO_WRITE(handle
, fsp
, aiocb
);
2158 do_log(SMB_VFS_OP_AIO_WRITE
, (result
>= 0), handle
,
2159 "%s", fsp_str_do_log(fsp
));
2164 static ssize_t
smb_full_audit_aio_return(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2168 result
= SMB_VFS_NEXT_AIO_RETURN(handle
, fsp
, aiocb
);
2169 do_log(SMB_VFS_OP_AIO_RETURN
, (result
>= 0), handle
,
2170 "%s", fsp_str_do_log(fsp
));
2175 static int smb_full_audit_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2179 result
= SMB_VFS_NEXT_AIO_CANCEL(handle
, fsp
, aiocb
);
2180 do_log(SMB_VFS_OP_AIO_CANCEL
, (result
>= 0), handle
,
2181 "%s", fsp_str_do_log(fsp
));
2186 static int smb_full_audit_aio_error(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2190 result
= SMB_VFS_NEXT_AIO_ERROR(handle
, fsp
, aiocb
);
2191 do_log(SMB_VFS_OP_AIO_ERROR
, (result
>= 0), handle
,
2192 "%s", fsp_str_do_log(fsp
));
2197 static int smb_full_audit_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
)
2201 result
= SMB_VFS_NEXT_AIO_FSYNC(handle
, fsp
, op
, aiocb
);
2202 do_log(SMB_VFS_OP_AIO_FSYNC
, (result
>= 0), handle
,
2203 "%s", fsp_str_do_log(fsp
));
2208 static int smb_full_audit_aio_suspend(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const SMB_STRUCT_AIOCB
* const aiocb
[], int n
, const struct timespec
*ts
)
2212 result
= SMB_VFS_NEXT_AIO_SUSPEND(handle
, fsp
, aiocb
, n
, ts
);
2213 do_log(SMB_VFS_OP_AIO_SUSPEND
, (result
>= 0), handle
,
2214 "%s", fsp_str_do_log(fsp
));
2219 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
2220 struct files_struct
*fsp
)
2224 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2225 do_log(SMB_VFS_OP_AIO_FORCE
, result
, handle
,
2226 "%s", fsp_str_do_log(fsp
));
2231 static bool smb_full_audit_is_offline(struct vfs_handle_struct
*handle
,
2232 const struct smb_filename
*fname
,
2233 SMB_STRUCT_STAT
*sbuf
)
2237 result
= SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
2238 do_log(SMB_VFS_OP_IS_OFFLINE
, result
, handle
, "%s",
2239 smb_fname_str_do_log(fname
));
2243 static int smb_full_audit_set_offline(struct vfs_handle_struct
*handle
,
2244 const struct smb_filename
*fname
)
2248 result
= SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
2249 do_log(SMB_VFS_OP_SET_OFFLINE
, result
>= 0, handle
, "%s",
2250 smb_fname_str_do_log(fname
));
2254 static struct vfs_fn_pointers vfs_full_audit_fns
= {
2256 /* Disk operations */
2258 .connect_fn
= smb_full_audit_connect
,
2259 .disconnect_fn
= smb_full_audit_disconnect
,
2260 .disk_free_fn
= smb_full_audit_disk_free
,
2261 .get_quota_fn
= smb_full_audit_get_quota
,
2262 .set_quota_fn
= smb_full_audit_set_quota
,
2263 .get_shadow_copy_data_fn
= smb_full_audit_get_shadow_copy_data
,
2264 .statvfs_fn
= smb_full_audit_statvfs
,
2265 .fs_capabilities_fn
= smb_full_audit_fs_capabilities
,
2266 .opendir_fn
= smb_full_audit_opendir
,
2267 .fdopendir_fn
= smb_full_audit_fdopendir
,
2268 .readdir_fn
= smb_full_audit_readdir
,
2269 .seekdir_fn
= smb_full_audit_seekdir
,
2270 .telldir_fn
= smb_full_audit_telldir
,
2271 .rewind_dir_fn
= smb_full_audit_rewinddir
,
2272 .mkdir_fn
= smb_full_audit_mkdir
,
2273 .rmdir_fn
= smb_full_audit_rmdir
,
2274 .closedir_fn
= smb_full_audit_closedir
,
2275 .init_search_op_fn
= smb_full_audit_init_search_op
,
2276 .open_fn
= smb_full_audit_open
,
2277 .create_file_fn
= smb_full_audit_create_file
,
2278 .close_fn
= smb_full_audit_close
,
2279 .read_fn
= smb_full_audit_read
,
2280 .pread_fn
= smb_full_audit_pread
,
2281 .pread_send_fn
= smb_full_audit_pread_send
,
2282 .pread_recv_fn
= smb_full_audit_pread_recv
,
2283 .write_fn
= smb_full_audit_write
,
2284 .pwrite_fn
= smb_full_audit_pwrite
,
2285 .lseek_fn
= smb_full_audit_lseek
,
2286 .sendfile_fn
= smb_full_audit_sendfile
,
2287 .recvfile_fn
= smb_full_audit_recvfile
,
2288 .rename_fn
= smb_full_audit_rename
,
2289 .fsync_fn
= smb_full_audit_fsync
,
2290 .stat_fn
= smb_full_audit_stat
,
2291 .fstat_fn
= smb_full_audit_fstat
,
2292 .lstat_fn
= smb_full_audit_lstat
,
2293 .get_alloc_size_fn
= smb_full_audit_get_alloc_size
,
2294 .unlink_fn
= smb_full_audit_unlink
,
2295 .chmod_fn
= smb_full_audit_chmod
,
2296 .fchmod_fn
= smb_full_audit_fchmod
,
2297 .chown_fn
= smb_full_audit_chown
,
2298 .fchown_fn
= smb_full_audit_fchown
,
2299 .lchown_fn
= smb_full_audit_lchown
,
2300 .chdir_fn
= smb_full_audit_chdir
,
2301 .getwd_fn
= smb_full_audit_getwd
,
2302 .ntimes_fn
= smb_full_audit_ntimes
,
2303 .ftruncate_fn
= smb_full_audit_ftruncate
,
2304 .fallocate_fn
= smb_full_audit_fallocate
,
2305 .lock_fn
= smb_full_audit_lock
,
2306 .kernel_flock_fn
= smb_full_audit_kernel_flock
,
2307 .linux_setlease_fn
= smb_full_audit_linux_setlease
,
2308 .getlock_fn
= smb_full_audit_getlock
,
2309 .symlink_fn
= smb_full_audit_symlink
,
2310 .readlink_fn
= smb_full_audit_readlink
,
2311 .link_fn
= smb_full_audit_link
,
2312 .mknod_fn
= smb_full_audit_mknod
,
2313 .realpath_fn
= smb_full_audit_realpath
,
2314 .notify_watch_fn
= smb_full_audit_notify_watch
,
2315 .chflags_fn
= smb_full_audit_chflags
,
2316 .file_id_create_fn
= smb_full_audit_file_id_create
,
2317 .streaminfo_fn
= smb_full_audit_streaminfo
,
2318 .get_real_filename_fn
= smb_full_audit_get_real_filename
,
2319 .connectpath_fn
= smb_full_audit_connectpath
,
2320 .brl_lock_windows_fn
= smb_full_audit_brl_lock_windows
,
2321 .brl_unlock_windows_fn
= smb_full_audit_brl_unlock_windows
,
2322 .brl_cancel_windows_fn
= smb_full_audit_brl_cancel_windows
,
2323 .strict_lock_fn
= smb_full_audit_strict_lock
,
2324 .strict_unlock_fn
= smb_full_audit_strict_unlock
,
2325 .translate_name_fn
= smb_full_audit_translate_name
,
2326 .fget_nt_acl_fn
= smb_full_audit_fget_nt_acl
,
2327 .get_nt_acl_fn
= smb_full_audit_get_nt_acl
,
2328 .fset_nt_acl_fn
= smb_full_audit_fset_nt_acl
,
2329 .chmod_acl_fn
= smb_full_audit_chmod_acl
,
2330 .fchmod_acl_fn
= smb_full_audit_fchmod_acl
,
2331 .sys_acl_get_entry_fn
= smb_full_audit_sys_acl_get_entry
,
2332 .sys_acl_get_tag_type_fn
= smb_full_audit_sys_acl_get_tag_type
,
2333 .sys_acl_get_permset_fn
= smb_full_audit_sys_acl_get_permset
,
2334 .sys_acl_get_qualifier_fn
= smb_full_audit_sys_acl_get_qualifier
,
2335 .sys_acl_get_file_fn
= smb_full_audit_sys_acl_get_file
,
2336 .sys_acl_get_fd_fn
= smb_full_audit_sys_acl_get_fd
,
2337 .sys_acl_clear_perms_fn
= smb_full_audit_sys_acl_clear_perms
,
2338 .sys_acl_add_perm_fn
= smb_full_audit_sys_acl_add_perm
,
2339 .sys_acl_to_text_fn
= smb_full_audit_sys_acl_to_text
,
2340 .sys_acl_init_fn
= smb_full_audit_sys_acl_init
,
2341 .sys_acl_create_entry_fn
= smb_full_audit_sys_acl_create_entry
,
2342 .sys_acl_set_tag_type_fn
= smb_full_audit_sys_acl_set_tag_type
,
2343 .sys_acl_set_qualifier_fn
= smb_full_audit_sys_acl_set_qualifier
,
2344 .sys_acl_set_permset_fn
= smb_full_audit_sys_acl_set_permset
,
2345 .sys_acl_valid_fn
= smb_full_audit_sys_acl_valid
,
2346 .sys_acl_set_file_fn
= smb_full_audit_sys_acl_set_file
,
2347 .sys_acl_set_fd_fn
= smb_full_audit_sys_acl_set_fd
,
2348 .sys_acl_delete_def_file_fn
= smb_full_audit_sys_acl_delete_def_file
,
2349 .sys_acl_get_perm_fn
= smb_full_audit_sys_acl_get_perm
,
2350 .sys_acl_free_text_fn
= smb_full_audit_sys_acl_free_text
,
2351 .sys_acl_free_acl_fn
= smb_full_audit_sys_acl_free_acl
,
2352 .sys_acl_free_qualifier_fn
= smb_full_audit_sys_acl_free_qualifier
,
2353 .getxattr_fn
= smb_full_audit_getxattr
,
2354 .fgetxattr_fn
= smb_full_audit_fgetxattr
,
2355 .listxattr_fn
= smb_full_audit_listxattr
,
2356 .flistxattr_fn
= smb_full_audit_flistxattr
,
2357 .removexattr_fn
= smb_full_audit_removexattr
,
2358 .fremovexattr_fn
= smb_full_audit_fremovexattr
,
2359 .setxattr_fn
= smb_full_audit_setxattr
,
2360 .fsetxattr_fn
= smb_full_audit_fsetxattr
,
2361 .aio_read_fn
= smb_full_audit_aio_read
,
2362 .aio_write_fn
= smb_full_audit_aio_write
,
2363 .aio_return_fn
= smb_full_audit_aio_return
,
2364 .aio_cancel_fn
= smb_full_audit_aio_cancel
,
2365 .aio_error_fn
= smb_full_audit_aio_error
,
2366 .aio_fsync_fn
= smb_full_audit_aio_fsync
,
2367 .aio_suspend_fn
= smb_full_audit_aio_suspend
,
2368 .aio_force_fn
= smb_full_audit_aio_force
,
2369 .is_offline_fn
= smb_full_audit_is_offline
,
2370 .set_offline_fn
= smb_full_audit_set_offline
,
2373 NTSTATUS
vfs_full_audit_init(void)
2375 NTSTATUS ret
= smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
2376 "full_audit", &vfs_full_audit_fns
);
2378 if (!NT_STATUS_IS_OK(ret
))
2381 vfs_full_audit_debug_level
= debug_add_class("full_audit");
2382 if (vfs_full_audit_debug_level
== -1) {
2383 vfs_full_audit_debug_level
= DBGC_VFS
;
2384 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2387 DEBUG(10, ("vfs_full_audit: Debug class number of "
2388 "'full_audit': %d\n", vfs_full_audit_debug_level
));